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, cocoa-dev-requ...@lists.apple.com wrote:

> Message: 1
> Date: Wed, 25 Jun 2014 14:44:11 -0700
> From: Rick Mann <rm...@latencyzero.com>
> To: Cocoa Developers <cocoa-dev@lists.apple.com>
> Subject: How does a UIButton perform a segue?
> Message-ID: <5e9d5d0d-dfb5-4376-b62a-11f5d59b6...@latencyzero.com>
> 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 (Cocoa-dev@lists.apple.com)

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to