【问题标题】:Selecting an image from the photo library to be displayed to a image view on the apple watch using xcode and swift使用 xcode 和 swift 从照片库中选择要显示到 Apple Watch 上的图像视图的图像
【发布时间】:2019-06-22 12:48:25
【问题描述】:

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

我已经尝试了一些示例,这些示例解释了如何从照片库中获取图像,然后将其显示到 UIImageView,但是对于尝试做同样事情但苹果手表却无法正常工作的手机。

这是一个示例,说明人们一直在尝试解决此问题,但针对的是手机而不是 Apple 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 的图像。

【问题讨论】:

    标签: ios swift xcode watchkit apple-watch


    【解决方案1】:

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

    【讨论】:

    • 谢谢。你知道是否有不同的方法可以获得相同的结果,也许为 Apple Watch 使用不同的用户界面?
    猜你喜欢
    • 2014-02-03
    • 2017-09-06
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-06-09
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多