Re: Custom UIView receiving no touch events?
Re: Custom UIView receiving no touch events?
- Subject: Re: Custom UIView receiving no touch events?
- From: Eric Dolecki <email@hidden>
- Date: Wed, 07 Oct 2015 01:00:37 +0000 (UTC)
Oops about the off list. I ended up just doing an Init with frame and then brought existing storyboard views up in the view hierarchy. The only reason I wanted to assign the class to an existing view on the storyboard was because I could ensure the z-order visually.
Sent from Outlook
On Tue, Oct 6, 2015 at 5:56 PM -0700, "Quincey Morris" <email@hidden> wrote:
On Oct 6, 2015, at 16:48 , Eric Dolecki <email@hidden> wrote:
I had a UI view on the storyboard and set its class to my custom UI view class. Init with coder fired and I set my UI from there. However doing so produced dead controls. Does one need to call a method to get around that problem?
(you went off-list, accidentally I assume)
You got to ‘initWithCoder’ because your storyboard is a collection of NIBs, and loading the storyboard involves loading the NIBs. However, a random UI view in the storyboard will be in its own scene, and you’d need to *present* the scene to get it to behave as proper UI. Normally that’s done with a segue, but you don’t want one of those here.
I don’t know if there’s a better way, but I’d suggest you put the custom view in the view hierarchy under the main view controller, and either make it hidden or set its alpha to 0. Either of those things should make it ignore events until you’re ready to programmatically reverse isHidden or set alpha to 1.
Or you could create the custom UIScrollView programmatically when needed, and insert it temporarily into the main view hierarchy.
Something like that.
_______________________________________________
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