1. Masking issues with view interactions
(1) The following code snippet shows the view hierarchy is placed on the Self.view _launchscrollview, and _launchscrollview placed 4 Launchimageview used for the Welcome interface to do the application of first-use introduction, Furthermore, the last 1 Launchimageview are placed in the middle of comeinbtn.
(2) The Comeinbtnclick event is now triggered, and it is not feasible by default (userinteractionenabled default is no)
(3) Analysis: The interaction defaults to No, which masks all click events and gestures from the Launchimageview, so you must open
1- (void) Viewdidload2 {3 [Super Viewdidload];4 //Do any additional setup after loading the view.5 6Nsinteger Imagecount =4;7_launchscrollview = [[Uiscrollview alloc]initwithframe:cgrectmake (0.0,0.0, Hbscreenwidth, Hbscreenheight)];8_launchscrollview.bounces =NO;9_launchscrollview.pagingenabled =YES;Ten_launchscrollview.showshorizontalscrollindicator =NO; One_launchscrollview.contentoffset = Cgpointmake (0.0,0.0); A_launchscrollview.contentsize = Cgsizemake (Hbscreenwidth * Imagecount,0); - - //Import Pictures the for(Nsinteger i =0; i < Imagecount; i++) { -Uiimageview *launchimageview = [[Uiimageview alloc]initwithframe:cgrectmake (Hbscreenwidth * I,0.0, Hbscreenwidth, Hbscreenheight)]; -UIImage *image = [UIImage imagenamed:[nsstring stringWithFormat:@"start_h%d", i +1]]; -image = [Image Resizableimagewithcapinsets:uiedgeinsetsmake (0.0,0.0,0.0,0.0) Resizingmode:uiimageresizingmodestretch]; +Launchimageview.image =image; - + //The interaction here defaults to No, which masks all click events and gestures from the Launchimageview, so you must open A launchimageview.userinteractionenabled = YES; at - if(i = =3) { -UIButton *comeinbtn =[UIButton Buttonwithtype:uibuttontypecustom]; -Comeinbtn.frame = CGRectMake (Hbscreenwidth *0.42, Hbscreenheight *0.6, Hbscreenwidth *0.17, Hbscreenheight *0.08); -Comeinbtn.backgroundcolor = [Uicolor colorwithred:197/255.0Green233/255.0Blue -/255.0Alpha1.0]; -ComeinBtn.layer.borderWidth =1.0; inComeinBtn.titleLabel.font = [Uifont fontwithname:nil size:15.0]; -[Comeinbtn Settitle:@"Click to enter"Forstate:uicontrolstatenormal]; to [comeinbtn Settitlecolor:[uicolor Blackcolor] forstate:uicontrolstatenormal]; + [comeinbtn addtarget:self Action: @selector (Comeinbtnclick) forcontrolevents:uicontroleventtouchupinside];< /c3> - [Launchimageview addsubview:comeinbtn]; the } * [_launchscrollview Addsubview:launchimageview]; $ }Panax Notoginseng [Self.view Addsubview:_launchscrollview]; -}
iOS mobile App development Piecemeal detail essays