【问题标题】:customize the look of UIPopoverControllers for popover views为弹出视图自定义 UIPopoverControllers 的外观
【发布时间】:2012-04-20 01:44:54
【问题描述】:

我一直在研究通过 IBAction 和 NIB 在这篇文章中解决的同一个难题:

UIPopover customization Post on stackoverflow

我想知道,这是否可以以及如何使用按钮或其他控件的 segue 来实现?我的 segue 似乎没有使以下行生效:

$popover.popoverBackgroundViewClass=[CustomPopoverBackgroundView class];

因为我的 custompopover.h 或 .m 代码都没有加载或被调用。有人愿意告诉我我实施得不好的地方吗?

此外,我使用了本教程中的一些内容,但我似乎仍然想念如何正确实现这一点:

thinkvitamin tutorial post

感谢您的关注!

【问题讨论】:

    标签: ios uipopovercontroller customization popover


    【解决方案1】:

    这样的事情怎么样?

    - (IBAction)yourAction:(id)sender {
    
    UIStoryboard *myStoryboard = self.storyboard;
    ViewController *myViewController = [myStoryboard instantiateViewControllerWithIdentifier:@"ViewController"]; // Identifier of the vc in attributes inspector, throws exception if not filled in!
    
    //Set myViewController properties here
    
    UIPopoverController *myPopover = [[UIPopoverController alloc] initWithContentViewController:myViewController];
    myPopover.popoverBackgroundViewClass = [CustomPopoverBackgroundView class]; 
    
    [myPopover presentPopoverFromRect:CGRectMake(0,0,100,100) inView:self.view permittedArrowDirections:0 animated:YES]; 
    }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2016-06-12
      • 2013-02-21
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多