Re: How does a UIButton perform a segue?

2014-06-25 Thread Alex Zavatone
Looks like you're going to have to figure out how view controllers do it. I seem to recall Mike Ash doing a lot of "recreating this iOS class" blog entries like this: https://mikeash.com/pyblog/friday-qa-2013-02-22-lets-build-uitableview.html But I don't see a reconstruction of UIViewController

Re: How does a UIButton perform a segue?

2014-06-25 Thread Rick Mann
On Jun 25, 2014, at 17:20 , Roland King wrote: > My bug requesting that the current firstResponder be made available as a > property on UIApplication remains duped and open after 3 years. Or at least a -sendToFirstResponder... Sigh. Thanks! -- Rick _

Re: How does a UIButton perform a segue?

2014-06-25 Thread Roland King
On 26 Jun, 2014, at 8:15 am, Rick Mann wrote: > > On Jun 25, 2014, at 17:10 , Roland King wrote: > >> If there's a UIViewController somewhere, it's in the responder chain. I >> would expect the UIButton, when hooked up in IB, just walks up that looking >> for the view controller. > > So th

Re: How does a UIButton perform a segue?

2014-06-25 Thread Rick Mann
On Jun 25, 2014, at 17:10 , Roland King wrote: > If there's a UIViewController somewhere, it's in the responder chain. I would > expect the UIButton, when hooked up in IB, just walks up that looking for the > view controller. So that brings up an unanswered question from yesterday. How can I

Re: How does a UIButton perform a segue?

2014-06-25 Thread Roland King
On 26 Jun, 2014, at 7:58 am, Rick Mann wrote: > Yes, I know all of that. > > Here's why I asked the question in the subject: A UIView cannot, by itself, > perform a segue (at least, I don't know how). A UIViewController can do that. > > Which is why I was asking how a UIButton does it (when y

Re: How does a UIButton perform a segue?

2014-06-25 Thread Rick Mann
Yes, I know all of that. Here's why I asked the question in the subject: A UIView cannot, by itself, perform a segue (at least, I don't know how). A UIViewController can do that. Which is why I was asking how a UIButton does it (when you wire it up in IB). Then in my -stuffToDo:, I could perfor

Re: How does a UIButton perform a segue?

2014-06-25 Thread Alex Zavatone
A UIButton "can" perform a segue without any code, but this will make life suck for you and confusion will be your best friend for a long time. A UIButton should be declared as an "IBOutlet" property. This essentially means nothing, but tells you, the developer, that this property is an Interfa

Re: How does a UIButton perform a segue?

2014-06-25 Thread ChanMaxthon
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 wrote: > > Yeah, maybe that's not an unreasonable way to do it. Thanks. > >> On Jun 25, 2014, at 16:40 , ChanMaxthon wrote: >> >> Something

Re: How does a UIButton perform a segue?

2014-06-25 Thread Rick Mann
Yeah, maybe that's not an unreasonable way to do it. Thanks. On Jun 25, 2014, at 16:40 , ChanMaxthon 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

Re: How does a UIButton perform a segue?

2014-06-25 Thread ChanMaxthon
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 >

Re: How does a UIButton perform a segue?

2014-06-25 Thread Quincey Morris
On Jun 25, 2014, at 16:06 , Rick Mann 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

Re: How does a UIButton perform a segue?

2014-06-25 Thread Rick Mann
On Jun 25, 2014, at 16:05 , Quincey Morris wrote: > On Jun 25, 2014, at 16:00 , Rick Mann wrote: > >> The button is the sender. But there's no way to determine in which cell that >> button is. > > Sure there is. Walk up the tree of superviews from the button till you find > the enclosing c

Re: How does a UIButton perform a segue?

2014-06-25 Thread Quincey Morris
On Jun 25, 2014, at 16:00 , Rick Mann wrote: > The button is the sender. But there's no way to determine in which cell that > button is. Sure there is. Walk up the tree of superviews from the button till you find the enclosing cell. ___ Cocoa-dev m

Re: How does a UIButton perform a segue?

2014-06-25 Thread Rick Mann
On Jun 25, 2014, at 15:58 , Quincey Morris wrote: > On Jun 25, 2014, at 14:44 , Rick Mann wrote: > >> 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

Re: How does a UIButton perform a segue?

2014-06-25 Thread Quincey Morris
On Jun 25, 2014, at 14:44 , Rick Mann wrote: > 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. Doesn’t ‘prepareForSegue:’ give you the informa

How does a UIButton perform a segue?

2014-06-25 Thread Rick Mann
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 t