Re: How does a UIButton perform a seque?
Re: How does a UIButton perform a seque?
- Subject: Re: How does a UIButton perform a seque?
- From: Rick Aurbach <email@hidden>
- Date: Thu, 26 Jun 2014 00:48:09 -0400
- Acceptlanguage: en-US
- Thread-topic: How does a UIButton perform a seque?
Rick,
Another approach which I’ve used upon occasion is to give each button a unique tag value when setting up the collection view. (I.e., you set the button’s tag in -collectionView:cellForItemAtIndexPath:) Then sender.tag tells you what you want to know. Since the controller that sets up the collection view is likely to be the one which receives the -prepareForSegue, it should know the tag encoding it set when the cells were created. All knowledge of what is what is localized in the managing controller and no special knowledge is required.
Cheers,
Rick Aurbach
Aurbach & Associates, Inc.
On Jun 25, 2014, at 6:48 PM, email@hidden wrote:
> Message: 1
> Date: Wed, 25 Jun 2014 14:44:11 -0700
> From: Rick Mann <email@hidden>
> To: Cocoa Developers <email@hidden>
> Subject: How does a UIButton perform a segue?
> Message-ID: <email@hidden>
> Content-Type: text/plain; charset=us-ascii
>
> I added a UIButton to a UICollectionViewCell in IB, and then dragged a segue from that to another scene. The problem I need to solve is for that destination view controller to know which represented object was associated with the cell in which the source UIButton was. But I can't see how to do that.
>
> One approach is to trigger the segue programmatically from the Cell subclass, but you can't do that without knowing the view controller. How does the button do it?
>
> I can think of a few other approaches, but they're all kinda gross. Any recommendations? I want to present a modal form sheet (iPad) when a button inside the UICollectionViewCell is tapped without doing the normal segue that happens when any other part of the cell is tapped (to allow the user to edit metadata for that item without opening the full UI for that item).
>
> TIA,
>
> --
> Rick
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden