2012年5月18日 星期五

解決辦法 could not locate an NSManagedObjectModel for entity name

http://stackoverflow.com/questions/1632497/core-data-iphone-could-not-locate-an-nsmanagedobjectmodel

解決使用 Core Data 時,所遇到 could not locate an NSManagedObjectModel for entity name 問題。



做了這個範例後 http://www.raywenderlich.com/934/core-data-on-ios-5-tutorial-getting-started

所遇到的

解法如下:
使用 context 之前判斷。


if (managedObjectContext == nil) { 
        managedObjectContext = [(YourAppDelegate *)[[UIApplication sharedApplication] delegate] managedObjectContext]; 
        NSLog(@"After managedObjectContext: %@",  managedObjectContext);
}




Flipboard like 翻頁特效

http://www.iphonedevsdk.com/forum/iphone-sdk-development/68240-flipboard-how-does-work.html

http://www.iphonedevsdk.com/forum/ip...animation.html

https://github.com/brow/leaves

really cool to read:
Implementing 2D Page Flip effect on iPhone OS | NOMTEK

Page Flip - iPhone Development Wiki

2012年5月15日 星期二

CSV 轉換成 plist (Property List) 檔

http://stackoverflow.com/questions/1546007/convert-excel-document-xls-to-a-plist

下載 Plist Converter1.0

或是 使用 cCSVParse 這個 lib

套用底下程式碼


 CSVParser *parser = [CSVParser new];
[parser openFileWithPath:pathAsString];
NSMutableArray *csvContent = [parser parseFile];
[parser closeFile];
if (pathAsString != nil)
{

        NSArray *keyArray = [csvContent objectAtIndex:0];

        NSMutableArray *plistOutputArray = [NSMutableArray array];

        NSInteger i = 0;

        for (NSArray *array in csvContent)
        {



                NSMutableDictionary *dictionary = [NSMutableDictionary dictionary];

                NSInteger keyNumber = 0;

                for (NSString *string in array)
                {

                        [dictionary setObject:string forKey:[keyArray objectAtIndex:keyNumber]];

                        keyNumber++;

                }

                if (i > 0)
                {
                        [plistOutputArray addObject:dictionary];
                }

                i++;

        }

        NSMutableString *mutableString = [NSMutableString stringWithString:pathAsString];
        [mutableString replaceOccurrencesOfString:@".csv" withString:@".plist" options:nil range:NSMakeRange([mutableString length]-4, 4)];

        NSURL *url = [NSURL fileURLWithPath:mutableString];


        [plistOutputArray writeToURL:url atomically:YES];