mirror of
https://github.com/zhigang1992/ECSlidingViewController.git
synced 2026-03-29 00:18:36 +08:00
55 lines
1.7 KiB
Objective-C
55 lines
1.7 KiB
Objective-C
//
|
|
// UnderRightViewController.m
|
|
// ECSlidingViewController
|
|
//
|
|
// Created by Michael Enriquez on 1/23/12.
|
|
// Copyright (c) 2012 EdgeCase. All rights reserved.
|
|
//
|
|
|
|
#import "UnderRightViewController.h"
|
|
|
|
@interface UnderRightViewController()
|
|
@property (nonatomic, unsafe_unretained) CGFloat peekLeftAmount;
|
|
@end
|
|
|
|
@implementation UnderRightViewController
|
|
@synthesize peekLeftAmount;
|
|
|
|
- (void)viewDidLoad
|
|
{
|
|
[super viewDidLoad];
|
|
self.peekLeftAmount = 40.0f;
|
|
[self.slidingViewController setAnchorLeftPeekAmount:self.peekLeftAmount];
|
|
self.slidingViewController.underRightWidthLayout = ECVariableRevealWidth;
|
|
}
|
|
|
|
- (void)searchBarTextDidBeginEditing:(UISearchBar *)searchBar
|
|
{
|
|
[self.slidingViewController anchorTopViewOffScreenTo:ECLeft animations:^{
|
|
CGRect frame = self.view.frame;
|
|
frame.origin.x = 0.0f;
|
|
if (UIInterfaceOrientationIsLandscape(self.interfaceOrientation)) {
|
|
frame.size.width = [UIScreen mainScreen].bounds.size.height;
|
|
} else if (UIInterfaceOrientationIsPortrait(self.interfaceOrientation)) {
|
|
frame.size.width = [UIScreen mainScreen].bounds.size.width;
|
|
}
|
|
self.view.frame = frame;
|
|
} onComplete:nil];
|
|
}
|
|
|
|
- (void)searchBarTextDidEndEditing:(UISearchBar *)searchBar
|
|
{
|
|
[self.slidingViewController anchorTopViewTo:ECLeft animations:^{
|
|
CGRect frame = self.view.frame;
|
|
frame.origin.x = self.peekLeftAmount;
|
|
if (UIInterfaceOrientationIsLandscape(self.interfaceOrientation)) {
|
|
frame.size.width = [UIScreen mainScreen].bounds.size.height - self.peekLeftAmount;
|
|
} else if (UIInterfaceOrientationIsPortrait(self.interfaceOrientation)) {
|
|
frame.size.width = [UIScreen mainScreen].bounds.size.width - self.peekLeftAmount;
|
|
}
|
|
self.view.frame = frame;
|
|
} onComplete:nil];
|
|
}
|
|
|
|
@end
|