簡體   English   中英

永遠不會調用UITextField drawTextInRect

[英]UITextField drawTextInRect is never called

我已經安裝了iOS11 beta5,並遇到了一些問題。 我為我的自定義UITextField重寫了drawTextInRect方法,但從未調用過它。

注意:是的,我已經看到了這個答案,但是在10.3上效果很好。

代碼示例以重現該行為:

#import <UIKit/UIKit.h>  

@interface MYCustomTextField : UITextField  

@end  

@implementation MYCustomTextField  

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

@end  

我還在Apple開發人員論壇上創建了一個新線程

drawTextInRect永遠不會調用UITextField。 您必須為此使用UILabel。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM