My button doesn't detect touch events on iPhone (Retina 4-inch) simulator, but works in iPhone (Retina 3.5-inch) simulator
Asked Answered
E

5

20

I'm getting my app ready for the iPhone 5 using the simulator and I've found a weird issue where a couple of my buttons, in one of my views, don't work in the iPhone (Retina 4-inch) simulator, but work fine in the iPhone (Retina 3.5-inch) simulator. The buttons simply don't do anything when they're tapped. Has anyone else experienced this issue?

I having a difficult time figuring out where to start with this one. Any suggestions on where to start?

Thanks so much in advance for all your wisdom!

Enjoyment answered 19/9, 2012 at 19:59 Comment(4)
Just a guess, but did you check that no transparent views overlap the buttons? Maybe springs and struts did not do what you expected with the iPhone 5's screen resolution.Denbighshire
I am facing the same issue. In my case the bottom region (probably the extra .5inch) is not responsive. Tab bar buttons placed there won't work, trying to flick scroll a UITableView from that region also doesn't work. Are your buttons positioned in the bottom region as well?Livesay
@pennersr: did you try this? it didn't help me any, but hopefully it'll help you. #12415317Enjoyment
Check your compression resistance ratios are set to value of 1000 each for vertical and horizontal so that buttons are truly on screen.Traver
E
4

The problem was caused by another control overlapping my buttons due to the way the springs and struts were setup. Adjusting the z-order of the buttons fixed the issue. Thanks, all!

Enjoyment answered 19/9, 2012 at 21:18 Comment(0)
G
32

You need to edit your MainWindow.xib and enable "Full Screen at Launch". For a more detailed explanation, see Apple's docs:

Important: When creating your window in Interface Builder, it is recommended that you enable the Full Screen at Launch option in the attributes inspector. If this option is not enabled and your window is smaller than the screen of the target device, touch events will not be received by some of your views. This is because windows (like all views) do not receive touch events outside of their bounds rectangle. Because views are not clipped to the window’s bounds by default, the views still appear visible but events do not reach them. Enabling the Full Screen at Launch option ensures that the window is sized appropriately for the current screen.

Complete document from Apple

Goodale answered 31/10, 2012 at 0:9 Comment(3)
The tabbar in my app didn't action touch events on the 4". This fixed it... thanks.Waylon
I can understand why Apple doesn't have "Wants Full Screen" checked on the rootViewController, however I can't figure out why "Full Screen at Launch" isn't checked by default now that they've changed the screen size. I had a tabBar disabled in iOS 6.1 as well.Outlast
Thanks! I have been looking for a solution for two days.Epiboly
L
8

For me, the solution was to set the size ("Simulated Metrics") to "Retina 4 Full Screen" for the MainWindow.xib. I did not need to alter the size of the other screens (they are still set to None). After changing the MainWindow.xib the bottom area becomes clickable again...

Livesay answered 19/9, 2012 at 20:30 Comment(2)
Be careful of doing this. This will actually mask the problem as it only enables touch events on the full screen in the simulator. On a real device, the touch events will still not work unless you enable the Full Screen at Launch option in your MainWindow.xib. See my answer for a more complete explanation.Goodale
This does not work correctly, as it will only change the view size. Things may not resize correctly with on a 3.5 inch screen. The best option is to enable "Full Screen at Launch" for the main window.Lonnylonslesaunier
E
4

The problem was caused by another control overlapping my buttons due to the way the springs and struts were setup. Adjusting the z-order of the buttons fixed the issue. Thanks, all!

Enjoyment answered 19/9, 2012 at 21:18 Comment(0)
S
4

There are two solution to this problem :

If you are using MainWindow follow these steps :

a. Select MainWindow.xib.

b. Select Full Screen at Launch from Windows option available in Attributes Inspector.

If your application doesn't contain MainWindow then just add:

self.view.frame = [UIScreen mainScreen].bounds

in ViewDidLoad.

Soupandfish answered 18/4, 2013 at 10:8 Comment(0)
I
1

I solved my prob.

view .origin for 3.5 inch and 4 inch screen are different so, when writing common code for both we need to take care at giving CGRectmake(x,y,w,h);

Set temp. diff background color of diff view so you can check if any view is overlapping or not, to fetch event in 4.0 inch.

Internist answered 15/4, 2013 at 6:28 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.