如何在Swift中使用PFImageView?

编程入门 行业动态 更新时间:2024-10-16 00:22:41
本文介绍了如何在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?

本文发布于:2023-11-26 21:59:22,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1635364.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:如何在   Swift   PFImageView

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!