如何在Swift中使用PFImageView? [英] How can I use a PFImageView in Swift?

查看:88
本文介绍了如何在Swift中使用PFImageView?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试将其中的一个拖到情节提要中,但我能找到的只是UIImageView.在我的UIImageView的IBOutlet中,我将其更改为PFImageView,并且收到一条错误消息: 使用未声明的类型:'PFImageView'"

I've tried simply dragging one into my storyboard, but there all I can find is UIImageView. In my IBOutlet for the UIImageView, I changed it to a PFImageView, and I get an error saying: "Use of undeclared type: 'PFImageView'"

迅速不存在PFImageViews吗?

Do PFImageViews simply not exist in swift?

推荐答案

您需要确保已安装Parse SDK. 您还需要确保在使用的类上导入ParseUI,例如:

You need to ensure that you have the Parse SDK installed. You also need to ensure that you import the ParseUI on the class you are using, for example:

import ParseUI

然后,您可以在Storyboard上选择一个普通的ImageView,转到界面构建器上的Identity Inspector,将其类从UIImageView更改为PFImageView

You can then, on your Storyboard, select a normal ImageView, go to the Identity Inspector on your interface builder, change its class from UIImageView to PFImageView

将其作为代码的常规出口连接,但不要将其作为UIImageView连接,而是确保它是PFImageView,如下所示:

Connect it as an outlet as normal to your code, but instead of connecting as a UIImageView ensure it is a PFImageView, like this:

@IBOutlet weak var imgTestImage :PFImageView!

您现在可以访问PFImageView属性,例如:

You now have access to the PFImageView attributes such as:

let theImage = yourObject.valueForKey("profileImage") as? PFFile
imgTestImage.file = theImage
imgTestImage.loadInBackground()

希望这会有所帮助

这篇关于如何在Swift中使用PFImageView?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆