Is is possible to have buttons clickable outside safe area (btw how is it called? nonsafe area?)? I have buttons like in screenshot and highlight area where my app doesn't recognize touch (it's screenshot from simulator iPhone XR, there is notch but it's not visible in screenshot):
I know that some systems buttons are clickable in that area but I don't know why mine isn't.
From my experience, buttons do not respond to touches outside of the safe area. And this is for a good reason. Areas outside of the safe area are reserved for iOS system user interface, like displaying the time, battery level, and your cellular signal strength.
Apple advises to account for safe area insets when laying out your UI elements.
Try running this project on a device like iPhone X or iPhone 11 to test it out: https://github.com/ChopinDavid/safearea
Related
So I'm trying to update my app for the iPhone X (a little late to the game, I know), and I enabled safe area, and fixed (supposedly) all my constraints to match. It looks perfect on the iPhone X. But for some reason, on all other iPhones, it still accounts for the iPhone X's notch, despite Safe Area correctly displaying where the UI should start and end. I'm at a loss. None of the constraints in question are hard coded, I set them all to the "standard" value (or so I believe).
storyboard (first button is actually the talk bubble, which is just a static image, second is the paw print, which is an actual button)
messed up iPhone 8 (bubble and ui elements should be at very top and bottom)
Here's my storyboard file: https://ufile.io/35zvs
UPDATE: image for ercell0
You are using standard spacing for top and bottom for your Banner View with a required priority. try setting this to superView: 0 or safeArea: 0 and see if that corrects the issue for you.
The updated view:
Can you change ViewAs from iPhoneX to iPhone8, and attach an image?
Other iphones your are testing on are running iOS11 or older?
If running older versions, safe-area won't be able to help with the alignment. For pre iOS11, use the constraints you were using previously or Layout Anchors.
With the new iPhone X coming, are there any UI or UI Api changes required to fully support the iPhone X?
Are there any API changes that might affect the UIStatusBarStyle / UINavigationBar / UINavigationItem / UITabBar etc.
The only significant change I see is the larger display of 145pt longer.
The only information I could find is the Apple: Human Interface Guidelines
located here:
https://developer.apple.com/ios/human-interface-guidelines/overview/iphone-x/
For native IOS app the support is already given and all the info is available on full screen(18:9). Lots of app instead still need to fully support the new format so info available on 16:9 ratio
In order to get full-screen applications you will need to recompile your apps with IOS 11 / Xcode 9.
If you use Standard UI controls you should be safe. If you use Autolayout you can utilise the new "safeAreaLayoutGuide" which will then basically help your ui design to respect the iPhoneX view port.
I found this Transcript from Apple located here: https://developer.apple.com/videos/play/fall2017-801/?time=126
"On iPhone X, people access the app switcher (indicated by the red arrow) and the Home screen by swiping up anywhere along the bottom edge of the display. An indicator at the bottom of the screen offers a hint about this interaction.
This indicator is displayed over your app's interface. You'll need to account for this when designing your app. If your app uses UIKit controls and auto-layout, designing and developing for iPhone X and our other devices should be straightforward. Standard UIKit elements such as navigation bars, tables, and collection views, automatically adjust when viewed on iPhone X. Navigation bars, tab bars, and toolbars are positioned and scaled appropriately on all iOS devices. The navigation bar's background material is extended to the display's top edge, and the background material of the tab bar and toolbar is extended to the bottom, while the elements they contain are positioned to prevent underlapping or clipping by other elements."
Basically if you use standard UIKit you have nothing to worry about.
Although Apple recommends: "Make sure that your UI displays correctly and no elements are mispositioned, overlapping, incorrectly scaled, or clipped"
If you discover issues, use the safe area guides and layout margins to correctly position UI elements.
In my iOS app, I just want to have a button located in the middle of screens of multiple devices (like iPhone 6, iPhone SE, iPad Air).
However, surprisingly, it seems not intuitive to do (at least not as Android) in XCode + Xib.
Following shows a trivial example of this problem where I put the button aligned to the middle:
However, unless the "dimension" of the view is set identical to fit the installed device, there is no way to display the button in the middle.
Add horizontal and vertical center constraints as follows and it will always keep your button at center of any screen as shown in the image below
You can also add distance constraints to borders of the screen :
Example
I am making an app that has two buttons on the main screen. I have used auto layout and placed constraints that fit my needs for the app. On all iPhones but the 4s, both of the UIButtons show up, but on the 4s, one does while the other doesn't. Here are two photos of the simulator.
iPhone 5s:
iPhone 4s:
As you can see, the "Log In" button on the 4s has no background. It is impossible to click on it. Any help in fixing this issue would be greatly appreciated.
As you are saying that it is impossible to click it in 4S (and it is possible in 5S etc.) that means that the real button is missing from 4S.
If you have a label and a background white rectangle or second label as the real button, then you might miss some constraints for this rectangle/label.
It appears that it is not centered horizontally related to the content view or related to the text label "Log in" (so it is lost in the far left or right of the view). Another possibility is that the width or hight becomes 0 due to missing constraint. If these options do not help, you may share your storyboard if you wish and especially the outline view, in order that you get more help from the community.
I am working on an app and have come into some graphical problems when designing my app.
First off, my app is only support by iPhone. My current storyboard is using the iPhone 5 as the screen size, so everything screws up when I try to run in iPhone 4 and 4S. Is there a way to make multiple storyboards for each different screen size? Or do you all have another solution?
Thanks!
- Brad
There is a way to make different storyboards for separate screen sizes, but another way to do it is like this:
Whenever you add objects to your views, be sure to have them aligned to something (using constraints). If all items are relative to other items, then most likely the layout will be fine on all devices. Also, if you find that your controls start overlapping, then perhaps you ran out of room. In that case simply add a scroll view to your layout, and then put the controls on top of it. Then, it won't scroll on the larger screens because all controls are shown, but on smaller devices it will allow you to scroll down to see the rest of the objects.
Good luck.
There is a small button in the lower right hand corner that lets you toggle between 3.5" and 4" screen sizes so you can see how it will look on different devices. By using Auto Layout introduced in iOS 6 you can make sure to set up your constraints so that your UI looks good on both older and newer iPhones.