#import "landscapeViewController.h"
#import "popOver.h"
@interface landscapeViewController ()
@end
@implementation landscapeViewController
@synthesize myPopover;
-(IBAction)showPop:(id)sender {
popOver *popover = [[popOver alloc] init];
UIPopoverController *pop1 = [[UIPopoverController alloc] initWithContentViewController:popover];
self.myPopover = pop1;
[pop1 setDelegate:self];
[pop1 setPopoverContentSize:CGSizeMake(300,200)];
[self.myPopover presentPopoverFromRect:[popbtn bounds] inView:popbtn permittedArrowDirections:UIPopoverArrowDirectionAny animated:YES];
}
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
return UIInterfaceOrientationIsLandscape(interfaceOrientation);
}
@end
这是切换视图的代码:
-(IBAction)switchView:(id)sender {
secondView *second = [[secondView alloc] initWithNibName:nil bundle:nil];
second.modalTransitionStyle = UIModalTransitionStyleCoverVertical;
[self presentModalViewController:second animated:YES];
[self dismissModalViewControllerAnimated:YES];
}
并从第二个视图切换回来:
-(IBAction)switchBack:(id)sender {
landscapeViewController *land = [[landscapeViewController alloc] initWithNibName:nil bundle:nil];
land.modalTransitionStyle = UIModalTransitionStyleFlipHorizontal;
[self presentModalViewController:land animated:YES];
}
我希望有人可以帮助我。提前致谢。再次抱歉英语不好。