ios - UIView as popup landscape autolayout issue -


i have created simple popup issue when m trying landscape popup not working

note : using autolayout

here's code

mpop = [[mpopup alloc] init]; mpop.frame = cgrectmake(((self.view.frame.size.width) -                          mpop.frame.size.width) / 2,                         ((self.view.frame.size.height) -                          mpop.frame.size.height) / 2,                         mpop.frame.size.width,                         mpop.frame.size.height);  uiview *newview = [[uiview alloc] initwithframe:cgrectmake(0,                                                            0,                                                            self.view.frame.size.width,                                                            self.view.frame.size.height)];  mpop.overlay = newview;  uivisualeffect *blureffect; blureffect = [uiblureffect effectwithstyle:uiblureffectstyledark];  uivisualeffectview *visualeffectview; visualeffectview = [[uivisualeffectview alloc] initwitheffect:blureffect]; visualeffectview.backgroundcolor = [uicolor blackcolor]; visualeffectview.alpha = 0.4; visualeffectview.frame = newview.bounds; [newview addsubview:visualeffectview];  newview.translatesautoresizingmaskintoconstraints = no;   [self.view addsubview:newview]; [mpop showinview:self.view animated:yes];  

it working fine in portrait mode not working in landscape can me out?

you need add auto layout constraints situation. have added code sample , posed on github reference. find in below link. had add code in 2 files, in view controller.m file , view.m file.

https://github.com/mahesh-agrawal/autolayout-popup

check running it. if want make width or height dynamic can replace hard coded value calculation below.

[[uiscreen mainscreen] bounds].size.width * (290.0/320.0) instead of 290.0


Comments

Popular posts from this blog

javascript - Thinglink image not visible until browser resize -

firebird - Error "invalid transaction handle (expecting explicit transaction start)" executing script from Delphi -

mongodb - How to keep track of users making Stripe Payments -