Use of presentation controllers (ii) by Wusheying
Model Past:
-(Ibaction) show: (ID) Sender { Secondviewcontroller *overlay = [[Secondviewcontroller alloc] initwithcountry]; [Self presentviewcontroller:overlay animated:yes completion:nil];}
Secondviewcontroller.m
-(Instancetype) Initcontentview {self = [super init]; if (self) {[self setmodalpresentationstyle:uimodalpresentationcustom]; Self.view.backgroundColor = [Uicolor Clearcolor]; Self.contentcontainerview = [[UIView alloc] Initwithframe:cgrectmake (20, 200, 280, 200)]; Self.contentContainerView.backgroundColor = [Uicolor colorwithwhite:0.0 alpha:0.8]; Self.contentContainerView.layer.cornerRadius = 5.0; [Self.view AddSubview:self.contentContainerView]; Self.closebutton = [UIButton Buttonwithtype:uibuttontypesystem]; Self.closeButton.frame = CGRectMake (30, 30, 100, 100); Self.closeButton.tintColor = [Uicolor Whitecolor]; Self.closeButton.titleLabel.font = [Uifont systemfontofsize:13]; [Self.closebutton settitle:@ "Close" forstate:uicontrolstatenormal]; [Self.closebutton addtarget:self Action: @selector (closebuttonpressed:) forControlEvents: UIControlEventTouchUpInside]; [Self.contentcontaineRview AddSubview:self.closeButton]; } return self;} -(void) closebuttonpressed: (UIButton *) Sender {[Self.presentingviewcontroller dismissviewcontrolleranimated:yes Completion:nil];}
Use of presentation controllers (ii)