vendredi 19 septembre 2014

UIPopoverPresentationController on iOS8 always shows in fullscreen


Vote count:

0




When you press a button which is on a custom view, I want to show (width: 200, height:300) popover on iOS8. When I do this, I get the popover as fullscreen popover. (the delegate also does not work. it doesn't call prepareForPopoverPresentation etc...


How can I show the popover correctly with width:200, height=300 and what can be the problem with the delegate not calling?



-(void)buttonPressed:(UIView*)sender{
CGRect rect=[self convertRect:sender.frame fromView:sender.superview];

rect.origin.y-=10;

rect.size.width=60;
rect.size.height=60;

self.stViewController=[[STViewController alloc]init];


self.stViewController.view.frame=CGRectMake(0, 0, 200, 300);

self.stViewController.modalPresentationStyle=UIModalPresentationPopover;
self.stViewController.preferredContentSize = CGSizeMake(200,300);

if (self.stViewController.popoverPresentationController)
{
self.stViewController.popoverPresentationController.delegate=self;
self.stViewController.popoverPresentationController.sourceView=self.superview;
self.stViewController.popoverPresentationController.sourceRect=rect;
self.stViewController.popoverPresentationController.permittedArrowDirections = UIPopoverArrowDirectionLeft|UIPopoverArrowDirectionRight;

[[(AppDelegate*)[UIApplication sharedApplication].delegate mainViewController] presentViewController:self.stViewController animated:YES completion:nil];
}
}


asked 46 secs ago







UIPopoverPresentationController on iOS8 always shows in fullscreen

Aucun commentaire:

Enregistrer un commentaire