0
我使用UIImagePickerController
允許用戶從他們的庫中選擇一張照片。然後我想用這個代碼分配選擇的圖像;UIImagePickerController圖像不變
- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info {
UIImage* image = [info objectForKey:UIImagePickerControllerOriginalImage];
[users_pic_ setImage:image];
[self dismissModalViewControllerAnimated:YES];
}
但用戶圖片永不改變。
users_pic_
被定義爲:UIImageView* user_pic_;
任何人注意到有什麼不對嗎?由於
問題變成是,UIImageView的不正確初始化。我在我的viewDidLoad方法中分配了它(之前它通過XIB文件在Interface builder中設置),然後[users_pic_setImage:image]工作。 – user441019 2010-10-16 17:06:34