Vladimir Stazhilov
Vladimir Stazhilov

Reputation: 1954

UIPopoverController, how to change the size of it?

I've got UIPopoverController in my Split-View application, I just need to make popover longer. In viewDidLoad of DetatilViewController I put:

self.popoverController.popoverContentSize=CGSizeMake(320, 1400);

Nothing happens( when should I put this? thanks

Done with that ^^^ How can I set background for Popover? thaanks

Upvotes: 12

Views: 11164

Answers (5)

Mobile Developer
Mobile Developer

Reputation: 5760

From iOS 7:

popoverView.contentViewController.preferredContentSize =  CGSizeMake(320, 1400);

Upvotes: 14

Hitesh
Hitesh

Reputation: 1230

Set contentSizeForViewInPopover property of UIPopOverController

Upvotes: 14

Priyan Haridas
Priyan Haridas

Reputation: 183

if u want to set the content size of the UIPopoverController try this,

self.popNameList =   [[UIPopoverController alloc]initWithContentViewController:search_table];
self.popNameList.popoverContentSize = CGSizeMake(320, 100);

good luck..

Upvotes: 4

Ansari Awais
Ansari Awais

Reputation: 299

popView.contentViewController.preferredContentSize = Your Size

This works on iOS 8 but will crash or have no effect on lesser versions

Hope the answer :)

Upvotes: 11

jklp
jklp

Reputation: 2101

Try overriding -(CGSize)contentSizeForViewInPopover in your view controller, and return the size you want your view controller to be.

Upvotes: 6

Related Questions