Xcode--xib

Source: Internet
Author: User

UIView *oneview = name[0];//2. Add to view inside the controller[Self.view Addsubview:greenview];//similarities and differences of 3.storyboard and Xib    1>difference*Storyboard: Description software interface, large-scale, heavyweight, more suitable for describing the software of all the interface*xib: Description Software interface, small-scale, lightweight, more suitable for describing a small interface2>the same point: the essence is the conversion code//4.xib explanationNsarray*array = [NSBundle mainbundle] loadnibnamed:@"MyView"Owner:_name Options:nil];-(Nsarray *) loadnibnamed: (NSString *) name owner: (ID) Owner options: (Nsdictionary *) options{//parsing myview.xib Files//CREATE VIEWUIView *blue =[[UIView alloc] init]; Blue.backgroudcolor=[Uicolor Bluecolor]; //.... Set other properties//Create buttonUIButton *btn =[UIButton Buttonwithtype:uibuttontyperoundedrect]; [BTN Settitle:@"I'm the button ."Forstate:uicontrolstatenormal];    [Btn Addtarget:owner Action: @selector (Btnclick) forevent:uicontroleventtouchupinside]; //... Set other properties[Blue addsubview:btn]; //Create a text input boxUitextfield *field =[[Uitextfield alloc] init]; //Set other properties    return@[blue, field];}5. File'use steps for s owner    1> Setting file in the Xib.'the class attribute of S owner (the purpose is to find the owner's method in Xib)    2> Create File'the link between S Owner and the control    3> Use code to load Xib, pass Owener parameters (type must match)

Xcode--xib

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.