ios - Full Screen Custom Popover issue in iOS7 and iOS8 -
i developing app ipad only. in in 1 functionality want display fullcustom popover.
for code below:-
duplicateviewcontroller *viewcontrollerforpopover = [self.storyboard instantiateviewcontrollerwithidentifier:@"duplicatepopovervc"]; viewcontrollerforpopover.arr_studentdetail = self.arrstudentdetail; viewcontrollerforpopover.dictselectedprog = dictselectedprogram; self.popover = [[uipopovercontroller alloc] initwithcontentviewcontroller:viewcontrollerforpopover]; [self.popover setpopovercontentsize:cgsizemake(self.view.frame.size.width, self.view.frame.size.height)]; viewcontrollerforpopover.modalpresentationstyle = uimodalpresentationfullscreen; [self.popover setbackgroundcolor:[[uicolor darkgraycolor] colorwithalphacomponent:0.4]]; [self.popover presentpopoverfromrect:self.view.bounds inview:self.view permittedarrowdirections:0 animated:yes];
i set popover size , tried other option can't make full screen.
viewdidload -> duplicateviewcontroller
[view_main.layer setborderwidth:5.0f]; [view_main.layer setcornerradius:25.0f]; [view_main.layer setbordercolor:[uicolor colorwithred:(29.0f/255.0f) green:134.0f/255.0f blue:140.0f/255.0f alpha:1.0f].cgcolor];
but while running app, display below:-
please me display full screen popover. thank in advance.
create 2 classes first 1 should inherit uipopovercontroller second 1 should inherit uipopoverbackgroundview
for example:
customuipopovercontroller.h
@interface customuipopovercontroller : uipopovercontroller
customuipopovercontroller.m
@implementation customuipopovercontroller - (id)initwithcontentviewcontroller:(uiviewcontroller *)viewcontroller { self = [super initwithcontentviewcontroller:viewcontroller]; if (self) { self.popoverbackgroundviewclass = [customuiclearpopoverbackgroundview class]; [self setpopovercontentsize:viewcontroller.view.frame.size]; } return self; }
@end
customuiclearpopoverbackgroundview.h
@interface customuiclearpopoverbackgroundview : uipopoverbackgroundview
customuiclearpopoverbackgroundview.m
#import "customuiclearpopoverbackgroundview.h" @implementation customuiclearpopoverbackgroundview #pragma mark - no arrow + (cgfloat)arrowheight { return 0; } + (cgfloat)arrowbase { return 0; } - (cgfloat)arrowoffset { return 0; } - (void)setarrowoffset:(cgfloat)arrowoffset { } - (uipopoverarrowdirection)arrowdirection { return 0; } - (void)setarrowdirection:(uipopoverarrowdirection)arrowdirection { } #pragma mark - no margins + (uiedgeinsets)contentviewinsets { return uiedgeinsetszero; } #pragma mark - transparent (default 0.15) +(bool)wantsdefaultcontentappearance { return no; } - (void)willmovetowindow:(uiwindow *)newwindow { [super willmovetowindow:newwindow]; // hide shadow image view [self.superview.subviews[0] sethidden:yes]; } @end
i used don't much. second option create container view , hide/show like. way it's pure view controller , don't need mess popup stuff create transparency, make container view background = clear, view controller view background color = clear, , add semi-transparent button in size of view controller semi-transparent black background. on click of button close window (= same effect tapping popup background)
Comments
Post a Comment