【发布时间】:2016-05-03 21:33:57
【问题描述】:
我在故事板中有一个页面,用户可以在其中更改他们的昵称和用户图标。 用户、用户名是预定义的,我使用它和 NSUserDefaults 来存储关于所述用户的最少信息;
UserData['UserID'] = ["Nickname":"Johnny English", "UsersProfile": "abc123"]
我加载了一个页面,用户可以在其中修改他们的昵称和个人资料图片,使用 UIImagePickerController 我可以在用户库中找到一张图片,然后用新的个人资料替换页面上的库存图片一个。
但我无法找到一种方法来引用 iOS 目录中的图像或将图像移动到应用程序内部并以这种方式引用它。
到目前为止我有:
func imagePickerController(picker: UIImagePickerController, didFinishPickingMediaWithInfo info: [String : AnyObject]) {
if let pickedImage = info[UIImagePickerControllerOriginalImage] as? UIImage {
UserIconImageView.contentMode = .ScaleAspectFit
UserIconImageView.image = pickedImage
// Add the UsersProfile to the UsersProfile entry for this User
//detailsOfUser["CustomImage"] = pickedImage
// Change the 'Done' button to a 'Save'
self.completeButton.title = "Save"
}
dismissViewControllerAnimated(true, completion: nil)
}
在这里进行的最佳方式是什么? 引用图像还是将其移动到应用程序中会更好吗?如果有怎么办?
detailsOfUser["CustomImage"] = does a url / referencing string go here?
【问题讨论】:
标签: ios swift uiimage uiimagepickercontroller