I HAVE READ apple documentation and it's not understandable for such a beginner in
-(UITableViewCell *)tableView:(UITableView *)tableView
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
1) The function returns a cell for a table view yes? So, the returned object is of type
UITableViewCell. These are the objects that you see in the table's rows. This function basically returns a cell, for a table view.
But you might ask, how the function would know what cell to return for what row, which is answered in the 2nd question
NSIndexPath is essentially two things-
Because your table might be divided to many sections and each with its own rows, this
NSIndexPath will help you identify precisely which section and which row. They are both integers. If you're a beginner, I would say try with just one section.
It is called if you implement the
UITableViewDataSource protocol in your view controller. A simpler way would be to add a
UITableViewController class. I strongly recommend this because it Apple has some code written for you to easily implement the functions that can describe a table. Anyway, if you choose to implement this protocol yourself, you need to create a
UITableViewCell object and return it for whatever row. Have a look at its class reference to understand re-usablity because the cells that are displayed in the table view are reused again and again(this is a very efficient design btw).
As for when you have two table views, look at the method. The table view is passed to it, so you should not have a problem with respect to that.