Hi,
I have XIB bundle with UITableViewCell, UITable and UIView called "MyBundle".
And I'd like to display cell loaded from XIB many times(reuse it).
So I've created in UIViewController outlet of the cell, set Identifier and tried next code:
As result it shows only one cell. But it should be shown 10 items.
I also tried next:
How to solve the problem?
Thank you.
I have XIB bundle with UITableViewCell, UITable and UIView called "MyBundle".
And I'd like to display cell loaded from XIB many times(reuse it).
So I've created in UIViewController outlet of the cell, set Identifier and tried next code:
PHP:
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
[myCell prepareForReuse];
return myCell;
}
I also tried next:
PHP:
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
UITableViewCell *cell = (UITableViewCell *)[tableView dequeueReusableCellWithIdentifier:@"CustomCellId"];
if (cell == nil) {
NSArray *nib = [[NSBundle mainBundle] loadNibNamed:@"MyBundle" owner:self options:nil];
cell = (UITableViewCell *)[nib objectAtIndex:0];
}
return cell;
}
Thank you.