ios - Can't change size for UIPopover? -


i'm writing app needs spawn popover in order add new note. end, have kind of trick, however, can't seem adjust size of popover. how i'm spawning it:

uibutton* btn =sender; uiviewcontroller* footroller = [[uiviewcontroller alloc] init];  cgrect rectfoo = cgrectmake(0, 0, 100, 100); uiview* fooview = [[uiview alloc] initwithframe:rectfoo]; [fooview setbackgroundcolor:[uicolor redcolor]]; [footroller setview:fooview]; popover =[[uipopovercontroller alloc] initwithcontentviewcontroller:footroller];  [popover presentpopoverfromrect:btn.frame                          inview:self.view        permittedarrowdirections:uipopoverarrowdirectionleft                        animated:yes]; 

any thoughts? it's not respecting view size.

you should not calling setview: on view controller. let view controller setup own view.

the proper way size popover either override contentsizeforviewinpopover method of view controller return size or set popovercontentsize property on popover.

uibutton* btn =sender; uiviewcontroller* footroller = [[uiviewcontroller alloc] init];  popover = [[uipopovercontroller alloc] initwithcontentviewcontroller:footroller]; popover.popovercontentsize = cgsizemake(100, 100);  [popover presentpopoverfromrect:btn.frame                          inview:self.view        permittedarrowdirections:uipopoverarrowdirectionleft                        animated:yes]; 

Comments

Popular posts from this blog

Unable to remove the www from url on https using .htaccess -