开发者

setting a table view that leads to data from Core Data

开发者 https://www.devze.com 2023-03-20 17:22 出处:网络
I am trying to set a table view that calls a few data from core data. For example: 1st. Table View =1. Food, 2. Places, 3. Sports开发者_运维知识库

I am trying to set a table view that calls a few data from core data. For example:

1st. Table View = 1. Food, 2. Places, 3. Sports

开发者_运维知识库
  • when i click food, it will take data from Core Data and call out for instance :-

    Food > 1.Burger, 2. Fries, 3. Chicken Chop

when i press back, it will go back to the main page which has the tree instances which are food, places and sport.

Thanks in advance.

How am i gonna link both of them?


You have to use 4 classes for this,

  1. RootViewController for 1st UITableView (Food,Place,Sports).

  2. FoodTableView Class for Food details,

  3. PlaceTableView Class for Place details,

  4. SportsTableView Class for Sports details.

In RootView TableView link those class in didSelectRowAtIndexPath method.

Eg.

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {

    if (indexPath.row == 0 ) {
        // link Food class
    }
    else if (indexPath.row == 1) {
            // link Place Class
    }
    else if (indexPath.row == 2) {
            // link Sports Class
    }
}
0

精彩评论

暂无评论...
验证码 换一张
取 消