Constraints, in iOS8 no problem, in the iOS7 crash problem, Uitextfield

Source: Internet
Author: User

With the system's Uitextfield, added the constraint, the result 8 above no problem, 7 collapsed, the information is as follows:

Assertion failure in-[uitextfield Layoutsublayersoflayer:],/sourcecache/uikit/uikit-2935.138/uiview.m:8794 2014-11-05 12:54:33.377 wattup[1722:60b] terminating app due to uncaught exception ' Nsinternalinconsistencyexception ', Reason: ' Auto Layout still required after executing-layoutsubviews. Uitextfield ' s implementation of-layoutsubviews needs to call super. '

Words do not say < solution, write the subclass inherit Uitextfield, and then rewrite the following method inside,

-(Instancetype) init
{
if (self = [super init]) {

}

return self;
}
-(void) SetText: (NSString *) text
{
[Super Settext:text];
[Self layoutifneeded];
}
-(void) Setplaceholder: (NSString *) placeholder
{
[Super Setplaceholder:placeholder];
[Self layoutifneeded];

}

-(void) layoutsubviews
{
[Super Layoutsubviews];

}

The specific reason after the analysis came out to write again,

Constraints, in iOS8 no problem, in the iOS7 crash problem, Uitextfield

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.