iOS HELP! tableView:accessoryTypeForRowWithIndexPath

lJoct03

macrumors member
Original poster
Nov 18, 2009
31
0
WARNING: Using legacy cell layout due to delegate implementation of tableView:accessoryTypeForRowWithIndexPath: in <RootViewController: 0x685f100>. Please remove your implementation of this method and set the cell properties accessoryType and/or editingAccessoryType to move to the new cell layout behavior. This method will no longer be called in a future release.
Code:
- (UITableViewCellAccessoryType)tableView:(UITableView *)tv accessoryTypeForRowWithIndexPath:(NSIndexPath *)indexPath
{
    //return UITableViewCellAccessoryDetailDisclosureButton;
    //return UITableViewCellAccessoryDisclosureIndicator;
    return UITableViewCellAccessoryNone;
}
How do i do this?
Any help would be greatly appreciated.
 

PhoneyDeveloper

macrumors 68040
Sep 2, 2008
3,114
93
Set the property on the cell in your cellForRowAtIndexPath method and remove the old method that it doesn't like.

Code:
cell.accessoryType = UITableViewCellAccessoryNone;
 

lJoct03

macrumors member
Original poster
Nov 18, 2009
31
0
Here's my cellForRowAtIndexPath. Where do i remove the old method that it doesn't like? And what is the old method that it doesn't like? Thanks for the help.

Code:
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
    
    static NSString *CellIdentifier = @"Cell";
    
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
    if (cell == nil) {
       cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease];
    }
    
    // Set up the cell...
    if(searching) 
        cell.textLabel.text = [copyListOfItems objectAtIndex:indexPath.row];
    else {
    //First get the dictionary object
	NSDictionary *dictionary = [listOfItems objectAtIndex:indexPath.section];
    NSArray *array = [dictionary objectForKey:@"News"];
    NSString *cellValue = [array objectAtIndex:indexPath.row];
    cell.textLabel.text = cellValue;
    }
    return cell;
}
 

PhoneyDeveloper

macrumors 68040
Sep 2, 2008
3,114
93
This is the method that has been deprecated:

tableView:accessoryTypeForRowWithIndexPath: in <RootViewController: 0x685f100>

If you want none of the cells to be selectable then add the code I showed like this:

Code:
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
    
    static NSString *CellIdentifier = @"Cell";
    
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
    if (cell == nil) {
       cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease];
cell.accessoryType = UITableViewCellAccessoryNone;
    }
    
    // Set up the cell...
    if(searching) 
        cell.textLabel.text = [copyListOfItems objectAtIndex:indexPath.row];
    else {
    //First get the dictionary object
	NSDictionary *dictionary =[listOfItems objectAtIndex:indexPath.section];
    NSArray *array = [dictionary objectForKey:@"News"];
    NSString *cellValue = [array objectAtIndex:indexPath.row];
    cell.textLabel.text = cellValue;
    }
    return cell;
}
 

Similar threads

Register on MacRumors! This sidebar will go away, and you'll see fewer ads.