0

I'm trying to initialize a tableview with an image, name and surname of each user that I have stored in a NSMutableArray. In this mutablearray I save a class that I created to store users data and its schema is as follows:

ResultSearchController{
  NSInteger *userID;
  NSString *userName;
  NSString *userSurname;
  NSString *userThumb;
}

I have read the documentation of TableView but I still have doubts and problems to display the data in TableView (seems rather complicated to use such objects). Could you help me to get started with this? Thanks!!

6
  • write some code of cellForRowAtIndexPath... Commented May 24, 2012 at 7:52
  • 1
    Agreed. You need to look at the delegate and datasource methods. This allows you to modify each cell in turn. If you use the row of the cell as the index for you NSMutableArray, then write modification code. it should modify each cell as the table view requires it. Commented May 24, 2012 at 7:55
  • 3
    Please see this and this and this and this and this Commented May 24, 2012 at 7:59
  • My major problem is that my English is not very good and I have problems understanding. Thanks again! Commented May 24, 2012 at 8:11
  • Use google Translate then .... Commented May 24, 2012 at 8:25

1 Answer 1

4

I guess you have a Custom UITableViewCell for that.

Simply use in cellForRowAtIndexPath delegate of UITableView (to set the image):-

yourCustomCellObject.yourImageViewINCustCell.image=[UIImage imageNamed:[(yourClassToStoreData *)[yourNSMutableArray objectAtIndex:indexPath.row] userThumb]];

Similarly you can do in the same manner to set other control elements.

It's just an example of how you can do.I am assuming you have stored the data over some class objects and adding it to an NSMtableArray.

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.