iphone - Customizing UITableViewCell in Interface Builder -
iphone - Customizing UITableViewCell in Interface Builder -
in 2 classes, i've subclassed uitableviewcell in order major customization. i'd utilize xib file maintain amount of ui layout code minimum. i'm coming across odd exception:
if (!cell) { if (indexpath.row == 0) { cell = [[[searchcelltop alloc] initwithstyle:uitableviewcellstyledefault reuseidentifier:cellidentifier] autorelease]; nsarray* objects = [[nsbundle mainbundle] loadnibnamed:@"searchcelltop" owner:cell options:nil]; cell = (searchcelltop*)[objects objectatindex:0]; } else { cell = [[[searchcell alloc] initwithstyle:uitableviewcellstyledefault reuseidentifier:cellidentifier] autorelease]; nsarray* objects = [[nsbundle mainbundle] loadnibnamed:@"searchcell" owner:cell options:nil]; cell = (searchcell*)[objects objectatindex:0]; } }
this seems work loading xibs. seek doing such as:
if (indexpath.row < [self tableview:tableview numberofrowsinsection:indexpath.section]) ((searchcell*)cell).product = [products objectatindex:indexpath.row];
i -[uiaccessibiltybundle setproduct:] unrecognized selector sent instance
everything indicates 'cell' of right type, i'm stilling getting error.
from apple's developer documentation + (bool)loadnibnamed:(nsstring *)anibname owner:(id)owner
method:
owner
the object assign nib file's owner. if class of object has associated bundle, bundle searched specified nib file; otherwise, method looks in main bundle.
in case, owner should nil (or specific bundle, if associated).
in code, alter calls loadnibnamed method following:
nsarray* objects = [[nsbundle mainbundle] loadnibnamed:@"searchcelltop" owner:nil options:nil]; nsarray* objects = [[nsbundle mainbundle] loadnibnamed:@"searchcell" owner:nil options:nil];
iphone ios uitableview
Comments
Post a Comment