IOS开发 coredata代码介绍
AppDelegate_iPad*appDelegate=(AppDelegate_iPad*)[[UIApplicationsharedApplication]dele...
AppDelegate_iPad *appDelegate = (AppDelegate_iPad *)[[UIApplication sharedApplication]delegate];
NSError * error=nil;
NSFetchRequest *fetchRequest = [[NSFetchRequest alloc] init];
// Edit the entity name as appropriate.
NSEntityDescription *entity = [NSEntityDescription entityForName:@"RecordDisplay" inManagedObjectContext:appDelegate.managedObjectContext];
[fetchRequest setEntity:entity];
NSSortDescriptor *sortDescriptor = [[NSSortDescriptor alloc] initWithKey:@"displayorder" ascending:YES];
NSArray *sortDescriptors = [[NSArray alloc] initWithObjects:sortDescriptor, nil];
[fetchRequest setSortDescriptors:sortDescriptors];
NSArray * objects=[appDelegate.managedObjectContext executeFetchRequest:fetchRequest error:&error];
// Edit the sort key as appropriate.
self.recorddisplayDate=[NSMutableArray arrayWithArray:objects];
[sortDescriptor release];
[sortDescriptors release];
[fetchRequest release];
IOS代码介绍
上面一段代码是什么意思啊?老是看不大明白,希望有知道的人给解释下… 展开
NSError * error=nil;
NSFetchRequest *fetchRequest = [[NSFetchRequest alloc] init];
// Edit the entity name as appropriate.
NSEntityDescription *entity = [NSEntityDescription entityForName:@"RecordDisplay" inManagedObjectContext:appDelegate.managedObjectContext];
[fetchRequest setEntity:entity];
NSSortDescriptor *sortDescriptor = [[NSSortDescriptor alloc] initWithKey:@"displayorder" ascending:YES];
NSArray *sortDescriptors = [[NSArray alloc] initWithObjects:sortDescriptor, nil];
[fetchRequest setSortDescriptors:sortDescriptors];
NSArray * objects=[appDelegate.managedObjectContext executeFetchRequest:fetchRequest error:&error];
// Edit the sort key as appropriate.
self.recorddisplayDate=[NSMutableArray arrayWithArray:objects];
[sortDescriptor release];
[sortDescriptors release];
[fetchRequest release];
IOS代码介绍
上面一段代码是什么意思啊?老是看不大明白,希望有知道的人给解释下… 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询