Yes. However you may want to use code that looked better. My code is a little bit obfuscated.
Sent from my iPhone > On Jun 26, 2014, at 7:46, Rick Mann <rm...@latencyzero.com> wrote: > > Yeah, maybe that's not an unreasonable way to do it. Thanks. > >> On Jun 25, 2014, at 16:40 , ChanMaxthon <xcvi...@me.com> 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 >>>> <quinceymor...@rivergatesoftware.com> wrote: >>>> >>>> On Jun 25, 2014, at 16:06 , Rick Mann <rm...@latencyzero.com> 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 (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/xcvista%40me.com >>> >>> This email sent to xcvi...@me.com > > > -- > 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