开发者

TabBar + UITableView + CoreData

开发者 https://www.devze.com 2023-01-17 06:55 出处:网络
i have an application which uses CoreData/.sqlite to store my data, a tab bar and table views The data has relationship and data already setup. I have the first table view in Tab 1 working, display t

i have an application which uses CoreData/.sqlite to store my data, a tab bar and table views

The data has relationship and data already setup. I have the first table view in Tab 1 working, display the data correctly from the fetched results. But I am stuck on the drill down view. Would be great if someone could enlighten me.

Do I setup another fetched results controller in the 2nd view controller? Or ?

Application Structure

Tab 1

1st view > Plain Table View Cell > Data from FetchedResultsController

2nd view > Table vie开发者_高级运维w with Custom Table View Cell (customviewcell.h/.m) (Drill down data from previous view selected item)

3rd view > DetailView

Tab 2

Structure same as above, only source are from the internet.

Thank you~


ok, my data model is like this

# Districts (plain table list)

## List of school in the selected district (with other info and UIimage /custom table cell)

### Details of the school with 2-3 sectioned table with info.

I can get the plain district list to display correctly, but I can;t implement the school table view list right. Would be great if you could provide me with some brief code example.

Million thanks~


Let me try to answer you.

If you have a structure like this:

-- object1 --
var1
var2
rel1 -> Relationship to object2

-- object2 --
rel1_rev -> Reverse relationship of rel1
var1
rel2 -> Relationship to object3

-- object 3 --
rel2_rev => Reverse relationship to object 2
detail_var

You could avoid to use a fetched results on second view... if you need to display in the second view the data from rel1 you simple have to call object1.rel1 and you will have all entries for that relationship... and for the detail view, you could simple call object2.rel2 to have the details of that object.

Of course, this example, works only if you have correctly designed you CoreData Model, or it will never work.

With your info a better answer is really hard to give, if you need more infos, please provide us a much real situation.

Cheers

0

精彩评论

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