pieceofsummer / WTReTextField

Subclass of UITextField with RegEx input validation and formatting as you type
84 stars 29 forks source link

How to set text to WTReTextField? #8

Open ApesTalk opened 7 years ago

ApesTalk commented 7 years ago

Hello, I am using WTReTextField in my project. I want to call setText: method and let it show a formatted string when WTReTextField is appear, so i overrided the WTReTextField's setText: method like this:

-(void)setText:(NSString *)text

{

[super setText:text];

[self formatInput:self];

}

However, when i running on iOS7 device, it crashed with information:

Auto Layout still required after executing -layoutSubviews. WTReTextField's implementation of -layoutSubviews needs to call super.

(null)

How can i fix it? Thanks in advance. ps: I use Masonry layout.

ApesTalk commented 7 years ago

I found when i add some subView on WTReTextField and use the Masonry layout, it will crash immediately on iOS7 device. After i remove all WTReTextField's subView, it works well.