[問題] 在simulator中無法選擇圖片
大家好 我是最近剛學的超新手
今天在練習國外blogger寫的程式
在選擇圖片時 按下choose鍵後沒反應 如下圖
http://ppt.cc/kB1N
我是用xcode 4.2.1 ios 5
請問各位是會甚麼會這樣呢??
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 36.227.74.173
推
08/16 10:25, , 1F
08/16 10:25, 1F
推
08/16 13:04, , 2F
08/16 13:04, 2F
不好意思 附上網址及code
http://ppt.cc/Htw0
@synthesize imgPicker;
- (void)viewDidLoad {
self.imgPicker = [[UIImagePickerController alloc] init];
self.imgPicker.allowsImageEditing = YES;
self.imgPicker.delegate = self;
self.imgPicker.sourceType = UIImagePickerControllerSourceTypePhotoLibrary;
}
- (IBAction)grabImage {
[self presentModalViewController:self.imgPicker animated:YES];
}
有設delegate
※ 編輯: paramoree 來自: 140.138.152.42 (08/16 14:47)
推
08/16 15:41, , 3F
08/16 15:41, 3F
忘了貼這段@@
- (void)imagePickerController:(UIImagePickerController *)picker
didFinishPickingImage:(UIImage *)img editingInfo:(NSDictionary *)editInfo {
image.image = img;
[[picker parentViewController] dismissModalViewControllerAnimated:YES];
}
感謝V大提醒 我把原本的didFinishPickingImage改成你說的函式就成功了
太感謝你了!!
※ 編輯: paramoree 來自: 140.138.152.42 (08/16 17:36)