Re: Custom UIView receiving no touch events?
Re: Custom UIView receiving no touch events?
- Subject: Re: Custom UIView receiving no touch events?
- From: Quincey Morris <email@hidden>
- Date: Tue, 06 Oct 2015 17:56:40 -0700
- Feedback-id: 167118m:167118agrif8a:167118scioCoRhK1:SMTPCORP
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