Re: How does a UIButton perform a segue?
Re: How does a UIButton perform a segue?
- Subject: Re: How does a UIButton perform a segue?
- From: Rick Mann <email@hidden>
- Date: Wed, 25 Jun 2014 16:46:52 -0700
Yeah, maybe that's not an unreasonable way to do it. Thanks.
On Jun 25, 2014, at 16:40 , ChanMaxthon <email@hidden> wrote:
> Something like this:
>
> id cell = button;
> for(; cell && ![cell isKindOfClass:[UITableViewCell class]]; cell = [cell superview]);
>
> When this loop exits you get either the cell or nil indicating that the button is not inside a cell.
>
> Sent from my iPhone
>
>> On Jun 26, 2014, at 7:18, Quincey Morris <email@hidden> wrote:
>>
>>> On Jun 25, 2014, at 16:06 , Rick Mann <email@hidden> wrote:
>>>
>>> Well, I suppose, but that sort of forces the -prepare method to know a lot about the view hierarchy. I'd rather not do that.
>>
>> Your original question was about finding the cell for the button. Therefore, it’s already implicit in your approach that the view controller doing ‘prepareForSegue:’ knows that the button is in a table view, hence in a cell, hence a subview of the cell. There’s no special-case knowledge involved there.
>>
>> The view controller doesn’t need to know in advance how many steps up there are from the button to the cell, if that’s what’s worrying you. You can use one of those loopy things to find the cell. ;)
>>
>> _______________________________________________
>>
>> 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
--
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