Standard-UITableview Fehler gibt oder Zelle gibt null zurück

Ich bin der Gestaltung einer kundenspezifische Prototyp-Zelle mit vielen labels, Textfeldern und buttons in es.

Erstellte ich eine tableview-controller auf dem storyboard mit einem Prototyp-Zelle.Ich habe eine objective-c tableviewcontroller Klasse. Und Verband Sie. Standard-code Hinzugefügt werden, indem Sie Xcode gibt Fehler selbst.

in.h

@interface CreaatePlistTableViewController : UITableViewController<UITableViewDelegate, UITableViewDataSource>

in.m

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

        //Configure the cell...

        return cell;
    }

Fehler:

** Assertion failure in -[UITableView dequeueReusableCellWithIdentifier:forIndexPath:], /SourceCache/UIKit_Sim/UIKit-2372/UITableView.m:
*** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'unable to dequeue a cell with identifier Cell - must register a nib or a class for the identifier or connect a prototype cell in a storyboard'

Habe ich geändert, der code kann kompiliert werden, aber gibt eine leere Zelle.

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    static NSString *CellIdentifier = @"Cell";
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
    //NOTE: Add some code like this to create a new cell if there are none to reuse
    if(cell == nil)
    {
        cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier];

    }
    //Configure the cell...
    UILabel *labelMeetingDate = (UILabel *)[cell viewWithTag:11];
    labelMeetingDate.text = @"Meeting Date";

    return cell;
}

Abschnitt und Zeilen auf 1 gesetzt werden btw.

Wie kann ich das hinzufügen von Beschriftungen und Textfeldern, um Prototyp-Zelle, oder warum es Fehler gibt oder gibt null zurück?

InformationsquelleAutor Mord Fustang | 2012-11-01
Schreibe einen Kommentar