开发者

UIViewController with textField and tableView

开发者 https://www.devze.com 2023-03-24 23:18 出处:网络
I have the following problem: I got a UIViewController and it contains a textfield and a tableview. I push the view from another one, so that I got a navigationbar on top. I enabled the edit-button,

I have the following problem:

I got a UIViewController and it contains a textfield and a tableview. I push the view from another one, so that I got a navigationbar on top. I enabled the edit-button, and navigation also works fine. What my problem is: -the edit button is not working. I was looking through here, but I couldn't get it fixed -when I enter data in to the textfield, the tableview gets the data, reloading is working, but it doesn't show any animation, and no rows are added ...

-(BOOL)textFieldShouldReturn:(UITextField *)textField{
[controller insertCostumer:textField.text];

[textField resignFirstResponder];
[tabViewitem reloadData];

NSIndexPath *indexPath = [NSIndexPath indexPathForRow:controller.sizeOfNavi+1 inSection:1];
NSMutableArray *arr = [[NSMutableArray alloc]init];
[arr addObject:indexPath];

[tabViewitem insertRowsAtIndexPaths:arr withRowAnimation:UITableViewRowAnimationTop];
return YES;

}

This is my textfieldshouldreturn method, I also tried out textfieldshouldended开发者_如何学编程iting and textfielddidendediting and so on :-) Hope somebody has any clue how to do it.


I have no direct solution but I think I found a useful link for you: http://www.iphonedevsdk.com/forum/iphone-sdk-development/11315-textfieldshouldreturn-not-called-probrem.html

This person has some problems to while calling the 'textFieldShouldReturn' method.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号