0
這裏我創建一個應用程序,我使用Pickerview。我通過此編碼成功創建了採集器視圖:fetchrequest數組從核心數據中使用選擇器視圖
(void)viewDidLoad {
[super viewDidLoad];
pickerview =[[UIPickerView alloc]init];
pickerview.frame =CGRectMake(180,250, 145, 10);
pickerview.showsSelectionIndicator=YES;
[self.view addSubview:pickerview];
pickerview.delegate=self;
pickerview.dataSource=self;
iTeacherAppDelegate* delegate = (iTeacherAppDelegate*)[[UIApplication sharedApplication] delegate];
NSManagedObjectContext *context = [delegate managedObjectContext];
NSFetchRequest *fetchRequest = [[NSFetchRequest alloc] init];
NSEntityDescription *entity = [NSEntityDescription
entityForName:@"Subject" inManagedObjectContext:context];
[fetchRequest setEntity:entity];
***NSArray *temp = [[context executeFetchRequest:fetchRequest error:nil]retain];***
[fetchRequest release];
}
在上面的代碼中,我找到了來自executefetchrequest的臨時數組。我不能在選擇器視圖中使用這個數組來顯示。當我們嘗試然後顯示可變數據不是一個cfstring