iOS mobile App development Piecemeal detail essays

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.