Eliktz
Eliktz

Reputation: 572

xcode keyboard scrolling issue with extended UITableviewController

i have encountered a strange problem: it is known that UITableView solves automatically the issue of the keyboard hides a text field. it has worked for me just fine until i extended UITableViewController to add it more functionality. to be precise - i did not inherit from UITableViewController, but extended it by creating a class UITableViewController (property). The extended properties was not by any means connected to keyboard/text field issues - but the described-above functionality was damaged after this extension and now the keyboard hides my text fields.

does anybody have an explanation for this? Moreover, if someone who has experience in extending classes can tip about sensitive areas in this process, it would be swell.

Thanks, Elik

EDIT: this is more or less my extended class code and the methods implemented:

@implementation UITableViewController (Property)

-(void) viewDidLoad
{
    /* perform custom code */
    [super viewDidLoad];
}

-(void)commonloadProperty{
    /* custom code */
}
-(void) viewDidUnload
{
    /* custom code */   
    [super viewDidUnload];
}
-(void)viewWillAppear:(BOOL)animated
{
    [super viewWillAppear:animated];        
}    
-(void)propertyHandlingStarted
{   
    /* custom code */   
}
-(void)propertyHandlingCanceled
{
    /* custom code */
}    
-(void)propertyHandlingActionsClicked
{
    /* custom code */
}

Upvotes: 0

Views: 141

Answers (1)

Kevin
Kevin

Reputation: 56159

Don't override methods using a category.

The particular issue with doing that that you're running into here is that your super calls don't call the corresponding method in the main UITableViewController class, they call the methods in the UIViewController class. Since the methods you overrode don't appear to directly affect what might be called for the keyboard, my guess is that they set up the proper listeners that do. Because you're blocking the method that sets up the keyboard listeners (OP says this appears to be viewWillAppear), the table can't detect when the keyboard is set up and scroll appropriately.

Create and use a proper subclass.

Upvotes: 3

Related Questions