UITextField drawTextInRect is never called

666 views Asked by At

I've install iOS11 beta5 and catch some problems. I override drawTextInRect method for my custom UITextField, but it is never called.

Note: yes, i've already seen this answer, but it is works fine on 10.3.

Code sample to reproduce that behavior:

#import <UIKit/UIKit.h>  

@interface MYCustomTextField : UITextField  

@end  

@implementation MYCustomTextField  

-(void)drawTextInRect:(CGRect)rect {  
  [super drawTextInRect:rect];  
  NSLog(@"drawTextInRect calling");  
}  

@end  

I've also created a new thread on Apple's developer forum.

1

There are 1 answers

3
swapnil patel On

drawTextInRect will never called for UITextField. You have to use UILabel for that.