我對模型和保存數據仍然有點困惑,也許有人可以幫助我。我有一個頁面,用戶可以從那裏導入照片相冊。當我轉到下一頁時,它又一次消失了。我可以從文本框中將文本數據保存在NString中,但是我不確定如何使用圖像執行此操作。圖像顯示在UI webview中。在xcode項目中保存導入的照片
的Xcode 4.3
UIImagePickerController * picker = [[UIImagePickerController alloc] init];
picker.delegate = self;
if((UIButton *) sender == choosePhotoBtn) {
picker.sourceType = UIImagePickerControllerSourceTypeSavedPhotosAlbum;
}
[self presentModalViewController:picker animated:YES];
}
- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info {
[picker dismissModalViewControllerAnimated:YES];
imageView.image = [info objectForKey:@"UIImagePickerControllerOriginalImage"];
代碼發佈,研究單班,如果我捉摸將報告它,謝謝你的建議 – JSA986
好吧我讀了單身人士課程,仍然沒有進一步向前,我想要做的就是當我離開視圖時停止照片消失。你說你遇到了這個問題並解決了它,也許你會像用新的程序員術語那樣善良? – JSA986
再次感謝您的幫助,ive創建了單例課程,瞭解使用該類存儲全局變量的背後的原理,並感謝您的幫助。我不明白單身對象部分'Singleton * yourSingletonObj = [Singleton sharedSingletonController];'''yourSingletonObj。圖片=(你的圖像從PICKER);'我不斷收到錯誤:終止應用程序由於未捕獲的異常'NSInvalidArgumentException',原因:' - [UIImageView _isResizable]:我在哪裏添加?單個類或類的tpage我想保存圖像,我試過兩個,並得到錯誤 – JSA986