[iOS]UITableViewController 無法實現鍵盤自動適配
阿新 • • 發佈:2018-11-09
蘋果官方文件:
The UITableViewController
class implements the foregoing behavior by overriding loadView
, viewWillAppear:
, and other methods inherited from UIViewController
. In your subclass of UITableViewController
, you may also override these methods to acquire specialized behavior. If you do override these methods, be sure to invoke the superclass implementation of the method, usually as the first method call, to get the default behavior.
意思是寫UITableViewController的時候,重寫UITableViewController loadView, viewWillAppear 的時候,必須 要呼叫實現父類方法
-(void)viewWillAppear:(BOOL)animated { //不加會導致無法使用父類的一些特性 [super viewWillAppear:YES]; if(!_imgFlag&&!_emailSaveFlag&&!_phoneSaveFlag) { [self getperspnInfo]; } } - (void)viewDidLoad { [super viewDidLoad];}
如果你出現了 UITableViewController 無法自動適配鍵盤 請檢查
重寫方法時是否呼叫了父類的一些方法特性
[super viewWillAppear:YES];
[super viewDidLoad];