gpt4 book ai didi

ios - 使用 xcode 和 swift 从照片库中选择要显示到 Apple Watch 上的 ImageView 的图像

转载 作者:行者123 更新时间:2023-11-29 05:39:20 25 4
gpt4 key购买 nike

我一直在尝试设置一个 UIImageView,它允许用户从 Apple Watch 中选择图像,然后将其显示到 UIImageView。然而,我尝试解决这个问题并没有成功。仅提供了如何在手机上执行此操作的示例。

我已经尝试过一些示例,这些示例解释了如何从照片库获取图像,然后将其显示到 UIImageView,但是对于手机,在尝试执行相同操作但对于 Apple Watch 时却不起作用。

这里是一个例子,说明人们一直在尝试解决这个问题,但针对的是手机而不是苹果 watch

class ViewController: UIImagePickerController, UINavigationControllerDelegate, UIImagePickerControllerDelegate  {
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view, typically from a nib.
}

override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}

func tableView(tableView: UITableView!, didSelectRowAtIndexPath indexPath: NSIndexPath!) {

var imagePickerController = UIImagePickerController()
imagePickerController.delegate = self
imagePickerController.sourceType = UIImagePickerControllerSourceType.SavedPhotosAlbum
imagePickerController.allowsEditing = true
self.presentViewController(imagePickerController, animated: true, completion: { imageP in

})
}


func imagePickerController(picker: UIImagePickerController!, didFinishPickingImage image: UIImage!, editingInfo: NSDictionary!) {
let selectedImage : UIImage = image
println(selectedImage)
}
}

预期的结果是能够单击链接到 UIImageView 的按钮,然后弹出照片库并允许我选择一个图像,然后将其显示到 UIImageView。

最佳答案

Apple Watch 平台没有等效的 UIImagePickerController。您所能做的就是向Apple提出建议Feedback Assistant这样的组件对您有用。对于他们来说,让 watchOS 图像选择器缩略图足够可见和可滚动将是一个用户体验挑战,但你不妨让他们知道,因为他们确实会阅读反馈并做出回应。

关于ios - 使用 xcode 和 swift 从照片库中选择要显示到 Apple Watch 上的 ImageView 的图像,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56710546/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com