iOS 7: on textfield did change the firstresponder my application is crashing

依然范特西╮ 提交于 2019-12-01 11:47:37

We had the same issue and it was because we where using "old code" to create/dequeue the custom UITableViewCells...

What we had to do was to add this lines in the ViewDidLoad

[self.myTableView registerClass:[ExpenseListCell class] forCellReuseIdentifier:@"ExpenseListCell"];
[self.myTableView registerNib:[UINib nibWithNibName:@"ExpenseListCell" bundle:nil] forCellReuseIdentifier:@"ExpenseListCell"];

and then "clean" the function cellForRowAtIndexPath to just use the dequeue function:

ExpenseListCell *cell = (ExpenseListCell *)[tableView dequeueReusableCellWithIdentifier:CellIdentifier forIndexPath:indexPath];

I suspect that, since they included storyboards, the dequeueReusableCellWithIdentifier manages the creation of the cells, so you don't need anymore this lines that we where still using after the dequeue:

if(cell == nil)
{
    cell = [[[NSBundle mainBundle] loadNibNamed:@"ExpenseListCell" owner:cell options:nil] objectAtIndex:0];
}

NOTA: We are not using storyboards

Changing this, solved our problem on iOS7.

iOSdev

May be this answer somewhat is stupid but the correct answer. I have checked for tableview cellforrowatindexpath and added an identifier

static NSString *EditableTextFieldCellIdentifier = @"EditableCell";

// using custom cells to show textfield and multiple columns
EditableTextFieldCell *cellText = [tableView dequeueReusableCellWithIdentifier:EditableTextFieldCellIdentifier];

And this fixed my problem and also crash.

Had the same issue. I fixed it by placing identifier to the table view cell's nib file. then a dequeue call at cellForRowAtIndexPath:

static NSString *fsCellIdentifier = @"configurationCell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:fsCellIdentifier];
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!