Q:

custome UITableview calling methods to store value in cell in iphone

I am using custom UITableview concept to show data in cell of tableview. My custome uiTableview name is CustomeUITableView.h,CustomeUITableView.m and CustomeUITableView.xib file. This file is consisting following code.
//header file code

@interface CustomTableCellview : UITableViewCell {

UILabel *titleOfPost;
IBOutlet  UILabel *userProfileName;
}

@property(nonatomic,retain) IBOutlet UILabel *titleOfPost;

- (void)setTileOfPost:(NSString *)_text;
- (void)setUserName:(NSString *)_text;
@end

// some important part of class file code

- (void)setTileOfPost:(NSString *)_text{
titleOfPost.text = _text;
 }

- (void)setUserName:(NSString *)_text{

userProfileName.text = _text;

 }

// TableView code where cell is creating and function of cutome UITableview is calling

    static NSString *MyIdentifier = @"MyIdentifier";
MyIdentifier = @"tblCellView";

   CustomTableCellview *cell = (CustomTableCellview *)[tableView  dequeueReusableCellWithIdentifier:MyIdentifier];
  if(cell == nil) {
    [[NSBundle mainBundle] loadNibNamed:@"CustomTableCellview" owner:self options:nil];
    cell = tblCell; //IBOutlet CustomTableCellview *tblCell;

 }

[cell setTileOfPost:[tableList objectAtIndex:indexPath.row]];

[cell setUserName:[profileUserName objectAtIndex:indexPath.row]];

 return cell;    

This is calling well and my output is displaying data fine. But here is a bit mistake. I am calling function "setTileOfPost" and "setUserName" in each CELL load. This is making large function calling. I want to fetch all title of text in one call of function. I don't want to use calling function again and again. I stored value in "tableList" and this is extern array defined in main.m file so I can use this array anywhere in application.
How to grab all value in single function call?
Thanks in advance

A:

tableList and profileUserName  are of type NSArray or NSMutableArray i suppose. What you can do is in your viewdidLoad method create a copy of these arrays as the data source. 
And in cellforrowatindexpath you can directly access these copies.
[cell.title setText:[tableListCopy objectAtIndex:indexPath.row]];

I hope you get the point here. You are having a local copy of the datasource of the tableview.

