iphone popover

徐兴昌
2023-12-01
// This is your CustomPopoverController.m

@interface CustomPopoverController () <UIPopoverPresentationControllerDelegate>

@end

@implementation CustomPopoverController.m

// 必须在ViewController初始化的时候 设置delegate
// 如果在viewdidload设置 就已经晚了
- (instancetype)init {
    if (self = [super init]) {
        self.modalPresentationStyle = UIModalPresentationPopover;
        self.popoverPresentationController.delegate = self;
    }
    return self;
}


//实现该代理方法,返回UIModalPresentationNone值,可以在iPhone设备实现popover效果

- (UIModalPresentationStyle)adaptivePresentationStyleForPresentationController:(UIPresentationController *)controller {
    return UIModalPresentationNone; //You have to specify this particular value in order to make it work on iPhone.//不适配(不区分ipad或iPhone)
}

 

 类似资料:

相关阅读

相关文章

相关问答