Legolas
Legolas

Reputation: 12335

UITableViewController warnings - Help !

So, I am posting my code below.

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath     // I get a warning here Incomplete method implementation //
{
    static NSString *CellIdentifier = @"Cell";

    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
    if (cell == nil) {
        cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease];
    }

    // Configure the cell...
    NSLog (@"Dobby4");
    NSInteger row = [indexPath row];
    cell.text = [dogArray objectAtIndex:row];

    //I get a warning for the line above-- 'text' is deprecated //
    return cell;
}

So,
1. I get a warning - incomplete method implementation for that function.
2. I get another warning 'text' is deprecated'
3. I tried debugging and tried to print a line "Dobby4" - and it DID NOT print.

I would appreciate some help.

Upvotes: 0

Views: 131

Answers (2)

Deepak Danduprolu
Deepak Danduprolu

Reputation: 44633

  1. I doubt it is do with this function. Probably the method before. It would be good if you put that in the code listing too.
  2. You shouldn't be using the text property to set the text (it is as the warning says, deprecated). Use the textLabel which is a subview of cell. So that line will be cell.textLabel.text = [dogArray objectAtIndex:row];.
  3. Since it is not printing Dobby4, either your numberOfSectionsInTableView: or tableView:numberOfRowsInSection: is returning 0. If this is not so, then you haven't connected your datasource properly.

Upvotes: 2

Luke
Luke

Reputation: 11476

1) The compiler could be moaning as the method implementation may not be present in your header file or vice versa?

2) the .text property of a UITableViewCell is indeed deprecated since iOS 3.0 so you will not be able to use it, seeing as you are definitely targeting a higher iOS version.

3) Perhaps linked to 1).

Hope this was of some help, keep us posted!

Upvotes: 0

Related Questions