Henry Ngan
Henry Ngan

Reputation: 612

Unable to use PFImageView in Xcode

I am using Parse SDK 1.6.0. I used storyboard and dragged an UIImageView to a custom UITableViewCell. When I connect the UIImageView to the swift file, I changed the class to PFImageView. However, Xcode keeps telling me "Use of undeclared type 'PFImageView'".

I checked and I found the PFImageView.h is in the ParseUI.framework. I also discovered that I am not able to use other things included in ParseUI.framework like PFTableViewCell. But I am able to use the Parse.framework like PFUser, PFObject, PFFile etc.

enter image description here

Can anyone help me out? Many thanks.

Upvotes: 1

Views: 2190

Answers (3)

RJH
RJH

Reputation: 358

You just need to import the ParseUI on the class you are using, for example:

import ParseUI

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

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!

You now have access to the PFImageView attributes such as:

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

Hope this helps

Upvotes: 3

Ajay
Ajay

Reputation: 76

I think you mean: #import <ParseUI/ParseUI.h>
This includes the ParseUI.framework which includes PFImageView

You will also need #import <Parse/Parse.h>
This includes the Parse.framework classes like PFUser, etc.

Upvotes: 5

Henry Ngan
Henry Ngan

Reputation: 612

I found the answer. It worked after I added this line in the bridge file.

#import <Parse/Parse.h>

Upvotes: 0

Related Questions