• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: How does a UIButton perform a segue?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How does a UIButton perform a segue?


  • Subject: Re: How does a UIButton perform a segue?
  • From: ChanMaxthon <email@hidden>
  • Date: Thu, 26 Jun 2014 07:40:43 +0800

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

_______________________________________________

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


  • Follow-Ups:
    • Re: How does a UIButton perform a segue?
      • From: Rick Mann <email@hidden>
References: 
 >How does a UIButton perform a segue? (From: Rick Mann <email@hidden>)
 >Re: How does a UIButton perform a segue? (From: Quincey Morris <email@hidden>)
 >Re: How does a UIButton perform a segue? (From: Rick Mann <email@hidden>)
 >Re: How does a UIButton perform a segue? (From: Quincey Morris <email@hidden>)
 >Re: How does a UIButton perform a segue? (From: Rick Mann <email@hidden>)
 >Re: How does a UIButton perform a segue? (From: Quincey Morris <email@hidden>)

  • Prev by Date: Re: How does a UIButton perform a segue?
  • Next by Date: Re: How does a UIButton perform a segue?
  • Previous by thread: Re: How does a UIButton perform a segue?
  • Next by thread: Re: How does a UIButton perform a segue?
  • Index(es):
    • Date
    • Thread