简体   繁体   中英

xCode 4.2 iOS5 interfaceBuilder cannot tap on a button that is laid out in the IB

I've ran into a weird issue lately:

I have a 320 x640 UIView within a UIScrollView. I've manually positioned buttons throughout the view and assigned actions to them. One of the buttons has a center at [x,y]: [287,440]. The button is 60x60.

I can tap all other buttons and controls located as low as Y = 353.

I see that the button is located on the same level as all of my other buttons, within the same view as them.

What could be causing my button to be completely untappable? I have another controller, which is also "tall", and there buttons located "off screen" are tappable. [If I move the button up to the level of other buttons, it works as expected.]

Here's the scroll view code:

  self.scrollView.contentSize=CGSizeMake(320, 640);

Something is covering it. Try looping over all subviews and printing origin.y relative to scrollview origin.y, and then height plus relative position. Do this in viewWillAppear. Be aware that autoresizing behavior can kick in right after viewDidLoad and fool you. That is what happened to me earlier. There will be an overlap somewhere.

Can post code example later from home if this doesn't get you through it.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM