IOS Custom View Control debug notes with Xib

Source: Internet
Author: User

1. In the case of view is not very complicated, if after multiple checks still appear coding-compliant this situation, simply completely remove this xib re-create a xib to do it again. (The truth is not yet clear)

2. Approximate steps to initialize the view in Xib:

//call this method in Superview to initialize the view+ (xttopfloatingview*) instancexttopfloatingview{Nsarray*nibview = [[NSBundle mainbundle]loadnibnamed:@"Xttopfloatingview"Owner:nil Options:nil]; return[Nibview lastobject];}//methods that must be called when initializing- (ID) Initwithcoder: (Nscoder *) adecoder{ Self=[Super Initwithcoder:adecoder]; if(self) {}returnSelf ;}//You can adjust the view here, this method is optional- (void) awakefromnib{}

// The call to view in Superview is roughly as follows -(void) viewwillappear: (BOOL)    animated{//  Create floating View    xttopfloatingview *floatingview = [Xttopfloatingview Instancexttopfloatingview];    = CGRectMake (0, WIDTH (Self.view),);    [Self.view Addsubview:floatingview];    [Self.view Bringsubviewtofront:floatingview];}

3. If view needs to respond to an event and the view does not respond to an event after adding the view to Superview, you can try to add the associated code of the view's Addsubview action to the viewwillappear of Superview.

Special thanks: http://www.07net01.com/program/2016/02/1227909.html

IOS Custom View Control with Xib Debug notes

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.