Dlaczego tableView dequeueReusableCellWithIdentifier: CellIdentifier zwraca wartość null?

Używam XCode 4.2 do zbudowania aplikacji na iPhone'a.

Nie wiem dlaczego to stwierdzenieUITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier]; jest czasami zerowe, a nie inne. Zamierzam podać dwa scenariusze: pierwszy, w którym komórka nie ma wartości null, a drugi, w którym null. Zacznę od przykładowego kodu udostępnionego przez oba scenariusze z mojej WSCSessionTable, która dziedziczy UITableViewController:

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    static NSString *CellIdentifier = @"Cell";

    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];

    if (cell == nil) {
     // we have null
    }
return cell;
}

Scenariusz 1 - komórka nie ma wartości NULL

Komórka nie jest pusta i wszystko działa dobrze, gdy ustawiam moją scenorys tak

Scenariusz 2 - komórka ma wartość NULL

Komórka jest zawsze pusta, gdy ustawiam moją scenorys tak:

To jest obsługa zdarzeń dla przycisku, który tworzy instancję tabeli.

- (IBAction)goToSession:(id)sender
{
    wscAppDelegate *appDelegate = (wscAppDelegate *)[[UIApplication sharedApplication] delegate];
    UIStoryboard * storyboard = [UIStoryboard storyboardWithName:@"MainStoryboard_iPhone" bundle:[NSBundle mainBundle]];
    wscSessions *childView = [storyboard instantiateViewControllerWithIdentifier:@"sessionstable"];
//    wscSessions *childView = [storyboard instantiateViewControllerWithIdentifier:@"sessionstable"];
    childView._arrData = appDelegate._arrSession;
    childView._arrSpeaker = appDelegate._arrSpeaker;
    childView.title = @"SEssions";
    [self.navigationController pushViewController:childView animated:YES]; 
    }

Czy ktoś wie, dlaczego komórka jest zawsze null w scenariuszu 2? To powoduje problemy w innym miejscu mojego kodu.

Dodatkowe informacje Dwie osoby, które komentuję, powiedziały mi, że należy ustawić identyfikator komórki na „komórka”. Oto zrzut ekranu ... czy to prawda? Tak jest w scenariuszu 1 i scenariuszu 2.

questionAnswers(0)

yourAnswerToTheQuestion