English 中文(简体)
Plist Hierarchy and All Option
原标题:

I have a string of data in a plist, which I ve got to display, hierarchically like this:

Menu>Chapter>SubChapter>item>item details

This might be super simple, in my initial menu, how would I have all All Menu item to display all the items , essentially skipping the chapter and subchapter and cutting out that aspect of my filter, while retaining the other chapter and subchapter aspects.

I could do it by doubling up the data of all items wherever I wanted them to appear, but this seemed very inefficient.

or

Would it be easier to parse data into a core data entity to do this?

问题回答

CoreData could simplify your code much, especially if you often have to add, remove or modify objects. Then you could retrieve the items in a single fetch request, which is quite efficient.

On the other hand, if you only use more or less static data, then the overhead you generate with CoreData (ManagedObjectContext, PersistentStoreCoordinator, etc.) might not pay out and you would best just after parsing the plist to create an array holding all items, like this:

NSMutableArray* allItems = [NSMutableArray array];
for (NSArray* chapter in menu) {
    for (NSArray* subchapter in chapter) {
        for (id item in subchapter) {
            [allItems addObject:item];
        }
    }
}




相关问题
Code sign Error

I have created a new iPhone application.I have two mach machines. I have created the certificate for running application in iPhone in one mac. Can I use the other mac for running the application in ...

ABPersonViewController Usage for displaying contact

Created a View based Project and added a contact to the AddressBook using ABAddressBookRef,ABRecordRef now i wanted to display the added contact ABPersonViewController is the method but how to use in ...

将音频Clips从Peter改为服务器

我不禁要问,那里是否有任何实例表明从Peit向服务器发送音响。 I m不关心电话或SIP风格的解决办法,只是一个简单的袖珍流程......

• 如何将搜查线重新定位?

我正试图把图像放在搜索条左边。 但是,问题始于这里,搜索条线不能重新布署。

热门标签