ios - How to call UICollectionViewCell ImageView in IBAction Method? -


I am struggling with something that can be easy, but I can not get it!

I have a button inside a UIImageView and UICollectionView inside the UICmlectionViewCell 0) {cell.imageFile.image = [UIImage imageWithData: data]; UITapGestureRecognizer * infoLook = [[UITapGestureRecognizer alloc] initWithTarget: Auto Actions: @Selector (HandsetTap :)]; InfoLook.numberOfTapsRequired = 1; [Cell.imageFile addGestureRecognizer: infoLook]; } And {{cell.progressView removeFromSuperview]; }} Progress block: ^ (integer percent donation) {float percentage = percentage dan * 0.02; [Cell. Progress progression set progress: percent]; If (percent dan == 100) {[cell.progressView removeFromSuperview]; }; [Cell. Activation indicator stop animation); }]; Return cell; }

verb method:

  - (zero) handleTap: (UITapGestureRecognizer *) infoLook {if ([sender is selected]) {[sender setImage : [UIImage imageNamed: @ "Like.png"] forState: UIControlStateNormal]; [Sender set selected: no]; } And {[sender set image: [UIImage imageNamed: @ "Liked.png"] forState: UIControlStateSelected]; [Sender set selected: yes]; UIImageView * like = [[UIImageView alloc] initWithFrame: CGRectMake (120, 220, 100, 100)]; like.image = [UIImage imageNamed: @ "Love Page"]; [Self.view addSubview: likes]; [UIView animated: 2 animations: ^ {like.alpha = 0.0;}];   

This is the part where I can not call UIIolageViewCell's UIImageView:

  NSData * data = UIImageJPEG repatnation (cell.imageFile.image, 0.8f ); PF file * liked image = [PF file file name: @ "image .jpg" data: data]; [Preferred Image Savebackgroundblock: ^ (Bull succeeded, NSER * error) {if (error!) {PFObject * userLikes = [PFObject objectWithClassName: @ "UserProfile"]; [UserLikes setObject: For the likes of the image: @ "Look Like"]; UserLikes.ACL = [PFACL ACL with user: [PFUSSER current user]]; PFUser * user = [PFUser currentUser]; [userLikes setObject: for user: @ "user"]; [UserLikes saveInBackgroundWithBlock: ^ (BOOL successfully, NSError * error) {if (error!) {NSLog (@ "saved"); } And {nslog (@ "error:% @% @", error, [error user information]); }}]; }}]; NSLog (@ "liked image"); }}    

You must first obtain an index of items using the method NSIndexPath * indexpath = [NSIndexPath indexPathForItem: & lt; # (NSInteger) # & gt; insection: & lt; # (NSInteger) # & gt;];

Simply provide the line and section number in this method. Then use that index to get the cell using the method below

  UICollectionViewCell * cell = [collectionView1 cellForItemAtIndexPath: indexPath];   

Then you can reach the properties of the cell.

Comments

Post a Comment

Popular posts from this blog

Pass DB Connection parameters to a Kettle a.k.a PDI table Input step dynamically from Excel -

multithreading - PhantomJS-Node in a for Loop -

c++ - MATLAB .m file to .mex file using Matlab Compiler -