码迷,mamicode.com
首页 > 其他好文 > 详细

presentation Controllers的使用

时间:2014-12-10 22:53:25      阅读:216      评论:0      收藏:0      [点我收藏+]

标签:ios   presentation control   

presentation Controllers的使用

by 伍雪颖

bubuko.com,布布扣

@interface ViewController ()<UIPopoverPresentationControllerDelegate, UIAdaptivePresentationControllerDelegate>

@end

@implementation ViewController

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

- (IBAction)show:(id)sender {
    UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"Main" bundle:nil];
    TestViewController *contentViewController = [storyboard instantiateViewControllerWithIdentifier:NSStringFromClass([TestViewController class])];
    contentViewController.modalPresentationStyle = UIModalPresentationPopover;
    UIPopoverPresentationController *detailPopover = contentViewController.popoverPresentationController;
    detailPopover.delegate = self;
    detailPopover.barButtonItem = sender;
    detailPopover.permittedArrowDirections = UIPopoverArrowDirectionAny;
    [self presentViewController:contentViewController animated:YES completion:nil];
}

- (UIModalPresentationStyle)adaptivePresentationStyleForPresentationController:(UIPresentationController *)controller {
    return UIModalPresentationNone;
}

- (UIViewController *)presentationController:(UIPresentationController *)controller viewControllerForAdaptivePresentationStyle:(UIModalPresentationStyle)style {
    UINavigationController *navController = [[UINavigationController alloc] initWithRootViewController:controller.presentedViewController];
    return navController;
}


presentation Controllers的使用

标签:ios   presentation control   

原文地址:http://blog.csdn.net/rainlesvio/article/details/41852909

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!