Custom control appears [Super Initwithcoder:adecoder] crash problem resolution

Source: Internet
Author: User

Today, try AutoLayout and Storyboard/xib to do the UI, use or feel pretty handy, no longer worry about writing cumbersome UI code. Therefore, we also intend to use Xib to implement the custom control (UIView subclass), but in a small example of the process encountered a crash problem, the location of the crash occurs in [Super Initwithcoder:adecoder].

Looking at the call stack at the time of the crash, there are many initwithcoder: functions that feel like an infinite loop recursive call. Based on the answer to this article, it was discovered that you set the custom class of the view in Xib to Childview (the name of the custom control, inherited from UIView).

In fact, you only need to set the file's owner in Xib to Childview.


To implement a custom control with Xib, and to nest Xib in Xib, you can see this tutorial: IOS Interface Builder: Load another. xib file in the. xib file


Custom control appears [Super Initwithcoder:adecoder] crash problem resolution

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.