2012-04-20 50 views
0

我一直工作在同一个难题,在这个帖子与IBAction为和NIB解决了一下:定制UIPopoverControllers为酥料饼的意见

UIPopover customization Post on stackoverflow

我在想,这可能和这将如何通过按钮或其他控件使用segue实现?看来,我没有得到以下线采取与我赛格瑞效果:

$popover.popoverBackgroundViewClass=[CustomPopoverBackgroundView class]; 

,因为没有我的custompopover.h或.M代码加载或被调用。任何人都在乎我对我实施得不好的问题有所启发?

另外,我用了一下从本教程,但我似乎仍然错过了如何正确地实现这一点:

thinkvitamin tutorial post

感谢您的关注!

回答

0

这样的事情呢?

- (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]; 
}