Skip to content

Commit

Permalink
Making some small fixes to the demo app for iPhone 5
Browse files Browse the repository at this point in the history
  • Loading branch information
gotosleep committed Feb 11, 2013
1 parent 18e3698 commit e6b2818
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 16 deletions.
15 changes: 7 additions & 8 deletions JASidePanels/Demo/JACenterViewController.m
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -31,21 +31,20 @@ @interface JACenterViewController ()


@implementation JACenterViewController @implementation JACenterViewController


- (id)init {
if (self = [super init]) {
self.title = @"Center Panel";
}
return self;
}

- (void)viewDidLoad { - (void)viewDidLoad {
[super viewDidLoad]; [super viewDidLoad];


CGFloat red = (CGFloat)arc4random() / 0x100000000; CGFloat red = (CGFloat)arc4random() / 0x100000000;
CGFloat green = (CGFloat)arc4random() / 0x100000000; CGFloat green = (CGFloat)arc4random() / 0x100000000;
CGFloat blue = (CGFloat)arc4random() / 0x100000000; CGFloat blue = (CGFloat)arc4random() / 0x100000000;
self.view.backgroundColor = [UIColor colorWithRed:red green:green blue:blue alpha:1.0f]; self.view.backgroundColor = [UIColor colorWithRed:red green:green blue:blue alpha:1.0f];

UILabel *label = [[UILabel alloc] init];
label.font = [UIFont boldSystemFontOfSize:20.0f];
label.text = @"Center Panel";
[label sizeToFit];
label.center = CGPointMake(floorf(self.view.bounds.size.width/2.0f), floorf((self.view.bounds.size.height - self.navigationController.navigationBar.frame.size.height)/2.0f));
label.autoresizingMask = UIViewAutoresizingFlexibleRightMargin | UIViewAutoresizingFlexibleBottomMargin | UIViewAutoresizingFlexibleLeftMargin | UIViewAutoresizingFlexibleTopMargin;
[self.view addSubview:label];
} }


@end @end
12 changes: 6 additions & 6 deletions JASidePanels/Demo/JALeftViewController.m
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -54,12 +54,12 @@ - (void)viewDidLoad {
label.backgroundColor = [UIColor clearColor]; label.backgroundColor = [UIColor clearColor];
label.text = @"Left Panel"; label.text = @"Left Panel";
[label sizeToFit]; [label sizeToFit];
label.autoresizingMask = UIViewAutoresizingFlexibleRightMargin | UIViewAutoresizingFlexibleBottomMargin | UIViewAutoresizingFlexibleLeftMargin | UIViewAutoresizingFlexibleTopMargin; label.autoresizingMask = UIViewAutoresizingFlexibleRightMargin | UIViewAutoresizingFlexibleLeftMargin | UIViewAutoresizingFlexibleBottomMargin;
[self.view addSubview:label]; [self.view addSubview:label];
self.label = label; self.label = label;


UIButton *button = [UIButton buttonWithType:UIButtonTypeRoundedRect]; UIButton *button = [UIButton buttonWithType:UIButtonTypeRoundedRect];
button.frame = CGRectMake(20.0f, 20.0f, 200.0f, 40.0f); button.frame = CGRectMake(20.0f, 70.0f, 200.0f, 40.0f);
button.autoresizingMask = UIViewAutoresizingFlexibleRightMargin | UIViewAutoresizingFlexibleBottomMargin; button.autoresizingMask = UIViewAutoresizingFlexibleRightMargin | UIViewAutoresizingFlexibleBottomMargin;
[button setTitle:@"Hide Center" forState:UIControlStateNormal]; [button setTitle:@"Hide Center" forState:UIControlStateNormal];
[button addTarget:self action:@selector(_hideTapped:) forControlEvents:UIControlEventTouchUpInside]; [button addTarget:self action:@selector(_hideTapped:) forControlEvents:UIControlEventTouchUpInside];
Expand All @@ -76,7 +76,7 @@ - (void)viewDidLoad {
self.show = button; self.show = button;


button = [UIButton buttonWithType:UIButtonTypeRoundedRect]; button = [UIButton buttonWithType:UIButtonTypeRoundedRect];
button.frame = CGRectMake(20.0f, 70.0f, 200.0f, 40.0f); button.frame = CGRectMake(20.0f, 120.0f, 200.0f, 40.0f);
button.autoresizingMask = UIViewAutoresizingFlexibleRightMargin | UIViewAutoresizingFlexibleBottomMargin; button.autoresizingMask = UIViewAutoresizingFlexibleRightMargin | UIViewAutoresizingFlexibleBottomMargin;
[button setTitle:@"Remove Right Panel" forState:UIControlStateNormal]; [button setTitle:@"Remove Right Panel" forState:UIControlStateNormal];
[button addTarget:self action:@selector(_removeRightPanelTapped:) forControlEvents:UIControlEventTouchUpInside]; [button addTarget:self action:@selector(_removeRightPanelTapped:) forControlEvents:UIControlEventTouchUpInside];
Expand All @@ -93,7 +93,7 @@ - (void)viewDidLoad {
self.addRightPanel = button; self.addRightPanel = button;


button = [UIButton buttonWithType:UIButtonTypeRoundedRect]; button = [UIButton buttonWithType:UIButtonTypeRoundedRect];
button.frame = CGRectMake(20.0f, 245.0f, 200.0f, 40.0f); button.frame = CGRectMake(20.0f, 170.0f, 200.0f, 40.0f);
button.autoresizingMask = UIViewAutoresizingFlexibleRightMargin; button.autoresizingMask = UIViewAutoresizingFlexibleRightMargin;
[button setTitle:@"Change Center Panel" forState:UIControlStateNormal]; [button setTitle:@"Change Center Panel" forState:UIControlStateNormal];
[button addTarget:self action:@selector(_changeCenterPanelTapped:) forControlEvents:UIControlEventTouchUpInside]; [button addTarget:self action:@selector(_changeCenterPanelTapped:) forControlEvents:UIControlEventTouchUpInside];
Expand All @@ -103,7 +103,7 @@ - (void)viewDidLoad {


- (void)viewWillAppear:(BOOL)animated { - (void)viewWillAppear:(BOOL)animated {
[super viewWillAppear:animated]; [super viewWillAppear:animated];
self.label.center = CGPointMake(floorf(self.sidePanelController.leftVisibleWidth/2.0f), floorf(self.view.bounds.size.height/2.0f)); self.label.center = CGPointMake(floorf(self.sidePanelController.leftVisibleWidth/2.0f), 25.0f);
} }


#pragma mark - Button Actions #pragma mark - Button Actions
Expand Down Expand Up @@ -133,7 +133,7 @@ - (void)_addRightPanelTapped:(id)sender {
} }


- (void)_changeCenterPanelTapped:(id)sender { - (void)_changeCenterPanelTapped:(id)sender {
self.sidePanelController.centerPanel = [[JACenterViewController alloc] init]; self.sidePanelController.centerPanel = [[UINavigationController alloc] initWithRootViewController:[[JACenterViewController alloc] init]];
} }


@end @end
4 changes: 2 additions & 2 deletions JASidePanels/Demo/JARightViewController.m
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ - (void)viewDidLoad {
self.view.backgroundColor = [UIColor redColor]; self.view.backgroundColor = [UIColor redColor];
self.label.text = @"Right Panel"; self.label.text = @"Right Panel";
[self.label sizeToFit]; [self.label sizeToFit];
self.hide.frame = CGRectMake(self.view.bounds.size.width - 220.0f, 20.0f, 200.0f, 40.0f); self.hide.frame = CGRectMake(self.view.bounds.size.width - 220.0f, 70.0f, 200.0f, 40.0f);
self.hide.autoresizingMask = UIViewAutoresizingFlexibleLeftMargin | UIViewAutoresizingFlexibleBottomMargin; self.hide.autoresizingMask = UIViewAutoresizingFlexibleLeftMargin | UIViewAutoresizingFlexibleBottomMargin;
self.show.frame = self.hide.frame; self.show.frame = self.hide.frame;
self.show.autoresizingMask = self.hide.autoresizingMask; self.show.autoresizingMask = self.hide.autoresizingMask;
Expand All @@ -52,7 +52,7 @@ - (void)viewDidLoad {


- (void)viewWillAppear:(BOOL)animated { - (void)viewWillAppear:(BOOL)animated {
[super viewWillAppear:animated]; [super viewWillAppear:animated];
self.label.center = CGPointMake(floorf((self.view.bounds.size.width - self.sidePanelController.rightVisibleWidth) + self.sidePanelController.rightVisibleWidth/2.0f), floorf(self.view.bounds.size.height/2.0f)); self.label.center = CGPointMake(floorf((self.view.bounds.size.width - self.sidePanelController.rightVisibleWidth) + self.sidePanelController.rightVisibleWidth/2.0f), 25.0f);
} }


@end @end

0 comments on commit e6b2818

Please sign in to comment.