cellForRowAtIndexPath memory management

前端 未结 5 2080
终归单人心
终归单人心 2020-12-10 22:41

So, here\'s the code for my cellForRowAtIndexPath:

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
          


        
5条回答
  •  暗喜
    暗喜 (楼主)
    2020-12-10 23:00

    Try setting a static string and use that in the methods below:

        static NSString *identifier = @"identifier";
        UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:identifier];
    if (cell == nil) {
        cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:identifier]autorelease];
    

提交回复
热议问题