adding in rotation for detailViewController

This commit is contained in:
Roy Yang 2012-06-09 15:07:32 -07:00
parent 1ddf238839
commit 7b68b7e0d0
2 changed files with 23 additions and 1 deletions

View file

@ -227,7 +227,12 @@
storyDetailViewController.view.tag = 12;
[detailViewController.view addSubview:storyDetailViewController.view];
storyDetailViewController.view.frame = CGRectMake(0,44,704,704);
if (UIInterfaceOrientationIsPortrait(detailViewController.interfaceOrientation)) {
storyDetailViewController.view.frame = CGRectMake(0,44,768,960);
} else {
storyDetailViewController.view.frame = CGRectMake(0,44,704,704);
}
} else{
UIBarButtonItem *newBackButton = [[UIBarButtonItem alloc] initWithTitle:feedTitle style: UIBarButtonItemStyleBordered target: nil action: nil];
[feedDetailViewController.navigationItem setBackBarButtonItem: newBackButton];

View file

@ -42,4 +42,21 @@
return YES;
}
- (void)willAnimateRotationToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration {
NSArray *subviews = [[self.view subviews] copy];
for (UIView *subview in subviews) {
if (subview.tag == 12) {
if (toInterfaceOrientation == UIInterfaceOrientationPortrait || toInterfaceOrientation == UIInterfaceOrientationPortraitUpsideDown) {
NSLog(@"portrait");
subview.frame = CGRectMake(0,44,768,960);
} else {
NSLog(@"landscape");
subview.frame = CGRectMake(0,44,704,704);
}
}
}
}
@end