I am a definite beginner to iPhone programming. I have two simple questions.
1) I thought UIView would respond to touches like a UIButton but it appears I have to sub-class it. I’m not quite there yet. So my dirty little solution has been to place a UIButton over everything, make it full-screen, and turn off any color changes when it’s pressed or disabled and so on. This works great, my app now responds to any part of the screen and it doesn’t look like a button is being pressed. So the first part of my question is this: is this bad? If so, why?
2) Well nearly any part of the screen responds. For some reason, the very bottom 5% or so of the display doesn’t respond to the touch and I’ve no idea why. The button is stretched down to the bottom and there’s nothing else down there to intercept the touch. Any ideas?
Thanks!
To capture touches, you simply need to implement whichever of the following methods you require within a view controller – using a UIButton for this is (at best) somewhat perverse and will end up limiting the type of functionality you can provide.
For more information on these events, see the UIResponder class reference.
In terms of your second point – I’ve personally noticed a small “dead zone” towards the bottom of the display (the home button being the “bottom”) – I think this is just the nature of the display, but I must confess I’ve never really looked into it in any detail.