In my program I have configured a UIView to be placed over a number of UIBUttons. This is so you can pan across the view and have the buttons move over as well as selecting the buttons themselves. However, it is not possible to select the buttons when they are underneath this UIView. Does anybody know how to configure a UIButton‘s userInteractionEnabled while it is under these conditions?
In my program I have configured a UIView to be placed over a number
Share
This technique has worked for me – caveat: I just typed this in it’s not compiled or nuthin it’s given as a starting point.
When creating the buttons – keep a reference to them in an array.
NSMutableArray* arrayOfPeskyButtons;
Keep a record of the button frames
When your app responds to an action on the UIView – panning or if you change it to a UIScrollView (probably best btw), then move the frame of the buttons correspondingly so that they appear fixed in place to the user.
I have used this technique to create ‘overlays’ of buttons which sit on top of scrollviews and it works surprisingly well. Simply in the scrollView delegate method.
take note of the scrollviews offset and adjust each of the frames of the buttons accordingly depending on the offset of the scrollView
Iterate through the array of buttons and move them.