├── README ├── .DS_Store ├── TextCoreData ├── en.lproj │ ├── InfoPlist.strings │ └── MainWindow.xib ├── .DS_Store ├── TextCoreData.xcdatamodeld │ ├── .xccurrentversion │ └── TextCoreData.xcdatamodel │ │ └── contents ├── Relation.m ├── main.m ├── TextCoreData-Prefix.pch ├── Relation.h ├── RootViewController.h ├── TextCoreDataAppDelegate.h ├── RelationViewController.h ├── TextCoreData-Info.plist ├── RelationViewController.m ├── RootViewController.xib ├── TextCoreDataAppDelegate.m ├── RootViewController.m └── RelationViewController.xib ├── .gitignore └── TextCoreData.xcodeproj ├── project.xcworkspace └── contents.xcworkspacedata └── project.pbxproj /README: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/samplecode/TextCoreData/master/.DS_Store -------------------------------------------------------------------------------- /TextCoreData/en.lproj/InfoPlist.strings: -------------------------------------------------------------------------------- 1 | /* Localized versions of Info.plist keys */ 2 | 3 | -------------------------------------------------------------------------------- /TextCoreData/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/samplecode/TextCoreData/master/TextCoreData/.DS_Store -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | _Store 2 | *.swp 3 | *~.nib 4 | build/ 5 | *.pbxuser 6 | *.perspective 7 | *.perspectivev3 8 | xcuserdata 9 | -------------------------------------------------------------------------------- /TextCoreData.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /TextCoreData/TextCoreData.xcdatamodeld/.xccurrentversion: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | _XCCurrentVersionName 6 | TextCoreData.xcdatamodel 7 | 8 | 9 | -------------------------------------------------------------------------------- /TextCoreData/Relation.m: -------------------------------------------------------------------------------- 1 | // 2 | // Relation.m 3 | // TextCoreData 4 | // 5 | // Created by xiaosong on 11-9-14. 6 | // Copyright (c) 2011年 __MyCompanyName__. All rights reserved. 7 | // 8 | 9 | #import "Relation.h" 10 | 11 | 12 | @implementation Relation 13 | @dynamic INFO1; 14 | @dynamic INFO4; 15 | @dynamic INFO3; 16 | @dynamic INFO2; 17 | 18 | @end 19 | -------------------------------------------------------------------------------- /TextCoreData/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // TextCoreData 4 | // 5 | // Created by xiaosong on 11-9-13. 6 | // Copyright 2011年 __MyCompanyName__. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | int main(int argc, char *argv[]) 12 | { 13 | NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; 14 | int retVal = UIApplicationMain(argc, argv, nil, nil); 15 | [pool release]; 16 | return retVal; 17 | } 18 | -------------------------------------------------------------------------------- /TextCoreData/TextCoreData-Prefix.pch: -------------------------------------------------------------------------------- 1 | // 2 | // Prefix header for all source files of the 'TextCoreData' target in the 'TextCoreData' project 3 | // 4 | 5 | #import 6 | 7 | #ifndef __IPHONE_3_0 8 | #warning "This project uses features only available in iPhone SDK 3.0 and later." 9 | #endif 10 | 11 | #ifdef __OBJC__ 12 | #import 13 | #import 14 | #import 15 | #endif 16 | -------------------------------------------------------------------------------- /TextCoreData/Relation.h: -------------------------------------------------------------------------------- 1 | // 2 | // Relation.h 3 | // TextCoreData 4 | // 5 | // Created by xiaosong on 11-9-14. 6 | // Copyright (c) 2011年 __MyCompanyName__. All rights reserved. 7 | // 8 | 9 | #import 10 | #import 11 | 12 | 13 | @interface Relation : NSManagedObject { 14 | @private 15 | } 16 | @property (nonatomic, retain) NSString * INFO1; 17 | @property (nonatomic, retain) NSString * INFO4; 18 | @property (nonatomic, retain) NSString * INFO3; 19 | @property (nonatomic, retain) NSString * INFO2; 20 | 21 | @end 22 | -------------------------------------------------------------------------------- /TextCoreData/RootViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // RootViewController.h 3 | // TextCoreData 4 | // 5 | // Created by xiaosong on 11-9-13. 6 | // Copyright 2011年 __MyCompanyName__. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "Relation.h" 11 | #import "RelationViewController.h" 12 | @interface RootViewController : UITableViewController 13 | { 14 | NSManagedObjectContext *managedObjectContext; 15 | NSMutableArray *cellsArray; 16 | int selectIndex; 17 | } 18 | @property (nonatomic, retain) NSMutableArray *cellsArray; 19 | @property (nonatomic, retain) NSManagedObjectContext *managedObjectContext; 20 | 21 | -(void)addRalation; 22 | -(NSArray*)fetchAll; 23 | @end 24 | -------------------------------------------------------------------------------- /TextCoreData/TextCoreDataAppDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // TextCoreDataAppDelegate.h 3 | // TextCoreData 4 | // 5 | // Created by xiaosong on 11-9-13. 6 | // Copyright 2011年 __MyCompanyName__. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface TextCoreDataAppDelegate : NSObject 12 | 13 | @property (nonatomic, retain) IBOutlet UIWindow *window; 14 | 15 | @property (nonatomic, retain, readonly) NSManagedObjectContext *managedObjectContext; 16 | @property (nonatomic, retain, readonly) NSManagedObjectModel *managedObjectModel; 17 | @property (nonatomic, retain, readonly) NSPersistentStoreCoordinator *persistentStoreCoordinator; 18 | 19 | - (void)saveContext; 20 | - (NSURL *)applicationDocumentsDirectory; 21 | 22 | @end 23 | -------------------------------------------------------------------------------- /TextCoreData/RelationViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // RelationViewController.h 3 | // TextCoreData 4 | // 5 | // Created by xiaosong on 11-9-13. 6 | // Copyright 2011年 __MyCompanyName__. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @protocol RelaDelegate 12 | 13 | -(void)commit:(NSArray*)array; 14 | 15 | -(void)commitChange:(NSArray*)array; 16 | @end 17 | 18 | @interface RelationViewController : UIViewController 19 | { 20 | id relaDelegate; 21 | IBOutlet UITextField *field1; 22 | IBOutlet UITextField *field2; 23 | IBOutlet UITextField *field3; 24 | IBOutlet UITextField *field4; 25 | } 26 | @property (nonatomic, assign) id relaDelegate; 27 | -(void)setData:(NSArray*)array; 28 | -(IBAction)buttonPressed:(id)sender; 29 | @end 30 | -------------------------------------------------------------------------------- /TextCoreData/TextCoreData.xcdatamodeld/TextCoreData.xcdatamodel/contents: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /TextCoreData/TextCoreData-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleDisplayName 8 | ${PRODUCT_NAME} 9 | CFBundleExecutable 10 | ${EXECUTABLE_NAME} 11 | CFBundleIconFile 12 | 13 | CFBundleIdentifier 14 | xxx.${PRODUCT_NAME:rfc1034identifier} 15 | CFBundleInfoDictionaryVersion 16 | 6.0 17 | CFBundleName 18 | ${PRODUCT_NAME} 19 | CFBundlePackageType 20 | APPL 21 | CFBundleShortVersionString 22 | 1.0 23 | CFBundleSignature 24 | ???? 25 | CFBundleVersion 26 | 1.0 27 | LSRequiresIPhoneOS 28 | 29 | NSMainNibFile 30 | MainWindow 31 | UISupportedInterfaceOrientations 32 | 33 | UIInterfaceOrientationPortrait 34 | UIInterfaceOrientationLandscapeLeft 35 | UIInterfaceOrientationLandscapeRight 36 | 37 | 38 | 39 | -------------------------------------------------------------------------------- /TextCoreData/RelationViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // RelationViewController.m 3 | // TextCoreData 4 | // 5 | // Created by xiaosong on 11-9-13. 6 | // Copyright 2011年 __MyCompanyName__. All rights reserved. 7 | // 8 | 9 | #import "RelationViewController.h" 10 | 11 | @implementation RelationViewController 12 | 13 | @synthesize relaDelegate; 14 | 15 | - (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil 16 | { 17 | self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil]; 18 | if (self) { 19 | // Custom initialization 20 | } 21 | return self; 22 | } 23 | 24 | - (void)didReceiveMemoryWarning 25 | { 26 | // Releases the view if it doesn't have a superview. 27 | [super didReceiveMemoryWarning]; 28 | 29 | // Release any cached data, images, etc that aren't in use. 30 | } 31 | 32 | #pragma mark - View lifecycle 33 | 34 | - (void)viewDidLoad 35 | { 36 | [super viewDidLoad]; 37 | // Do any additional setup after loading the view from its nib. 38 | } 39 | 40 | - (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event{ 41 | // UITextField *field1 = [self.view viewWithTag:1] 42 | [[self.view viewWithTag:1] resignFirstResponder]; 43 | [[self.view viewWithTag:2] resignFirstResponder]; 44 | [[self.view viewWithTag:3] resignFirstResponder]; 45 | [[self.view viewWithTag:4] resignFirstResponder]; 46 | } 47 | 48 | - (void)viewDidUnload 49 | { 50 | [super viewDidUnload]; 51 | // Release any retained subviews of the main view. 52 | // e.g. self.myOutlet = nil; 53 | } 54 | 55 | - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation 56 | { 57 | // Return YES for supported orientations 58 | return (interfaceOrientation == UIInterfaceOrientationPortrait); 59 | } 60 | -(void)setData:(NSArray*)array{ 61 | field1.text = [array objectAtIndex:0]; 62 | field2.text = [array objectAtIndex:1]; 63 | field3.text = [array objectAtIndex:2]; 64 | field4.text = [array objectAtIndex:3]; 65 | 66 | 67 | // field1.text = @"xxxxxx"; 68 | // NSLog(@"%@",array); 69 | } 70 | 71 | 72 | 73 | 74 | -(IBAction)buttonPressed:(id)sender{ 75 | UIButton *button = sender; 76 | 77 | 78 | if (button.tag == 5) { //新建 79 | NSString *str1 = field1.text; 80 | NSString *str2 = field2.text; 81 | NSString *str3 = field3.text; 82 | NSString *str4 = field4.text; 83 | NSArray *array = [[NSArray alloc] initWithObjects:str1,str2,str3,str4, nil]; 84 | [self.relaDelegate commit:array]; 85 | [array release]; 86 | [self.navigationController popViewControllerAnimated:YES]; 87 | }else if(button.tag == 7){ //修改 88 | NSString *str1 = field1.text; 89 | NSString *str2 = field2.text; 90 | NSString *str3 = field3.text; 91 | NSString *str4 = field4.text; 92 | NSArray *array = [[NSArray alloc] initWithObjects:str1,str2,str3,str4, nil]; 93 | [self.relaDelegate commitChange:array]; 94 | [array release]; 95 | [self.navigationController popViewControllerAnimated:YES]; 96 | } 97 | 98 | 99 | } 100 | @end 101 | -------------------------------------------------------------------------------- /TextCoreData/RootViewController.xib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 784 5 | 10B500 6 | 732 7 | 1038.2 8 | 437.00 9 | 10 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 11 | 62 12 | 13 | 14 | YES 15 | 16 | 17 | 18 | YES 19 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 20 | 21 | 22 | YES 23 | 24 | YES 25 | 26 | 27 | YES 28 | 29 | 30 | 31 | YES 32 | 33 | IBFilesOwner 34 | 35 | 36 | IBFirstResponder 37 | 38 | 39 | 40 | 274 41 | {320, 460} 42 | 43 | 44 | 3 45 | MQA 46 | 47 | NO 48 | YES 49 | NO 50 | 51 | NO 52 | 1 53 | 0 54 | YES 55 | 44 56 | 22 57 | 22 58 | 59 | 60 | 61 | 62 | YES 63 | 64 | 65 | view 66 | 67 | 68 | 69 | 5 70 | 71 | 72 | 73 | dataSource 74 | 75 | 76 | 77 | 6 78 | 79 | 80 | 81 | delegate 82 | 83 | 84 | 85 | 7 86 | 87 | 88 | 89 | 90 | YES 91 | 92 | 0 93 | 94 | 95 | 96 | 97 | 98 | -1 99 | 100 | 101 | File's Owner 102 | 103 | 104 | -2 105 | 106 | 107 | 108 | 109 | 4 110 | 111 | 112 | 113 | 114 | 115 | 116 | YES 117 | 118 | YES 119 | -1.CustomClassName 120 | -2.CustomClassName 121 | 4.IBEditorWindowLastContentRect 122 | 4.IBPluginDependency 123 | 124 | 125 | YES 126 | RootViewController 127 | UIResponder 128 | {{329, 504}, {320, 480}} 129 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 130 | 131 | 132 | 133 | YES 134 | 135 | 136 | YES 137 | 138 | 139 | 140 | 141 | YES 142 | 143 | 144 | YES 145 | 146 | 147 | 148 | 7 149 | 150 | 151 | 152 | YES 153 | 154 | RootViewController 155 | UIViewController 156 | 157 | IBProjectSource 158 | RootViewController.h 159 | 160 | 161 | 162 | 163 | 0 164 | 165 | com.apple.InterfaceBuilder.CocoaTouchPlugin.InterfaceBuilder3 166 | 167 | 168 | YES 169 | 170 | 3 171 | 3.1 172 | 173 | 174 | -------------------------------------------------------------------------------- /TextCoreData/TextCoreDataAppDelegate.m: -------------------------------------------------------------------------------- 1 | // 2 | // TextCoreDataAppDelegate.m 3 | // TextCoreData 4 | // 5 | // Created by xiaosong on 11-9-13. 6 | // Copyright 2011年 __MyCompanyName__. All rights reserved. 7 | // 8 | 9 | #import "TextCoreDataAppDelegate.h" 10 | #import "RootViewController.h" 11 | @implementation TextCoreDataAppDelegate 12 | 13 | @synthesize window = _window; 14 | @synthesize managedObjectContext = __managedObjectContext; 15 | @synthesize managedObjectModel = __managedObjectModel; 16 | @synthesize persistentStoreCoordinator = __persistentStoreCoordinator; 17 | 18 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions 19 | { 20 | 21 | NSManagedObjectContext *context = self.managedObjectContext; 22 | if (!context) { 23 | 24 | } 25 | RootViewController *root = [[RootViewController alloc] initWithNibName:@"RootViewController" bundle:nil]; 26 | root.managedObjectContext = context; 27 | UINavigationController *navi = [[UINavigationController alloc] initWithRootViewController:root]; 28 | [root release]; 29 | [self.window addSubview:navi.view]; 30 | // Override point for customization after application launch. 31 | [self.window makeKeyAndVisible]; 32 | 33 | return YES; 34 | } 35 | 36 | - (void)applicationWillResignActive:(UIApplication *)application 37 | { 38 | /* 39 | Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state. 40 | Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game. 41 | */ 42 | } 43 | 44 | - (void)applicationDidEnterBackground:(UIApplication *)application 45 | { 46 | /* 47 | Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later. 48 | If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. 49 | */ 50 | } 51 | 52 | - (void)applicationWillEnterForeground:(UIApplication *)application 53 | { 54 | /* 55 | Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background. 56 | */ 57 | } 58 | 59 | - (void)applicationDidBecomeActive:(UIApplication *)application 60 | { 61 | /* 62 | Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface. 63 | */ 64 | } 65 | 66 | - (void)applicationWillTerminate:(UIApplication *)application 67 | { 68 | // Saves changes in the application's managed object context before the application terminates. 69 | [self saveContext]; 70 | } 71 | 72 | - (void)dealloc 73 | { 74 | [_window release]; 75 | [__managedObjectContext release]; 76 | [__managedObjectModel release]; 77 | [__persistentStoreCoordinator release]; 78 | [super dealloc]; 79 | } 80 | 81 | - (void)awakeFromNib 82 | { 83 | /* 84 | Typically you should set up the Core Data stack here, usually by passing the managed object context to the first view controller. 85 | self.<#View controller#>.managedObjectContext = self.managedObjectContext; 86 | */ 87 | } 88 | 89 | - (void)saveContext 90 | { 91 | NSError *error = nil; 92 | NSManagedObjectContext *managedObjectContext = self.managedObjectContext; 93 | if (managedObjectContext != nil) 94 | { 95 | if ([managedObjectContext hasChanges] && ![managedObjectContext save:&error]) 96 | { 97 | /* 98 | Replace this implementation with code to handle the error appropriately. 99 | 100 | abort() causes the application to generate a crash log and terminate. You should not use this function in a shipping application, although it may be useful during development. If it is not possible to recover from the error, display an alert panel that instructs the user to quit the application by pressing the Home button. 101 | */ 102 | NSLog(@"Unresolved error %@, %@", error, [error userInfo]); 103 | abort(); 104 | } 105 | } 106 | } 107 | 108 | #pragma mark - Core Data stack 109 | 110 | /** 111 | Returns the managed object context for the application. 112 | If the context doesn't already exist, it is created and bound to the persistent store coordinator for the application. 113 | */ 114 | - (NSManagedObjectContext *)managedObjectContext 115 | { 116 | if (__managedObjectContext != nil) 117 | { 118 | return __managedObjectContext; 119 | } 120 | 121 | NSPersistentStoreCoordinator *coordinator = [self persistentStoreCoordinator]; 122 | if (coordinator != nil) 123 | { 124 | __managedObjectContext = [[NSManagedObjectContext alloc] init]; 125 | [__managedObjectContext setPersistentStoreCoordinator:coordinator]; 126 | } 127 | return __managedObjectContext; 128 | } 129 | 130 | /** 131 | Returns the managed object model for the application. 132 | If the model doesn't already exist, it is created from the application's model. 133 | */ 134 | - (NSManagedObjectModel *)managedObjectModel 135 | { 136 | if (__managedObjectModel != nil) 137 | { 138 | return __managedObjectModel; 139 | } 140 | NSURL *modelURL = [[NSBundle mainBundle] URLForResource:@"TextCoreData" withExtension:@"momd"]; 141 | __managedObjectModel = [[NSManagedObjectModel alloc] initWithContentsOfURL:modelURL]; 142 | return __managedObjectModel; 143 | } 144 | 145 | /** 146 | Returns the persistent store coordinator for the application. 147 | If the coordinator doesn't already exist, it is created and the application's store added to it. 148 | */ 149 | - (NSPersistentStoreCoordinator *)persistentStoreCoordinator 150 | { 151 | if (__persistentStoreCoordinator != nil) 152 | { 153 | return __persistentStoreCoordinator; 154 | } 155 | 156 | NSURL *storeURL = [[self applicationDocumentsDirectory] URLByAppendingPathComponent:@"TextCoreData.sqlite"]; 157 | 158 | NSError *error = nil; 159 | __persistentStoreCoordinator = [[NSPersistentStoreCoordinator alloc] initWithManagedObjectModel:[self managedObjectModel]]; 160 | if (![__persistentStoreCoordinator addPersistentStoreWithType:NSSQLiteStoreType configuration:nil URL:storeURL options:nil error:&error]) 161 | { 162 | /* 163 | Replace this implementation with code to handle the error appropriately. 164 | 165 | abort() causes the application to generate a crash log and terminate. You should not use this function in a shipping application, although it may be useful during development. If it is not possible to recover from the error, display an alert panel that instructs the user to quit the application by pressing the Home button. 166 | 167 | Typical reasons for an error here include: 168 | * The persistent store is not accessible; 169 | * The schema for the persistent store is incompatible with current managed object model. 170 | Check the error message to determine what the actual problem was. 171 | 172 | 173 | If the persistent store is not accessible, there is typically something wrong with the file path. Often, a file URL is pointing into the application's resources directory instead of a writeable directory. 174 | 175 | If you encounter schema incompatibility errors during development, you can reduce their frequency by: 176 | * Simply deleting the existing store: 177 | [[NSFileManager defaultManager] removeItemAtURL:storeURL error:nil] 178 | 179 | * Performing automatic lightweight migration by passing the following dictionary as the options parameter: 180 | [NSDictionary dictionaryWithObjectsAndKeys:[NSNumber numberWithBool:YES], NSMigratePersistentStoresAutomaticallyOption, [NSNumber numberWithBool:YES], NSInferMappingModelAutomaticallyOption, nil]; 181 | 182 | Lightweight migration will only work for a limited set of schema changes; consult "Core Data Model Versioning and Data Migration Programming Guide" for details. 183 | 184 | */ 185 | NSLog(@"Unresolved error %@, %@", error, [error userInfo]); 186 | abort(); 187 | } 188 | 189 | return __persistentStoreCoordinator; 190 | } 191 | 192 | #pragma mark - Application's Documents directory 193 | 194 | /** 195 | Returns the URL to the application's Documents directory. 196 | */ 197 | - (NSURL *)applicationDocumentsDirectory 198 | { 199 | return [[[NSFileManager defaultManager] URLsForDirectory:NSDocumentDirectory inDomains:NSUserDomainMask] lastObject]; 200 | } 201 | 202 | @end 203 | -------------------------------------------------------------------------------- /TextCoreData/en.lproj/MainWindow.xib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 800 5 | 10D540 6 | 760 7 | 1038.29 8 | 460.00 9 | 10 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 11 | 81 12 | 13 | 14 | YES 15 | 16 | 17 | 18 | YES 19 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 20 | 21 | 22 | YES 23 | 24 | YES 25 | 26 | 27 | YES 28 | 29 | 30 | 31 | YES 32 | 33 | IBFilesOwner 34 | IBCocoaTouchFramework 35 | 36 | 37 | IBFirstResponder 38 | IBCocoaTouchFramework 39 | 40 | 41 | IBCocoaTouchFramework 42 | 43 | 44 | 45 | 1316 46 | 47 | {320, 480} 48 | 49 | 50 | 1 51 | MSAxIDEAA 52 | 53 | NO 54 | NO 55 | 56 | IBCocoaTouchFramework 57 | YES 58 | 59 | 60 | 61 | 62 | YES 63 | 64 | 65 | delegate 66 | 67 | 68 | 69 | 4 70 | 71 | 72 | 73 | window 74 | 75 | 76 | 77 | 5 78 | 79 | 80 | 81 | 82 | YES 83 | 84 | 0 85 | 86 | 87 | 88 | 89 | 90 | 2 91 | 92 | 93 | YES 94 | 95 | 96 | 97 | 98 | -1 99 | 100 | 101 | File's Owner 102 | 103 | 104 | 3 105 | 106 | 107 | 108 | 109 | -2 110 | 111 | 112 | 113 | 114 | 115 | 116 | YES 117 | 118 | YES 119 | -1.CustomClassName 120 | -2.CustomClassName 121 | 2.IBAttributePlaceholdersKey 122 | 2.IBEditorWindowLastContentRect 123 | 2.IBPluginDependency 124 | 3.CustomClassName 125 | 3.IBPluginDependency 126 | 127 | 128 | YES 129 | UIApplication 130 | UIResponder 131 | 132 | YES 133 | 134 | 135 | YES 136 | 137 | 138 | {{198, 376}, {320, 480}} 139 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 140 | TextCoreDataAppDelegate 141 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 142 | 143 | 144 | 145 | YES 146 | 147 | 148 | YES 149 | 150 | 151 | 152 | 153 | YES 154 | 155 | 156 | YES 157 | 158 | 159 | 160 | 9 161 | 162 | 163 | 164 | YES 165 | 166 | TextCoreDataAppDelegate 167 | NSObject 168 | 169 | window 170 | UIWindow 171 | 172 | 173 | IBProjectSource 174 | TextCoreDataAppDelegate.h 175 | 176 | 177 | 178 | TextCoreDataAppDelegate 179 | NSObject 180 | 181 | IBUserSource 182 | 183 | 184 | 185 | 186 | 187 | 0 188 | IBCocoaTouchFramework 189 | 190 | com.apple.InterfaceBuilder.CocoaTouchPlugin.InterfaceBuilder3 191 | 192 | 193 | YES 194 | TextCoreData.xcodeproj 195 | 3 196 | 81 197 | 198 | 199 | -------------------------------------------------------------------------------- /TextCoreData/RootViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // RootViewController.m 3 | // TextCoreData 4 | // 5 | // Created by xiaosong on 11-9-13. 6 | // Copyright 2011年 __MyCompanyName__. All rights reserved. 7 | // 8 | 9 | #import "RootViewController.h" 10 | 11 | @implementation RootViewController 12 | @synthesize managedObjectContext,cellsArray; 13 | - (id)initWithStyle:(UITableViewStyle)style 14 | { 15 | self = [super initWithStyle:style]; 16 | if (self) { 17 | // Custom initialization 18 | } 19 | return self; 20 | } 21 | 22 | - (void)didReceiveMemoryWarning 23 | { 24 | // Releases the view if it doesn't have a superview. 25 | [super didReceiveMemoryWarning]; 26 | 27 | // Release any cached data, images, etc that aren't in use. 28 | } 29 | 30 | #pragma mark - View lifecycle 31 | 32 | - (void)viewDidLoad 33 | { 34 | [super viewDidLoad]; 35 | self.navigationItem.leftBarButtonItem = self.editButtonItem; 36 | UIBarButtonItem *addButton = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemAdd target:self action:@selector(addRalation)]; 37 | self.navigationItem.rightBarButtonItem = addButton; 38 | [addButton release]; 39 | 40 | // ----fetch----- 41 | NSFetchRequest *request = [[NSFetchRequest alloc] init]; 42 | NSEntityDescription *entity = [NSEntityDescription entityForName:@"Relation" inManagedObjectContext:managedObjectContext]; 43 | [request setEntity:entity]; 44 | NSError *error = nil; 45 | NSMutableArray *mutableResults = [[managedObjectContext executeFetchRequest:request error:&error] mutableCopy]; 46 | [self setCellsArray:mutableResults]; 47 | [mutableResults release]; 48 | [request release]; 49 | 50 | 51 | 52 | 53 | // Uncomment the following line to preserve selection between presentations. 54 | // self.clearsSelectionOnViewWillAppear = NO; 55 | 56 | // Uncomment the following line to display an Edit button in the navigation bar for this view controller. 57 | // self.navigationItem.rightBarButtonItem = self.editButtonItem; 58 | } 59 | 60 | 61 | 62 | - (void)viewDidUnload 63 | { 64 | [super viewDidUnload]; 65 | // Release any retained subviews of the main view. 66 | // e.g. self.myOutlet = nil; 67 | } 68 | 69 | - (void)viewWillAppear:(BOOL)animated 70 | { 71 | [super viewWillAppear:animated]; 72 | } 73 | 74 | - (void)viewDidAppear:(BOOL)animated 75 | { 76 | [super viewDidAppear:animated]; 77 | } 78 | 79 | - (void)viewWillDisappear:(BOOL)animated 80 | { 81 | [super viewWillDisappear:animated]; 82 | } 83 | 84 | - (void)viewDidDisappear:(BOOL)animated 85 | { 86 | [super viewDidDisappear:animated]; 87 | } 88 | 89 | - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation 90 | { 91 | // Return YES for supported orientations 92 | return (interfaceOrientation == UIInterfaceOrientationPortrait); 93 | } 94 | 95 | #pragma mark - Table view data source 96 | 97 | - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView 98 | { 99 | 100 | // Return the number of sections. 101 | return 1; 102 | } 103 | 104 | - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section 105 | { 106 | return [cellsArray count]; 107 | // Return the number of rows in the section. 108 | // return 0; 109 | } 110 | 111 | - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath 112 | { 113 | static NSString *CellIdentifier = @"Cell"; 114 | 115 | UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier]; 116 | if (cell == nil) { 117 | cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease]; 118 | 119 | } 120 | Relation *rela = (Relation*)[cellsArray objectAtIndex:indexPath.row]; 121 | cell.textLabel.text = rela.INFO1; 122 | // Configure the cell... 123 | 124 | return cell; 125 | } 126 | 127 | /* 128 | // Override to support conditional editing of the table view. 129 | - (BOOL)tableView:(UITableView *)tableView canEditRowAtIndexPath:(NSIndexPath *)indexPath 130 | { 131 | // Return NO if you do not want the specified item to be editable. 132 | return YES; 133 | } 134 | */ 135 | 136 | /* 137 | // Override to support editing the table view. 138 | - (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath 139 | { 140 | if (editingStyle == UITableViewCellEditingStyleDelete) { 141 | // Delete the row from the data source 142 | [tableView deleteRowsAtIndexPaths:[NSArray arrayWithObject:indexPath] withRowAnimation:UITableViewRowAnimationFade]; 143 | } 144 | else if (editingStyle == UITableViewCellEditingStyleInsert) { 145 | // Create a new instance of the appropriate class, insert it into the array, and add a new row to the table view 146 | } 147 | } 148 | */ 149 | 150 | /* 151 | // Override to support rearranging the table view. 152 | - (void)tableView:(UITableView *)tableView moveRowAtIndexPath:(NSIndexPath *)fromIndexPath toIndexPath:(NSIndexPath *)toIndexPath 153 | { 154 | } 155 | */ 156 | 157 | /* 158 | // Override to support conditional rearranging of the table view. 159 | - (BOOL)tableView:(UITableView *)tableView canMoveRowAtIndexPath:(NSIndexPath *)indexPath 160 | { 161 | // Return NO if you do not want the item to be re-orderable. 162 | return YES; 163 | } 164 | */ 165 | 166 | #pragma mark - Table view delegate 167 | 168 | - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath 169 | { 170 | // Navigation logic may go here. Create and push another view controller. 171 | /* 172 | <#DetailViewController#> *detailViewController = [[<#DetailViewController#> alloc] initWithNibName:@"<#Nib name#>" bundle:nil]; 173 | // ... 174 | // Pass the selected object to the new view controller. 175 | [self.navigationController pushViewController:detailViewController animated:YES]; 176 | [detailViewController release]; 177 | */ 178 | 179 | 180 | RelationViewController *rela = [[RelationViewController alloc] initWithNibName:@"RelationViewController" bundle:nil]; 181 | Relation *relaInfo = [cellsArray objectAtIndex:indexPath.row]; 182 | NSLog(@"%@",relaInfo.INFO1); 183 | selectIndex = indexPath.row; 184 | rela.relaDelegate = self; 185 | [self.navigationController pushViewController:rela animated:YES]; 186 | [rela setData:[NSArray arrayWithObjects:relaInfo.INFO1,relaInfo.INFO2,relaInfo.INFO3,relaInfo.INFO4, nil]]; 187 | [rela.view viewWithTag:5].hidden = YES; 188 | [rela release]; 189 | 190 | } 191 | 192 | - (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath{ 193 | if (editingStyle == UITableViewCellEditingStyleDelete) { 194 | NSManagedObject *objectToDelete = [cellsArray objectAtIndex:indexPath.row]; 195 | [managedObjectContext deleteObject:objectToDelete]; 196 | [cellsArray removeObjectAtIndex:indexPath.row]; 197 | [tableView deleteRowsAtIndexPaths:[NSArray arrayWithObject:indexPath] withRowAnimation:YES]; 198 | 199 | NSError *error = nil; 200 | if (![managedObjectContext save:&error]) { 201 | // 202 | } 203 | } 204 | 205 | } 206 | 207 | #pragma mark - addRalation 208 | -(void)addRalation{ 209 | RelationViewController *rela = [[RelationViewController alloc] initWithNibName:@"RelationViewController" bundle:nil]; 210 | rela.relaDelegate = self; 211 | [self.navigationController pushViewController:rela animated:YES]; 212 | [rela.view viewWithTag:7].hidden = YES; 213 | [rela release]; 214 | } 215 | 216 | -(void)commit:(NSArray*)array 217 | { 218 | Relation *relation = (Relation*)[NSEntityDescription insertNewObjectForEntityForName:@"Relation" inManagedObjectContext:managedObjectContext]; 219 | relation.INFO1 = [array objectAtIndex:0]; 220 | relation.INFO2 = [array objectAtIndex:1]; 221 | relation.INFO3 = [array objectAtIndex:2]; 222 | relation.INFO4 = [array objectAtIndex:3]; 223 | 224 | NSError *error = nil; 225 | if (![managedObjectContext save:&error]) { 226 | // 227 | } 228 | [self.cellsArray insertObject:relation atIndex:0]; 229 | [self.tableView reloadData]; 230 | [self.tableView scrollToRowAtIndexPath:[NSIndexPath indexPathForRow:0 inSection:0] atScrollPosition:UITableViewScrollPositionTop animated:YES]; 231 | } 232 | 233 | -(void)commitChange:(NSArray*)array{ 234 | //select; 235 | /* 236 | Relation *relation = (Relation*)[NSEntityDescription insertNewObjectForEntityForName:@"Relation" inManagedObjectContext:managedObjectContext]; 237 | relation.INFO1 = [array objectAtIndex:0]; 238 | relation.INFO2 = [array objectAtIndex:1]; 239 | relation.INFO3 = [array objectAtIndex:2]; 240 | relation.INFO4 = [array objectAtIndex:3]; 241 | NSError *error = nil; 242 | if (![managedObjectContext save:&error]) { 243 | // 244 | } 245 | [self.cellsArray insertObject:relation atIndex:selectIndex]; 246 | 247 | Relation *relation2 = [cellsArray objectAtIndex:selectIndex+1]; 248 | [managedObjectContext deleteObject:relation2]; 249 | [self.cellsArray removeObjectAtIndex:selectIndex+1]; 250 | 251 | 252 | [self.tableView reloadData]; 253 | */ 254 | 255 | NSFetchRequest *request = [[NSFetchRequest alloc] init]; 256 | NSEntityDescription *entity = [NSEntityDescription entityForName:@"Relation" 257 | inManagedObjectContext:managedObjectContext]; 258 | [request setEntity:entity]; 259 | NSError *error = nil; 260 | NSMutableArray *mutableResults = [[managedObjectContext executeFetchRequest:request 261 | error:&error] mutableCopy]; 262 | Relation *relation = [mutableResults objectAtIndex:selectIndex]; 263 | relation.INFO1 = [array objectAtIndex:0]; 264 | relation.INFO2 = [array objectAtIndex:1]; 265 | relation.INFO3 = [array objectAtIndex:2]; 266 | relation.INFO4 = [array objectAtIndex:3]; 267 | 268 | if (![managedObjectContext save:&error]) { 269 | // 270 | } 271 | 272 | 273 | 274 | [self setCellsArray:[self fetchAll]]; 275 | [self.tableView reloadData]; 276 | 277 | [request release]; 278 | [mutableResults release]; 279 | 280 | 281 | } 282 | 283 | -(NSArray*)fetchAll{ 284 | NSFetchRequest *request = [[NSFetchRequest alloc] init]; 285 | NSEntityDescription *entity = [NSEntityDescription entityForName:@"Relation" inManagedObjectContext:managedObjectContext]; 286 | [request setEntity:entity]; 287 | NSError *error = nil; 288 | NSMutableArray *mutableResults = [[managedObjectContext executeFetchRequest:request error:&error] mutableCopy]; 289 | [request release]; 290 | [mutableResults autorelease]; 291 | return mutableResults; 292 | } 293 | 294 | @end 295 | -------------------------------------------------------------------------------- /TextCoreData.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 5F672C76141F3EBE00AC3919 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 5F672C75141F3EBE00AC3919 /* UIKit.framework */; }; 11 | 5F672C78141F3EBE00AC3919 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 5F672C77141F3EBE00AC3919 /* Foundation.framework */; }; 12 | 5F672C7A141F3EBE00AC3919 /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 5F672C79141F3EBE00AC3919 /* CoreGraphics.framework */; }; 13 | 5F672C7C141F3EBE00AC3919 /* CoreData.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 5F672C7B141F3EBE00AC3919 /* CoreData.framework */; }; 14 | 5F672C82141F3EBE00AC3919 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 5F672C80141F3EBE00AC3919 /* InfoPlist.strings */; }; 15 | 5F672C84141F3EBE00AC3919 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 5F672C83141F3EBE00AC3919 /* main.m */; }; 16 | 5F672C88141F3EBE00AC3919 /* TextCoreDataAppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 5F672C87141F3EBE00AC3919 /* TextCoreDataAppDelegate.m */; }; 17 | 5F672C8B141F3EBE00AC3919 /* MainWindow.xib in Resources */ = {isa = PBXBuildFile; fileRef = 5F672C89141F3EBE00AC3919 /* MainWindow.xib */; }; 18 | 5F672C8E141F3EBE00AC3919 /* TextCoreData.xcdatamodeld in Sources */ = {isa = PBXBuildFile; fileRef = 5F672C8C141F3EBE00AC3919 /* TextCoreData.xcdatamodeld */; }; 19 | 5F672CA4141F414000AC3919 /* RootViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 5F672CA2141F414000AC3919 /* RootViewController.m */; }; 20 | 5F672CA5141F414000AC3919 /* RootViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 5F672CA3141F414000AC3919 /* RootViewController.xib */; }; 21 | 5F672CA9141F415600AC3919 /* RelationViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 5F672CA7141F415600AC3919 /* RelationViewController.m */; }; 22 | 5F672CAA141F415600AC3919 /* RelationViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 5F672CA8141F415600AC3919 /* RelationViewController.xib */; }; 23 | 5FAF5AB914202D3D00F9A63B /* Relation.m in Sources */ = {isa = PBXBuildFile; fileRef = 5FAF5AB814202D3D00F9A63B /* Relation.m */; }; 24 | /* End PBXBuildFile section */ 25 | 26 | /* Begin PBXFileReference section */ 27 | 5F672C71141F3EBD00AC3919 /* TextCoreData.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = TextCoreData.app; sourceTree = BUILT_PRODUCTS_DIR; }; 28 | 5F672C75141F3EBE00AC3919 /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = System/Library/Frameworks/UIKit.framework; sourceTree = SDKROOT; }; 29 | 5F672C77141F3EBE00AC3919 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; }; 30 | 5F672C79141F3EBE00AC3919 /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = System/Library/Frameworks/CoreGraphics.framework; sourceTree = SDKROOT; }; 31 | 5F672C7B141F3EBE00AC3919 /* CoreData.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreData.framework; path = System/Library/Frameworks/CoreData.framework; sourceTree = SDKROOT; }; 32 | 5F672C7F141F3EBE00AC3919 /* TextCoreData-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "TextCoreData-Info.plist"; sourceTree = ""; }; 33 | 5F672C81141F3EBE00AC3919 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = ""; }; 34 | 5F672C83141F3EBE00AC3919 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; 35 | 5F672C85141F3EBE00AC3919 /* TextCoreData-Prefix.pch */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "TextCoreData-Prefix.pch"; sourceTree = ""; }; 36 | 5F672C86141F3EBE00AC3919 /* TextCoreDataAppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = TextCoreDataAppDelegate.h; sourceTree = ""; }; 37 | 5F672C87141F3EBE00AC3919 /* TextCoreDataAppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = TextCoreDataAppDelegate.m; sourceTree = ""; }; 38 | 5F672C8A141F3EBE00AC3919 /* en */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = en; path = en.lproj/MainWindow.xib; sourceTree = ""; }; 39 | 5F672C8D141F3EBE00AC3919 /* TextCoreData.xcdatamodel */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcdatamodel; path = TextCoreData.xcdatamodel; sourceTree = ""; }; 40 | 5F672CA1141F414000AC3919 /* RootViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RootViewController.h; sourceTree = ""; }; 41 | 5F672CA2141F414000AC3919 /* RootViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RootViewController.m; sourceTree = ""; }; 42 | 5F672CA3141F414000AC3919 /* RootViewController.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = RootViewController.xib; sourceTree = ""; }; 43 | 5F672CA6141F415600AC3919 /* RelationViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RelationViewController.h; sourceTree = ""; }; 44 | 5F672CA7141F415600AC3919 /* RelationViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RelationViewController.m; sourceTree = ""; }; 45 | 5F672CA8141F415600AC3919 /* RelationViewController.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = RelationViewController.xib; sourceTree = ""; }; 46 | 5FAF5AB714202D3D00F9A63B /* Relation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Relation.h; sourceTree = ""; }; 47 | 5FAF5AB814202D3D00F9A63B /* Relation.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = Relation.m; sourceTree = ""; }; 48 | /* End PBXFileReference section */ 49 | 50 | /* Begin PBXFrameworksBuildPhase section */ 51 | 5F672C6E141F3EBD00AC3919 /* Frameworks */ = { 52 | isa = PBXFrameworksBuildPhase; 53 | buildActionMask = 2147483647; 54 | files = ( 55 | 5F672C76141F3EBE00AC3919 /* UIKit.framework in Frameworks */, 56 | 5F672C78141F3EBE00AC3919 /* Foundation.framework in Frameworks */, 57 | 5F672C7A141F3EBE00AC3919 /* CoreGraphics.framework in Frameworks */, 58 | 5F672C7C141F3EBE00AC3919 /* CoreData.framework in Frameworks */, 59 | ); 60 | runOnlyForDeploymentPostprocessing = 0; 61 | }; 62 | /* End PBXFrameworksBuildPhase section */ 63 | 64 | /* Begin PBXGroup section */ 65 | 5F672C66141F3EBD00AC3919 = { 66 | isa = PBXGroup; 67 | children = ( 68 | 5F672C7D141F3EBE00AC3919 /* TextCoreData */, 69 | 5F672C7E141F3EBE00AC3919 /* Supporting Files */, 70 | 5F672C74141F3EBD00AC3919 /* Frameworks */, 71 | 5F672C72141F3EBD00AC3919 /* Products */, 72 | ); 73 | sourceTree = ""; 74 | }; 75 | 5F672C72141F3EBD00AC3919 /* Products */ = { 76 | isa = PBXGroup; 77 | children = ( 78 | 5F672C71141F3EBD00AC3919 /* TextCoreData.app */, 79 | ); 80 | name = Products; 81 | sourceTree = ""; 82 | }; 83 | 5F672C74141F3EBD00AC3919 /* Frameworks */ = { 84 | isa = PBXGroup; 85 | children = ( 86 | 5F672C75141F3EBE00AC3919 /* UIKit.framework */, 87 | 5F672C77141F3EBE00AC3919 /* Foundation.framework */, 88 | 5F672C79141F3EBE00AC3919 /* CoreGraphics.framework */, 89 | 5F672C7B141F3EBE00AC3919 /* CoreData.framework */, 90 | ); 91 | name = Frameworks; 92 | sourceTree = ""; 93 | }; 94 | 5F672C7D141F3EBE00AC3919 /* TextCoreData */ = { 95 | isa = PBXGroup; 96 | children = ( 97 | 5F672C86141F3EBE00AC3919 /* TextCoreDataAppDelegate.h */, 98 | 5F672C87141F3EBE00AC3919 /* TextCoreDataAppDelegate.m */, 99 | 5F672C89141F3EBE00AC3919 /* MainWindow.xib */, 100 | 5F672CCA141F53CB00AC3919 /* DataBase */, 101 | 5F672CA1141F414000AC3919 /* RootViewController.h */, 102 | 5F672CA2141F414000AC3919 /* RootViewController.m */, 103 | 5F672CA3141F414000AC3919 /* RootViewController.xib */, 104 | 5F672CA6141F415600AC3919 /* RelationViewController.h */, 105 | 5F672CA7141F415600AC3919 /* RelationViewController.m */, 106 | 5F672CA8141F415600AC3919 /* RelationViewController.xib */, 107 | ); 108 | path = TextCoreData; 109 | sourceTree = ""; 110 | }; 111 | 5F672C7E141F3EBE00AC3919 /* Supporting Files */ = { 112 | isa = PBXGroup; 113 | children = ( 114 | 5F672C7F141F3EBE00AC3919 /* TextCoreData-Info.plist */, 115 | 5F672C80141F3EBE00AC3919 /* InfoPlist.strings */, 116 | 5F672C83141F3EBE00AC3919 /* main.m */, 117 | 5F672C85141F3EBE00AC3919 /* TextCoreData-Prefix.pch */, 118 | ); 119 | name = "Supporting Files"; 120 | path = TextCoreData; 121 | sourceTree = ""; 122 | }; 123 | 5F672CCA141F53CB00AC3919 /* DataBase */ = { 124 | isa = PBXGroup; 125 | children = ( 126 | 5F672C8C141F3EBE00AC3919 /* TextCoreData.xcdatamodeld */, 127 | 5FAF5AB714202D3D00F9A63B /* Relation.h */, 128 | 5FAF5AB814202D3D00F9A63B /* Relation.m */, 129 | ); 130 | name = DataBase; 131 | sourceTree = ""; 132 | }; 133 | /* End PBXGroup section */ 134 | 135 | /* Begin PBXNativeTarget section */ 136 | 5F672C70141F3EBD00AC3919 /* TextCoreData */ = { 137 | isa = PBXNativeTarget; 138 | buildConfigurationList = 5F672C91141F3EBE00AC3919 /* Build configuration list for PBXNativeTarget "TextCoreData" */; 139 | buildPhases = ( 140 | 5F672C6D141F3EBD00AC3919 /* Sources */, 141 | 5F672C6E141F3EBD00AC3919 /* Frameworks */, 142 | 5F672C6F141F3EBD00AC3919 /* Resources */, 143 | ); 144 | buildRules = ( 145 | ); 146 | dependencies = ( 147 | ); 148 | name = TextCoreData; 149 | productName = TextCoreData; 150 | productReference = 5F672C71141F3EBD00AC3919 /* TextCoreData.app */; 151 | productType = "com.apple.product-type.application"; 152 | }; 153 | /* End PBXNativeTarget section */ 154 | 155 | /* Begin PBXProject section */ 156 | 5F672C68141F3EBD00AC3919 /* Project object */ = { 157 | isa = PBXProject; 158 | buildConfigurationList = 5F672C6B141F3EBD00AC3919 /* Build configuration list for PBXProject "TextCoreData" */; 159 | compatibilityVersion = "Xcode 3.2"; 160 | developmentRegion = English; 161 | hasScannedForEncodings = 0; 162 | knownRegions = ( 163 | en, 164 | ); 165 | mainGroup = 5F672C66141F3EBD00AC3919; 166 | productRefGroup = 5F672C72141F3EBD00AC3919 /* Products */; 167 | projectDirPath = ""; 168 | projectRoot = ""; 169 | targets = ( 170 | 5F672C70141F3EBD00AC3919 /* TextCoreData */, 171 | ); 172 | }; 173 | /* End PBXProject section */ 174 | 175 | /* Begin PBXResourcesBuildPhase section */ 176 | 5F672C6F141F3EBD00AC3919 /* Resources */ = { 177 | isa = PBXResourcesBuildPhase; 178 | buildActionMask = 2147483647; 179 | files = ( 180 | 5F672C82141F3EBE00AC3919 /* InfoPlist.strings in Resources */, 181 | 5F672C8B141F3EBE00AC3919 /* MainWindow.xib in Resources */, 182 | 5F672CA5141F414000AC3919 /* RootViewController.xib in Resources */, 183 | 5F672CAA141F415600AC3919 /* RelationViewController.xib in Resources */, 184 | ); 185 | runOnlyForDeploymentPostprocessing = 0; 186 | }; 187 | /* End PBXResourcesBuildPhase section */ 188 | 189 | /* Begin PBXSourcesBuildPhase section */ 190 | 5F672C6D141F3EBD00AC3919 /* Sources */ = { 191 | isa = PBXSourcesBuildPhase; 192 | buildActionMask = 2147483647; 193 | files = ( 194 | 5F672C84141F3EBE00AC3919 /* main.m in Sources */, 195 | 5F672C88141F3EBE00AC3919 /* TextCoreDataAppDelegate.m in Sources */, 196 | 5F672C8E141F3EBE00AC3919 /* TextCoreData.xcdatamodeld in Sources */, 197 | 5F672CA4141F414000AC3919 /* RootViewController.m in Sources */, 198 | 5F672CA9141F415600AC3919 /* RelationViewController.m in Sources */, 199 | 5FAF5AB914202D3D00F9A63B /* Relation.m in Sources */, 200 | ); 201 | runOnlyForDeploymentPostprocessing = 0; 202 | }; 203 | /* End PBXSourcesBuildPhase section */ 204 | 205 | /* Begin PBXVariantGroup section */ 206 | 5F672C80141F3EBE00AC3919 /* InfoPlist.strings */ = { 207 | isa = PBXVariantGroup; 208 | children = ( 209 | 5F672C81141F3EBE00AC3919 /* en */, 210 | ); 211 | name = InfoPlist.strings; 212 | sourceTree = ""; 213 | }; 214 | 5F672C89141F3EBE00AC3919 /* MainWindow.xib */ = { 215 | isa = PBXVariantGroup; 216 | children = ( 217 | 5F672C8A141F3EBE00AC3919 /* en */, 218 | ); 219 | name = MainWindow.xib; 220 | sourceTree = ""; 221 | }; 222 | /* End PBXVariantGroup section */ 223 | 224 | /* Begin XCBuildConfiguration section */ 225 | 5F672C8F141F3EBE00AC3919 /* Debug */ = { 226 | isa = XCBuildConfiguration; 227 | buildSettings = { 228 | ALWAYS_SEARCH_USER_PATHS = NO; 229 | ARCHS = "$(ARCHS_STANDARD_32_BIT)"; 230 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 231 | COPY_PHASE_STRIP = NO; 232 | GCC_C_LANGUAGE_STANDARD = gnu99; 233 | GCC_DYNAMIC_NO_PIC = NO; 234 | GCC_OPTIMIZATION_LEVEL = 0; 235 | GCC_PREPROCESSOR_DEFINITIONS = ( 236 | "DEBUG=1", 237 | "$(inherited)", 238 | ); 239 | GCC_SYMBOLS_PRIVATE_EXTERN = NO; 240 | GCC_VERSION = com.apple.compilers.llvmgcc42; 241 | GCC_WARN_ABOUT_MISSING_PROTOTYPES = YES; 242 | GCC_WARN_ABOUT_RETURN_TYPE = YES; 243 | GCC_WARN_UNUSED_VARIABLE = YES; 244 | IPHONEOS_DEPLOYMENT_TARGET = 4.3; 245 | SDKROOT = iphoneos; 246 | }; 247 | name = Debug; 248 | }; 249 | 5F672C90141F3EBE00AC3919 /* Release */ = { 250 | isa = XCBuildConfiguration; 251 | buildSettings = { 252 | ALWAYS_SEARCH_USER_PATHS = NO; 253 | ARCHS = "$(ARCHS_STANDARD_32_BIT)"; 254 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 255 | COPY_PHASE_STRIP = YES; 256 | GCC_C_LANGUAGE_STANDARD = gnu99; 257 | GCC_VERSION = com.apple.compilers.llvmgcc42; 258 | GCC_WARN_ABOUT_MISSING_PROTOTYPES = YES; 259 | GCC_WARN_ABOUT_RETURN_TYPE = YES; 260 | GCC_WARN_UNUSED_VARIABLE = YES; 261 | IPHONEOS_DEPLOYMENT_TARGET = 4.3; 262 | OTHER_CFLAGS = "-DNS_BLOCK_ASSERTIONS=1"; 263 | SDKROOT = iphoneos; 264 | VALIDATE_PRODUCT = YES; 265 | }; 266 | name = Release; 267 | }; 268 | 5F672C92141F3EBE00AC3919 /* Debug */ = { 269 | isa = XCBuildConfiguration; 270 | buildSettings = { 271 | GCC_PRECOMPILE_PREFIX_HEADER = YES; 272 | GCC_PREFIX_HEADER = "TextCoreData/TextCoreData-Prefix.pch"; 273 | INFOPLIST_FILE = "TextCoreData/TextCoreData-Info.plist"; 274 | PRODUCT_NAME = "$(TARGET_NAME)"; 275 | WRAPPER_EXTENSION = app; 276 | }; 277 | name = Debug; 278 | }; 279 | 5F672C93141F3EBE00AC3919 /* Release */ = { 280 | isa = XCBuildConfiguration; 281 | buildSettings = { 282 | GCC_PRECOMPILE_PREFIX_HEADER = YES; 283 | GCC_PREFIX_HEADER = "TextCoreData/TextCoreData-Prefix.pch"; 284 | INFOPLIST_FILE = "TextCoreData/TextCoreData-Info.plist"; 285 | PRODUCT_NAME = "$(TARGET_NAME)"; 286 | WRAPPER_EXTENSION = app; 287 | }; 288 | name = Release; 289 | }; 290 | /* End XCBuildConfiguration section */ 291 | 292 | /* Begin XCConfigurationList section */ 293 | 5F672C6B141F3EBD00AC3919 /* Build configuration list for PBXProject "TextCoreData" */ = { 294 | isa = XCConfigurationList; 295 | buildConfigurations = ( 296 | 5F672C8F141F3EBE00AC3919 /* Debug */, 297 | 5F672C90141F3EBE00AC3919 /* Release */, 298 | ); 299 | defaultConfigurationIsVisible = 0; 300 | defaultConfigurationName = Release; 301 | }; 302 | 5F672C91141F3EBE00AC3919 /* Build configuration list for PBXNativeTarget "TextCoreData" */ = { 303 | isa = XCConfigurationList; 304 | buildConfigurations = ( 305 | 5F672C92141F3EBE00AC3919 /* Debug */, 306 | 5F672C93141F3EBE00AC3919 /* Release */, 307 | ); 308 | defaultConfigurationIsVisible = 0; 309 | defaultConfigurationName = Release; 310 | }; 311 | /* End XCConfigurationList section */ 312 | 313 | /* Begin XCVersionGroup section */ 314 | 5F672C8C141F3EBE00AC3919 /* TextCoreData.xcdatamodeld */ = { 315 | isa = XCVersionGroup; 316 | children = ( 317 | 5F672C8D141F3EBE00AC3919 /* TextCoreData.xcdatamodel */, 318 | ); 319 | currentVersion = 5F672C8D141F3EBE00AC3919 /* TextCoreData.xcdatamodel */; 320 | path = TextCoreData.xcdatamodeld; 321 | sourceTree = ""; 322 | versionGroupType = wrapper.xcdatamodel; 323 | }; 324 | /* End XCVersionGroup section */ 325 | }; 326 | rootObject = 5F672C68141F3EBD00AC3919 /* Project object */; 327 | } 328 | -------------------------------------------------------------------------------- /TextCoreData/RelationViewController.xib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 1056 5 | 11B26 6 | 1617 7 | 1138 8 | 566.00 9 | 10 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 11 | 534 12 | 13 | 14 | YES 15 | IBUITextField 16 | IBUIButton 17 | IBUIView 18 | IBUILabel 19 | IBProxyObject 20 | 21 | 22 | YES 23 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 24 | 25 | 26 | YES 27 | 28 | YES 29 | 30 | 31 | 32 | 33 | YES 34 | 35 | IBFilesOwner 36 | IBCocoaTouchFramework 37 | 38 | 39 | IBFirstResponder 40 | IBCocoaTouchFramework 41 | 42 | 43 | 44 | 274 45 | 46 | YES 47 | 48 | 49 | 292 50 | {{49, 51}, {54, 21}} 51 | 52 | 53 | 54 | _NS:311 55 | NO 56 | YES 57 | 7 58 | NO 59 | IBCocoaTouchFramework 60 | info1: 61 | 62 | Helvetica 63 | 17 64 | 16 65 | 66 | 67 | 1 68 | MCAwIDAAA 69 | 70 | 71 | 1 72 | 10 73 | 74 | 75 | 76 | 292 77 | {{112, 51}, {97, 31}} 78 | 79 | 80 | 81 | _NS:294 82 | NO 83 | YES 84 | 1 85 | IBCocoaTouchFramework 86 | 0 87 | 88 | 3 89 | 90 | 3 91 | MAA 92 | 93 | 2 94 | 95 | 96 | YES 97 | 17 98 | 99 | IBCocoaTouchFramework 100 | 101 | 102 | 103 | 104 | 292 105 | {{49, 105}, {42, 21}} 106 | 107 | 108 | 109 | _NS:311 110 | NO 111 | YES 112 | 7 113 | NO 114 | IBCocoaTouchFramework 115 | info2: 116 | 117 | 118 | 119 | 1 120 | 10 121 | 122 | 123 | 124 | 292 125 | {{112, 105}, {97, 31}} 126 | 127 | 128 | 129 | _NS:294 130 | NO 131 | YES 132 | 2 133 | IBCocoaTouchFramework 134 | 0 135 | 136 | 3 137 | 138 | 3 139 | MAA 140 | 141 | 142 | YES 143 | 17 144 | 145 | IBCocoaTouchFramework 146 | 147 | 148 | 149 | 150 | 292 151 | {{49, 168}, {42, 21}} 152 | 153 | 154 | 155 | _NS:311 156 | NO 157 | YES 158 | 7 159 | NO 160 | IBCocoaTouchFramework 161 | info3: 162 | 163 | 164 | 165 | 1 166 | 10 167 | 168 | 169 | 170 | 292 171 | {{112, 168}, {97, 31}} 172 | 173 | 174 | 175 | _NS:294 176 | NO 177 | YES 178 | 3 179 | IBCocoaTouchFramework 180 | 0 181 | 182 | 3 183 | 184 | 3 185 | MAA 186 | 187 | 188 | YES 189 | 17 190 | 191 | IBCocoaTouchFramework 192 | 193 | 194 | 195 | 196 | 292 197 | {{49, 222}, {42, 21}} 198 | 199 | 200 | 201 | _NS:311 202 | NO 203 | YES 204 | 7 205 | NO 206 | IBCocoaTouchFramework 207 | info4: 208 | 209 | 210 | 211 | 1 212 | 10 213 | 214 | 215 | 216 | 292 217 | {{112, 222}, {97, 31}} 218 | 219 | 220 | 221 | _NS:294 222 | NO 223 | YES 224 | 4 225 | IBCocoaTouchFramework 226 | 0 227 | 228 | 3 229 | 230 | 3 231 | MAA 232 | 233 | 234 | YES 235 | 17 236 | 237 | IBCocoaTouchFramework 238 | 239 | 240 | 241 | 242 | 292 243 | {{43, 329}, {72, 37}} 244 | 245 | 246 | 247 | _NS:222 248 | NO 249 | 5 250 | IBCocoaTouchFramework 251 | 0 252 | 0 253 | 254 | Helvetica-Bold 255 | 15 256 | 16 257 | 258 | 1 259 | save 260 | 261 | 3 262 | MQA 263 | 264 | 265 | 1 266 | MC4xOTYwNzg0MzQ2IDAuMzA5ODAzOTMyOSAwLjUyMTU2ODY1NgA 267 | 268 | 269 | 3 270 | MC41AA 271 | 272 | 273 | 274 | 275 | 292 276 | {{206, 329}, {72, 37}} 277 | 278 | 279 | 280 | _NS:222 281 | NO 282 | 6 283 | IBCocoaTouchFramework 284 | 0 285 | 0 286 | 287 | 1 288 | cancel 289 | 290 | 291 | 1 292 | MC4xOTYwNzg0MzQ2IDAuMzA5ODAzOTMyOSAwLjUyMTU2ODY1NgA 293 | 294 | 295 | 296 | 297 | 298 | 292 299 | {{203, 271}, {78, 37}} 300 | 301 | 302 | 303 | _NS:222 304 | NO 305 | 7 306 | IBCocoaTouchFramework 307 | 0 308 | 0 309 | 310 | 1 311 | commit 312 | 313 | 314 | 1 315 | MC4xOTYwNzg0MzQ2IDAuMzA5ODAzOTMyOSAwLjUyMTU2ODY1NgA 316 | 317 | 318 | 319 | 320 | {{0, 20}, {320, 460}} 321 | 322 | 323 | 324 | 325 | 3 326 | MQA 327 | 328 | 329 | 330 | IBCocoaTouchFramework 331 | 332 | 333 | 334 | 335 | YES 336 | 337 | 338 | view 339 | 340 | 341 | 342 | 3 343 | 344 | 345 | 346 | buttonPressed: 347 | 348 | 349 | 7 350 | 351 | 18 352 | 353 | 354 | 355 | buttonPressed: 356 | 357 | 358 | 7 359 | 360 | 19 361 | 362 | 363 | 364 | field1 365 | 366 | 367 | 368 | 21 369 | 370 | 371 | 372 | field2 373 | 374 | 375 | 376 | 22 377 | 378 | 379 | 380 | field3 381 | 382 | 383 | 384 | 23 385 | 386 | 387 | 388 | field4 389 | 390 | 391 | 392 | 24 393 | 394 | 395 | 396 | buttonPressed: 397 | 398 | 399 | 7 400 | 401 | 25 402 | 403 | 404 | 405 | 406 | YES 407 | 408 | 0 409 | 410 | 411 | 412 | 413 | 414 | 1 415 | 416 | 417 | YES 418 | 419 | 420 | 421 | 422 | 423 | 424 | 425 | 426 | 427 | 428 | 429 | 430 | 431 | 432 | 433 | -1 434 | 435 | 436 | File's Owner 437 | 438 | 439 | -2 440 | 441 | 442 | 443 | 444 | 4 445 | 446 | 447 | 448 | 449 | 5 450 | 451 | 452 | 453 | 454 | 6 455 | 456 | 457 | 458 | 459 | 7 460 | 461 | 462 | 463 | 464 | 12 465 | 466 | 467 | 468 | 469 | 13 470 | 471 | 472 | 473 | 474 | 14 475 | 476 | 477 | 478 | 479 | 15 480 | 481 | 482 | 483 | 484 | 16 485 | 486 | 487 | 488 | 489 | 17 490 | 491 | 492 | 493 | 494 | 20 495 | 496 | 497 | 498 | 499 | 500 | 501 | YES 502 | 503 | YES 504 | -1.CustomClassName 505 | -1.IBPluginDependency 506 | -2.CustomClassName 507 | -2.IBPluginDependency 508 | 1.IBPluginDependency 509 | 12.IBPluginDependency 510 | 13.IBPluginDependency 511 | 14.IBPluginDependency 512 | 15.IBPluginDependency 513 | 16.IBPluginDependency 514 | 17.IBPluginDependency 515 | 20.IBPluginDependency 516 | 4.IBPluginDependency 517 | 5.IBPluginDependency 518 | 6.IBPluginDependency 519 | 7.IBPluginDependency 520 | 521 | 522 | YES 523 | RelationViewController 524 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 525 | UIResponder 526 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 527 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 528 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 529 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 530 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 531 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 532 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 533 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 534 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 535 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 536 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 537 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 538 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 539 | 540 | 541 | 542 | YES 543 | 544 | 545 | 546 | 547 | 548 | YES 549 | 550 | 551 | 552 | 553 | 25 554 | 555 | 556 | 557 | YES 558 | 559 | RelationViewController 560 | UIViewController 561 | 562 | buttonPressed: 563 | id 564 | 565 | 566 | buttonPressed: 567 | 568 | buttonPressed: 569 | id 570 | 571 | 572 | 573 | YES 574 | 575 | YES 576 | field1 577 | field2 578 | field3 579 | field4 580 | 581 | 582 | YES 583 | UITextField 584 | UITextField 585 | UITextField 586 | UITextField 587 | 588 | 589 | 590 | YES 591 | 592 | YES 593 | field1 594 | field2 595 | field3 596 | field4 597 | 598 | 599 | YES 600 | 601 | field1 602 | UITextField 603 | 604 | 605 | field2 606 | UITextField 607 | 608 | 609 | field3 610 | UITextField 611 | 612 | 613 | field4 614 | UITextField 615 | 616 | 617 | 618 | 619 | IBProjectSource 620 | ./Classes/RelationViewController.h 621 | 622 | 623 | 624 | 625 | 0 626 | IBCocoaTouchFramework 627 | 628 | com.apple.InterfaceBuilder.CocoaTouchPlugin.InterfaceBuilder3 629 | 630 | 631 | YES 632 | 3 633 | 534 634 | 635 | 636 | --------------------------------------------------------------------------------