Xcode xib loading, attention points

Source: Internet
Author: User
Load Xib2 in mode

Nsarray *array = [[NSBundle mainbundle] loadnibnamed:@ "xib name" Owner:nil Options:nil];

uinib *nib = [uinib nibwithnibname:@ "xib name" Bundle:nil]; Nil default is Mainbundle

Nsarray *array = [nib Instantitewithower:nil object:nil];

Attention points for the use of Xib

If you are creating a control through code, you must call initWithFrame when initializing

If a control is created through Xib or storyboard, initWithFrame is not called when initialized, and Initwithcoder is called

If the control is created through Xib or storyboard, the Awakefromnib method is called when the initialization is complete.

It is recommended to initialize in awakefromnib.

Layoutsubviews the frame that sets the child control can also be initialized

Set the child control's frame in the Layoutsubviews method (Layoutsubviews Be sure to call [Super Layoutsubviews])

Xcode xib loading, attention points

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.