Synching parse object array with UIImageView array - ios

I'm building an app for creating events which uses parse as a back end. The main interface is a collection view with a custom cell, which when flipped displays an array of UIImageViews added to the cell file as an IBOutlet collection.
#IBOutlet var imageViewArray: [UIImageView]!
Inside the event.getDataInBackground block I have this code, which doesn't get called for some reason, I think it will work once it is but does anyone know what's up? Thanks!
//gets profile pictures for image view array on back of cell
if let attendeeArray = event?.objectForKey("attendees") as? [PFUser] {
for var index = 0; index < attendeeArray.count; ++index {
let profileImageView = cell.imageViewArray[index]
let usr : PFUser = (attendeeArray[index] as PFUser?)!
if let picture = usr.objectForKey("profilePicture") as? PFFile {
picture.getDataInBackgroundWithBlock({ (data, error) -> Void in
profileImageView.image = UIImage(data: data!)
})
}
}
}
The whole cell for row at index path method (The creator image shows up and is called but the attendee array part is not).
func collectionView(collectionView: UICollectionView, cellForItemAtIndexPath indexPath: NSIndexPath) -> UICollectionViewCell {
//sets up cell
let cell : EventCell = collectionView.dequeueReusableCellWithReuseIdentifier("cell", forIndexPath: indexPath) as! EventCell
//adds attend action
cell.attendButton.addTarget(self, action: "buttonTapped:", forControlEvents: UIControlEvents.TouchUpInside)
//queries parse for events
let event = events?[indexPath.row]
event?.eventImage.getDataInBackgroundWithBlock({ (data, error) -> Void in
if let data = data, image = UIImage(data: data) {
cell.eventBackgroundImage.image = image
cell.eventTitleLabel.text = event?.eventTitle
//gets profile picture of events creator
if let eventCreator = event?.objectForKey("user") as? PFUser {
if let creatorImage = eventCreator.objectForKey("profilePicture") as? PFFile {
creatorImage.getDataInBackgroundWithBlock({ (data, error) -> Void in
cell.creatorImageView.image = UIImage(data: data!)
})
}
}
//gets profile pictures for image view array on back of cell
if let attendeeArray = event?.objectForKey("attendees") as? [PFUser] {
for var index = 0; index < attendeeArray.count; ++index {
let profileImageView = cell.imageViewArray[index]
let usr : PFUser = (attendeeArray[index] as PFUser?)!
if let picture = usr.objectForKey("profilePicture") as? PFFile {
picture.getDataInBackgroundWithBlock({ (data, error) -> Void in
profileImageView.image = UIImage(data: data!)
})
}
}
}
//sets correct category for cell image
if event?.category == "" {
cell.categoryImageView.image = nil
}
if event?.category == "The Arts" {
cell.categoryImageView.image = UIImage(named: "Comedy")
}
if event?.category == "The Outdoors" {
cell.categoryImageView.image = UIImage(named: "Landscape")
}
if event?.category == "Other" {
cell.categoryImageView.image = UIImage(named: "Dice")
}
if event?.category == "Sports" {
cell.categoryImageView.image = UIImage(named: "Exercise")
}
if event?.category == "Academics" {
cell.categoryImageView.image = UIImage(named: "University")
}
if event?.category == "Science" {
cell.categoryImageView.image = UIImage(named: "Physics")
}
if event?.category == "Entertainment" {
cell.categoryImageView.image = UIImage(named: "Bowling")
}
if event?.category == "Food & Drinks" {
cell.categoryImageView.image = UIImage(named: "Food")
}
if let date = event?.eventDate {
let dateFormatter = NSDateFormatter()
dateFormatter.dateFormat = "yyyy-MM-dd"
cell.eventDescriptionLabel.text = event?.eventDescription
cell.eventDateLabel.text = dateFormatter.stringFromDate(date)
}
}
})
cell.layer.cornerRadius = 20
return cell
}
EDITED:
//gets profile pictures for image view array on back of cell
if let attendeeArray = event?.objectForKey("attendees") as? [PFUser] {
for var index = 0; index < attendeeArray.count; ++index {
let profileImageView = cell.imageViewArray[index]
let usr : PFUser = (attendeeArray[index] as PFUser?)!
usr.fetchIfNeededInBackgroundWithBlock({ (object: PFObject?, error: NSError?) -> Void in
if let picture = object!.objectForKey("profilePicture") as? PFFile {
picture.getDataInBackgroundWithBlock({ (data, error) -> Void in
profileImageView.image = UIImage(data: data!)
})
}
})
}
}

You need to fetch the usr before you can get picture
usr.fetchIfNeededInBackgroundWithBlock({ (object: PFObject?, error: NSError?) -> Void in
if let picture = object.objectForKey("profilePicture") as? PFFile {
picture.getDataInBackgroundWithBlock({ (data, error) -> Void in
profileImageView.image = UIImage(data: data!)
})
}
})

Related

Async load image to custom UITableViewCell partially working

My images dont load into the imageview until you scroll the cell off the table and back on, or go to another view and come back to the the view (redraws the cell).
How do I make them load in correctly?
/////////
My viewDidLoad has this in it:
tableView.delegate = self
tableView.dataSource = self
DispatchQueue.global(qos: .background).async {
self.getBusinesses()
DispatchQueue.main.async {
self.tableView.reloadData()
}
}
I call the function download the image here in the .getBusinesses function called in viewDidLoad:
func getBusinesses() -> Array<Business> {
var businessList = Array<Business>()
//let id = 1
let url = URL(string: "**example**")!
let data = try? Data(contentsOf: url as URL)
var isnil = false
if data == nil{
isnil = true
}
print("is nill is \(isnil)")
if(data == nil){
print("network error")
businessList = []
return businessList
}
else{
values = try! JSONSerialization.jsonObject(with: data!, options: JSONSerialization.ReadingOptions.mutableContainers) as! NSDictionary
}
let json = JSON(values)
var i = 0;
for (key, values) in json {
var businessReceived = json[key]
let newBusiness = Business(id: "18", forename: "", surname: "", email: "", password: "", business: true, level: 1, messageGroups: [], problems: [])
newBusiness.name = businessReceived["name"].stringValue
newBusiness.description = businessReceived["description"].stringValue
newBusiness.rating = Int(businessReceived["rating"].doubleValue)
newBusiness.category = businessReceived["category"].intValue
newBusiness.distance = Double(arc4random_uniform(198) + 1)
newBusiness.image_url = businessReceived["image"].stringValue
newBusiness.url = businessReceived["url"].stringValue
newBusiness.phone = businessReceived["phone"].stringValue
newBusiness.postcode = businessReceived["postcode"].stringValue
newBusiness.email = businessReceived["email"].stringValue
newBusiness.id = businessReceived["user_id"].stringValue
if(newBusiness.image_url == ""){
newBusiness.getImage()
}
else{
newBusiness.image = #imageLiteral(resourceName: "NoImage")
}
if(businessReceived["report"].intValue != 1){
businessList.append(newBusiness)
}
}
businesses = businessList
print(businesses.count)
holdBusinesses = businessList
return businessList
}
Here in the business object i have this method to download the image from the url and store it in the business object's image property:
func getImage(){
if(self.image_url != ""){
print("runs imageeee")
var storage = FIRStorage.storage()
// This is equivalent to creating the full reference
let storagePath = "http://firebasestorage.googleapis.com\(self.image_url)"
var storageRef = storage.reference(forURL: storagePath)
// Download in memory with a maximum allowed size of 1MB (1 * 1024 * 1024 bytes)
storageRef.data(withMaxSize: 30 * 1024 * 1024) { data, error in
if let error = error {
// Uh-oh, an error occurred!
} else {
// Data for "images/island.jpg" is returned
self.image = UIImage(data: data!)!
print("returned image")
}
}
}
else{
self.image = #imageLiteral(resourceName: "NoImage")
}
}
I then output it in the tableview here:
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = self.tableView.dequeueReusableCell(withIdentifier: "Cell", for : indexPath) as! BusinessesViewCell
cell.businessImage.image = businesses[(indexPath as NSIndexPath).row].image
//.............
return cell
}
self.image = UIImage(data: data!)!
should become
DispatchQueue.main.async {
self.image = UIImage(data: data!)!
}
Inside
storageRef.data(withMaxSize: 30 * 1024 * 1024) { data, error in
EDIT: My initial thought was the download logic was inside the cell, now I know its not.
you either need to call reloadData() on the tableView each time you get to
self.image = UIImage(data: data!)!
or better yet find out which index you just updated, then called
tableView.reloadRows:[IndexPath]
You can use
cell.businessImage.setNeedsLayout()

Some cells won't show

I'm trying to create a chat applications with tableview to show the messages. Everything works fine except that some cells just won't show. It aren't always the same cells. I'm getting the messages from my Firebase database.
My Code:
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
if let cell = cellCache.object(forKey: indexPath as AnyObject) as? UITableViewCell{
return cell
}
let cell = messagesTableView.dequeueReusableCell(withIdentifier: "otherMessageCell") as! OtherMessageTableViewCell
DispatchQueue.global(qos: .userInteractive).async {
let message = self.messages[indexPath.row]
let ref = FIRDatabase.database().reference()
let uid = FIRAuth.auth()?.currentUser?.uid
if(uid == message.sender) {
cell.sender.textAlignment = .right
cell.message.textAlignment = .right
}else{
cell.sender.textAlignment = .left
cell.message.textAlignment = .left
}
let uidReference = ref.child("Users").child(message.sender!)
uidReference.observeSingleEvent(of: .value, with: { (snapshot) in
if let dictionary = snapshot.value as? [String: AnyObject] {
let username = dictionary["Username"] as! String
let imageLink = dictionary["Image Link"] as! String
cell.sender.text = username
cell.message.text = message.message
cell.profileImage.image = nil
cell.profileImage.loadImageWithURLString(urlString: imageLink)
}
}, withCancel: nil)
}
DispatchQueue.main.async {
self.cellCache.setObject(cell, forKey: indexPath as AnyObject)
}
return cell
}
Example:
I hope someone will be able to help me. Thanks
I've found a solution:
var savedSenders = [Int: String]()
var savedMessages = [Int: String]()
var savedImages = [Int: UIImage]()
var savedAlignments = [Int: NSTextAlignment]()
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = messagesTableView.dequeueReusableCell(withIdentifier: "otherMessageCell") as! OtherMessageTableViewCell
if(savedSenders[indexPath.row] != nil && savedMessages[indexPath.row] != nil && savedImages[indexPath.row] != nil && savedAlignments[indexPath.row] != nil) {
cell.sender.textAlignment = savedAlignments[indexPath.row]!
cell.message.textAlignment = savedAlignments[indexPath.row]!
cell.sender.text = savedSenders[indexPath.row]
cell.message.text = savedMessages[indexPath.row]
cell.profileImage.image = savedImages[indexPath.row]
return cell
}
cell.sender.text = ""
cell.message.text = ""
cell.profileImage.image = nil
DispatchQueue.global(qos: .userInteractive).async {
let message = self.messages[indexPath.row]
let ref = FIRDatabase.database().reference()
let uid = FIRAuth.auth()?.currentUser?.uid
if(uid == message.sender) {
cell.sender.textAlignment = .right
cell.message.textAlignment = .right
self.savedAlignments.updateValue(.right, forKey: indexPath.row)
}else{
cell.sender.textAlignment = .left
cell.message.textAlignment = .left
self.savedAlignments.updateValue(.left, forKey: indexPath.row)
}
let uidReference = ref.child("Users").child(message.sender!)
uidReference.observeSingleEvent(of: .value, with: { (snapshot) in
if let dictionary = snapshot.value as? [String: AnyObject] {
let username = dictionary["Username"] as! String
let imageLink = dictionary["Image Link"] as! String
cell.sender.text = username
cell.message.text = message.message
cell.profileImage.image = nil
cell.profileImage.loadImageWithURLString(urlString: imageLink)
let url = URL(string: imageLink)
URLSession.shared.dataTask(with: url!) { (data, response, error) in
if(error != nil){
print(error as Any)
return
}
DispatchQueue.main.async {
if let downloadedImage = UIImage(data: data!) {
let image = downloadedImage
self.savedSenders.updateValue(username, forKey: indexPath.row)
self.savedMessages.updateValue(message.message!, forKey: indexPath.row)
self.savedImages.updateValue(image, forKey: indexPath.row)
}
}
}.resume()
}
}, withCancel: nil)
}
return cell
}
The data for every cell is saved into the arrays (savedSenders, savedMessages, savedImages and savedAlignments). If I don't save it into arrays, the cells will have to load all the data from Firebase and this will take longer. If it takes longer, it won't look good.
I tested everything and it works.

CollecitonView does not always display data correctly

I am trying to implement a UICollectionView with custom cells.
The setup is the following:
4 Cells
If I get the data of an downloaded image => fill the cell's imageView with that image.
else: use a placeholder.
The PFFiles of the images are saved within imageFileDic:[String:PFFile].
This is my UPDATED cellForItemAtIndexPath:
let collectionCell:SettingsCollectionViewCell =
collectionView.dequeueReusableCellWithReuseIdentifier("collectionCell",
forIndexPath: indexPath) as! SettingsCollectionViewCell
if indexPath.row < imageFileDic.count {
if let imageId = imageFileIds[indexPath.row] as? String {
if let imageData = imageFileDic[imageId]{
collectionCell.collectionViewImage.file = imageData
collectionCell.collectionViewImage.loadInBackground()
}
}
} else{
collectionCell.collectionViewButton.setImage(UIImage(), forState: .Normal)
collectionCell.collectionViewImage.image = UIImage(named: "CameraBild.png")
}
Now sometimes (1/5 times) my application decides to display an image twice, or in the position of cell nr. 4.
in my query I am always deleting the dictionaries and arrays before appending new data.
Any ideas?
Edit:
This is the PFQuery I am calling:
let imageQuery = PFQuery(className: "Images")
imageQuery.whereKey("sender", equalTo: objectID!)
imageQuery.addAscendingOrder("createdAt")
imageQuery.cachePolicy = .NetworkElseCache
imageQuery.findObjectsInBackgroundWithBlock { (objects, error) in
if error != nil {
createAlert(error!)
}
else{
if let objects = objects{
self.imageFileDic.removeAll()
self.imageFileIds.removeAll()
for object in objects{
if let id = object.objectId{
print("id found")
if let imageFile = object.objectForKey("imageFile") as? PFFile{
self.imageFileIds.append(id)
self.imageFileDic[id] = imageFile
if object == objects.last{
print(self.imageFileIds.count)
print(self.imageFileDic.count)
self.mainCollectionView.reloadData()
}
}
}
}
}
}
}
}
I think you should update image to main thread
dispatch_async(dispatch_get_main_queue()) {
collectionCell.collectionViewImage.file = imageData
collectionCell.collectionViewImage.loadInBackground()
}

Swift Cells Not Displaying

I have a profile page that is made up of two custom tableview cells. The first custom cell is the user's info. The second custom cell is the user's friend. The first row is the user's info, and all of the cells after that are the user's friends. My code worked in Xcode 6, but stopped working after the update.
Problem: A user with 2 friends, their profile page should have a table with three cells: 1 user info cell, 2 friend cells. However, the first and second cell aren't showing. Only the third cell is showing.
Clarification: There should be three cells. Cell 1 is not showing. Cell 2 is not showing. But Cell 3 is showing. Cell 1 is the user's info. Cell 2 is one friend. Cell 3 is another friend.
Here's my code:
func numberOfSectionsInTableView(tableView: UITableView) -> Int {
return 1
}
func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return friendList.count + 1
}
func tableView(tableView: UITableView, heightForRowAtIndexPath indexPath: NSIndexPath) -> CGFloat {
if indexPath.row == 0{
return 182.0
}else{
return 95.0
}
}
func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
if indexPath.row != 0{
let cell = tableView.dequeueReusableCellWithIdentifier("friendCell", forIndexPath: indexPath) as! ProfileFriendTableViewCell
let friend = friendList[indexPath.row - 1]
cell.nameLabel.text = friend[1]
cell.usernameLabel.text = friend[2]
cell.schoolLabel.text = friend[3]
cell.sendRequestButton.tag = indexPath.row
var profileImageExists = false
if profileImages != nil{
for profileImage in profileImages{
if profileImage.forUser == friend[2]{
profileImageExists = true
cell.friendImageProgress.hidden = true
cell.profilePic.image = UIImage(data: profileImage.image)
UIView.animateWithDuration(0.2, animations: {
cell.profilePic.alpha = 1
})
}
}
}else if loadingImages == true{
profileImageExists = true
cell.friendImageProgress.hidden = true
cell.profilePic.image = UIImage(named: "profileImagePlaceholder")
UIView.animateWithDuration(0.2, animations: {
cell.profilePic.alpha = 1
})
}
if profileImageExists == false{
if Reachability.isConnectedToNetwork() == true{
let query = PFUser.query()
query?.getObjectInBackgroundWithId(friend[0], block: { (object, error) -> Void in
if error == nil{
if let object = object as? PFUser{
let friendProfilePicture = object.objectForKey("profileImage") as? PFFile
friendProfilePicture?.getDataInBackgroundWithBlock({ (data, error) -> Void in
if data != nil{
let image = UIImage(data: data!)
cell.profilePic.image = image
if let managedObjectContext = (UIApplication.sharedApplication().delegate as! AppDelegate).managedObjectContext {
let newProfileImage = NSEntityDescription.insertNewObjectForEntityForName("ProfileImageEntity", inManagedObjectContext: managedObjectContext) as! ProfileImage
newProfileImage.forUser = friend[2]
newProfileImage.image = UIImagePNGRepresentation(image!)
do{
try managedObjectContext.save()
}catch _{
print("insert error")
}
}
}else{
cell.friendImageProgress.hidden = true
cell.profilePic.image = UIImage(named: "profileImagePlaceholder")
}
}, progressBlock: { (progress: Int32) -> Void in
let percent = progress
let progressPercent = Float(percent) / 100
cell.friendImageProgress.progress = progressPercent
cell.friendImageProgress.hidden = true
})
}
}
})
}
else{
cell.friendImageProgress.hidden = true
cell.profilePic.image = UIImage(named: "profileImagePlaceholder")
}
}
return cell
}else{
let cell = tableView.dequeueReusableCellWithIdentifier("profileTopCell", forIndexPath: indexPath) as! ProfileTableViewCell
var profileImageExists = false
if profileImages != nil{
for profileImage in profileImages{
if profileImage.forUser == PFUser.currentUser()!.username!{
profileImageExists = true
cell.profilePic.image = UIImage(data: profileImage.image)
}
}
}else if loadingImages == true{
profileImageExists = true
cell.profilePic.image = UIImage(named: "profileImagePlaceholder")
}
if profileImageExists == false{
if Reachability.isConnectedToNetwork() == true{
let profilePicture = PFUser.currentUser()!.objectForKey("profileImage") as? PFFile
profilePicture?.getDataInBackgroundWithBlock({ (data, error) -> Void in
if data != nil{
let image = UIImage(data: data!)
cell.profilePic.image = image
if let managedObjectContext = (UIApplication.sharedApplication().delegate as! AppDelegate).managedObjectContext {
let newProfileImage = NSEntityDescription.insertNewObjectForEntityForName("ProfileImageEntity", inManagedObjectContext: managedObjectContext) as! ProfileImage
newProfileImage.forUser = PFUser.currentUser()!.username!
newProfileImage.image = UIImagePNGRepresentation(image!)
do{
try managedObjectContext.save()
}catch _{
print("insert error")
}
}
}else{
cell.profilePic.image = UIImage(named: "profileImagePlaceholder")
}
})
}else{
cell.profilePic.image = UIImage(named: "profileImagePlaceholder")
}
}
cell.nameLabel.text = PFUser.currentUser()!.objectForKey("Name") as? String
cell.usernameLabel.text = PFUser.currentUser()!.objectForKey("username") as? String
let friendNumber = PFUser.currentUser()!.objectForKey("numberOfFriends") as? Int
if friendNumber != 1{
cell.numberOfFriendsLabel.text = "\(friendNumber!) Friends"
}else{
cell.numberOfFriendsLabel.text = "1 Friend"
}
return cell
}
}
Try to use estimatedRowHeightand rowHeight = UITableViewAutomaticDimension on your viewDidLoad or viewWillAppear and on heightForRowAtIndexPath return UITableViewAutomaticDimension, remember to put constraints on your custom cell, so these can work properly.
Thanks to Jeremy Andrews (https://stackoverflow.com/a/31908684/3783946), I found the solution:
"All you have to do is go to file inspector - uncheck size classes - there will be warnings etc.run and there is the data - strangely - go back to file inspector and check "use size classes" again, run and all data correctly reflected. Seems like in some cases the margin is set to negative."
It was just a bug.

Hide custom ViewTableCell Button for a specific cell

I'm facing a problem with a UITableViewCell.
When I generate my tableCells, I check if a value is equal to something and if so, I hide a custom button I made in my prototype cell. The problem is, the button with the identifier I hide is hidden in every Cell and not the current one only...
I looked around but can't find something to do... Could you help ? Here's my code, look at the line if currentPost.valueForKey... == "noLink". Thanks !
func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell{
var cell = tableView.dequeueReusableCellWithIdentifier("postCell", forIndexPath: indexPath) as! PostTableViewCell
var currentCell = indexPath
var currentPost = post[indexPath.row]
var currentUser = followedInfo[currentPost.valueForKey("userID") as! String]
cell.username.contentHorizontalAlignment = UIControlContentHorizontalAlignment.Left
cell.userProfil.layer.cornerRadius = 0.5 * cell.userProfil.bounds.size.width
cell.username.setTitle(currentUser?.valueForKey("username") as? String, forState: UIControlState.Normal)
cell.postArtist.text = currentPost.valueForKey("artistName") as? String
cell.postDescription.text = currentPost.valueForKey("postDescription") as? String
cell.postTitle.text = currentPost.valueForKey("songName") as? String
cell.postTime.text = "7J"
cell.postDescription.sizeToFit()
if currentPost.valueForKey("itunesLink") as? String == "noLink" {
cell.postItunes.hidden = true;
}else{
cell.postItunes.addTarget(self, action: "getToStore:", forControlEvents: .TouchUpInside)
}
if currentPost.valueForKey("previewLink") as? String == "noPreview" {
cell.postPlay.alpha = 0;
}else{
cell.postPlay.addTarget(self, action: "getPreview:", forControlEvents: .TouchUpInside)
}
if currentPost.valueForKey("location") as? String == "noLocalisation" {
cell.postLocation.text = "Inconnu"
}else{
cell.postLocation.text = currentPost.valueForKey("location") as? String
}
if currentUser?.valueForKey("profilePicture")! != nil{
var pictureFile: AnyObject? = currentUser?.valueForKey("profilePicture")!
pictureFile!.getDataInBackgroundWithBlock({ (imageData, error) -> Void in
var theImage = UIImage(data: imageData!)
cell.userProfil.image = theImage
})
}
if currentPost.valueForKey("coverLink") as? String == "customImage" {
var profilPictureFile: AnyObject? = currentPost.valueForKey("postImage")
profilPictureFile!.getDataInBackgroundWithBlock { (imageData , imageError ) -> Void in
if imageError == nil{
let image = UIImage(data: imageData!)
cell.postPicture.image = image
}
}
}else{
if currentPost.valueForKey("coverLink") as? String == "noCover"{
var cover = UIImage(named: "noCover")
cell.postPicture.image = cover
}else{
var finalURL = NSURL(string: currentPost.valueForKey("coverLink") as! String)
let request: NSURLRequest = NSURLRequest(URL: finalURL!)
NSURLConnection.sendAsynchronousRequest(request, queue: NSOperationQueue.mainQueue(), completionHandler: {(response: NSURLResponse!,data: NSData!,error: NSError!) -> Void in
if error == nil {
var image = UIImage(data: data)
cell.postPicture.image = image
}
else {
println("Error: \(error.localizedDescription)")
}
})
}
}
return cell;
}
You are not setting the bottom back to visible if you want it to show, because you are reusing the cell the last setup is part of the cell, so as soon as you set it to hidden to true it will still hidden until you set hidden back to false, the best way to use reusable cell is to always set all the options to what you want to be for that cell to avoid the setting to be as the old cell.
if currentPost.valueForKey("itunesLink") as? String == "noLink" {
cell.postItunes.hidden = true;
}else{
cell.postItunes.hidden = false;
cell.postItunes.addTarget(self, action: "getToStore:", forControlEvents: .TouchUpInside)
}

Resources