Is the iPhone touch surface larger than the screen? - ios

[I have a weird iPhone bug, only tested on an iPhone 5S.]
My app has two panes, each of width 320px. When the right pane is fully visible (and the left pane fully hidden), I can sometimes tap a button on the left pane. This button touches the left pane's right border. It is hard to trigger the bug, the trigger surface seems to be on the edge of the phone.
If the iPhone 5S touch surface is no larger than the 320px screen, this should not be possible.
Is the iPhone 5S touch surface larger than the 320px screen? I.e., do the iPhone 5S screen edges have a few extra pixels of touch sensitivity?

It's a problem with your interface, not the hardware. The touchable bounds region of the button may be bigger than the apparent visible drawing of the button. Thus, it may be invisibly sticking into your screen from the left. To confirm this, try making the invisible visible, by giving the button a background color that shows its actual dimensions.
Oh, one more thing. You may be positioning your panes off by one pixel. That would be enough to bring one pixel width of the button onto the screen - and thus would make it, with difficulty, tappable.
Since both panes will never be visible simultaneously, why not avert this entire issue by adding some space between the panes?

You can check pane (button) location by printing it's frame into console. Now you know for sure, if button edge is on-screen or not:
NSLog(#"%#", NSStringFromCGRect(button.frame));
Btw I'm wondering, if this could be related to iOS7 feature "(New gesture - Swipe left to right - as shortcut for Back button in UINavigationController in old app)"?

Related

Dragged all controls on swift storyboard down from screen top but when run they are back at top of screen

I've tried dragging all the controls at once or singly from top of screen in storboard down to lower half of screen. But when I run it they all are at top of iphone screen.
I have iPhone 10 and selected iPhone 11 in xcode.
pict shows after I dragged them all downward.
(also, what's that smaller image of the screen in the upper right? When I hover mouse over it, no information; just Mickey Mouse hand (I guess for while there Steve Jobs owned Disney))
This is the complete project from github <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
Your storyboard uses autolayout. That means that the positions / sizes of views are determined by their constraints.
Dragging views around physically on the canvas has no ultimate effect, except that now, because your apparent positions do not match the position at runtime, you get a "misplaced views" warning (which you are apparently ignoring or you wouldn't be asking this question).
also, what's that smaller image of the screen in the upper
That's the Minimap.

Align navigation buttons on all devices

As you can see on the picture, the bar on the bottom is using 5 different buttons (the icons). When I run my program with an iPhone 5s everything works fine. But on other devices such as the iPhone X, etc., the images floats to the left side. Does anyone know how I can add constraints to the buttons to make them stay where they are on all devices?
UPDATE:
So, if you see the navigation-bar from the iPhone 5s, you see it's like "perfect" aligned to each other. And that's how I want them to be on ALL devices. If you take a look on the iPhone XS you can see that all the buttons is to the left. I also added "Flexible Space Bar Button Item" between all of the buttons, and it was a lot better, but they "Doghead" is not in the center of the phone, which I want.
You need to add a UIBarButtonItem with a system type of .flexibleSpace between each of your other buttons. This will force all of the buttons to be equally spaced across the width of the toolbar. To ensure that the middle button ends up in the center of the toolbar, all of the images need to be same width.
If you want all of the buttons grouped together in the center of the toolbar, then just add a flexible spaced item before the first button and another after the last button.

iOS AutoLayout - Button moves when app is launched

I will try to describe this issue--never seen this behavior before.
I have a button that moves from the right of the app's screen to the middle when the app launches on the simulator or actual device. I want it to always be in the middle (where it moves to).
Basically, it moves from one position on the parent view to another position (I want it to ALWAYS be in the position defined by the constraints)
How do I accomplish this?
Here are images to show the behavior and the constraints:
Button is on the right, higher up; then fades out
Button fades in to the bottom, centered position (correct per constraints listed below)
Button constraints:
Button.centerX = centerX (center the button to the container's horizontal center)
Bottom Layout Guilde.top = Button.bottom + 112 (anchor the button to the bottom of the app regardless of screen size or orientation).
Just add two constraints BottomSpace and CentreX as below. (And if required explicit height and width)
1.Also provide button.left.
Or
2. Use constraints show in image.
OK, I fixed the issue. Somehow, the splash screen storyboard got a copy of the button and other views that i had on the main storyboard. Once I deleted the button from the splash screen story board, the button issue stopped.
Apparently the first screen shot was the splash screen, and the second screen shot was the actual app (main storyboard).
Thanks to everyone for trying to help!

Custom UIButton alignment with respect to background image issues in xcode 5 on iPhone 4s and 5 - addition of constraints does not fix the issues

I am having issues with UIButton with background images. When clicking on a button when running the code in simulator and in iPhone 4s and 5, a button seems to be selected even when I press an area outside the button
I have a very simple UI with an image, followed by another image (Login), followed by 3 custom buttons (Facebook, Email and Signup) and an image after that at the very bottom.
Note -
1. I have each button size (width and height) equal to the size of the background image. So if the background image is say 100 by 20, the button would be 100 by 20. Also, I have Autolayout checked and the image to AspectFill the UIButton in the IB.
I have a UIView within the Superview. All the UI elements (images, UIbuttons with background images) are placed in the UIView.
I have constraints on the UIView for width and height, so that it remains the same in iPhone 4s and 5. I also have constraints to ensure that the UIView is horizontally and vertically centered.
Within the view, I have constraints on each UI element's (images and UIbuttons with images) width and height, so that it remains the same in iPhone 4s and 5. I also have constraints on each elements Y location. So, I have a constraint that the first image is X distance from the UIView's top line. Then, I have a constraint that the first button is Y distance from the image on top. Then, I have a constraint that the second button is Z distance from the first button above it. I, then, have a constraint that the bottom-most label is A distance from the bottom line of the UIView. And I have a constraint that the third button is B distance above the bottom-most label. The idea is to ensure that all these elements are in the center of the screen in iPhone 4s and iPhone 5 (since the UIView will move to the center due to the constraints on it and the UI elements within it will move to the center along with it since their constraints are relative to the UIView).
The project supports iOS 6, 6.1 and 7.
I started developing and testing using iPhone 4s. The buttons seemed to be working fine on it. Then I connected iPhone 5 and, on compiling, I found that the buttons' clickable area and the buttons' background image did not overlap anymore. I re-connected iPhone 4s, cleaned the project, built it again and ran it (both on the simulator and on the device) to find that the buttons did not work anymore. On clicking on an area outside the button, the buttons were getting selected. What was also strange was that in some cases, when I touched a button (ie. Facebook), the button below it (i.e. Email) was getting selected.
So, in summary, it worked fine in iPhone 4s. On connected, iPhone 5, it seems that the buttons stopped working properly. On reconnecting iPhone 4s, the buttons no longer functioned properly. I tried removing all the UI elements and restarting the build (in same view controller in the same storyboard), tried creating a brand new view controller in the same storyboard, but with no luck. I have had to start the project all over again to have it function in iPhone 4s. So, to me, it seems that something is corrupting the storyboard, to an extent that it cannot be fixed again!
I have highlighted the UIView in gray for your reference.
Please see the images for reference -
Basic screen with UIView grayed out and no touch
Basic screen with UIView grayed out and trying to click Facebook button -
Basic screen with UIView grayed out and trying to click on the non-clickable image below the Signup button -
Not sure if anyone has faced such problems But, I would love to understand it and fix it now since it is a reoccurring issue and do not want to face it when most of my project is complete as it seems to completely corrupt the storyboard, leaving me to start the project all over again!
Please help.
Did you try calling sizeToFit method on all the buttons?

Legacy iOS app not stretching properly

I have a layout issue. I'm trying to make a legacy 3.5in app work on iPhone 5. As soon as I give it the Default-568h#2x.png splash image, the whole app gets aligned to the top of the screen, leaving a huge white gap at the bottom. The autosizing struts and such seem to be set properly (not using Autolayout at the moment), but the thing doesn't stretch to fill the screen. I'm not sure where to look next. I just want my poor tab bar to be at the bottom!
Since you're not using AutoLayout, now is a great time to start. Xcode 5 makes setting constraints a simple exercise.
I suspect that your tab bar frame is hard-coded to certain x, y, width, height coordinates which work well on the 3.5" screen. You can also see how your view renders on taller screens by pressing this button in the Xcode 5 Interface Builder:

Resources