[iOS]UITableViewController 无法实现键盘自动适配

苹果官方文档:

The UITableViewController class implements the foregoing behavior by overriding loadViewviewWillAppear:, 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];



猜你喜欢

转载自blog.csdn.net/w250130255/article/details/47611861