2013-06-23 37 views
0

我遇到了一個奇怪的問題: 據瞭解,UITableView自動解決鍵盤隱藏文本字段的問題。 它爲我工作,直到我擴展UITableViewController添加更多的功能。準確地說,我沒有從UITableViewController繼承,但是通過創建一個類UITableViewController(property)來擴展它。 擴展屬性不是通過任何方式連接到鍵盤/文本字段問題 - 但上述功能在此擴展之後已損壞,現在鍵盤隱藏了我的文本字段。Xcode鍵盤滾動問題與擴展UITableviewController

有沒有人對此有過解釋? 此外,如果有延長課程經驗的人可以在這個過程中對敏感區域進行小費,那麼它會膨脹。

感謝,Elik

編輯: 這或多或少我的擴展類代碼和方法來實現:

@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 */ 
} 
+1

你能提一下你做了什麼擴展嗎? – Adithya

回答

3

Don't override methods using a category

在這裏遇到的問題是您的super調用不會調用主類UITableViewController中的相應方法,它們調用UIViewController類中的方法。由於您所覆蓋的方法似乎並不直接影響可能要求鍵盤的內容,我的猜測是他們設置了適當的偵聽器。由於您阻止了設置鍵盤監聽器的方法(OP說這看起來像是viewWillAppear),所以表格無法檢測到鍵盤設置和適當滾動的時間。

創建並使用適當的子類。

+0

明白了,我現在明白了。非常感謝! – Eliktz