iphone-x

iPhone-X - How to force user to swipe twice home indicator to go home-screen

大城市里の小女人 提交于 2019-12-03 02:58:49
I'm using the code below to hide the home indicator on iPhone X, which is working fine in the emulator. -(BOOL)prefersHomeIndicatorAutoHidden { return YES; } But even though it's hidden, I am still able to swipe up from the bottom and my game goes to the home screen. I have seen a few games where the user has to swipe up once to bring up the home indicator and swipe up again to go to the home screen. So, how can I force the user to swipe the home indicator twice to go to the home screen in iOS 11 with Objective-C? This behavior is required for full-screen games. filo I had the same problem .

iPhone X keyboard appear showing extra space

人盡茶涼 提交于 2019-12-03 01:30:43
I have created a chat UI in which I have added a constraint for the tableView to the bottom of the screen. I am changing the constraint value by adding the height of the keyboard which is working fine in all the devices except iPhone X. UI when key board is not visible: Which is fine. Problem is when keyboard appears blank space is visible in between the textView and the keyboard: Do I have to try for a different approach for this or it can be resolved using constraints ? Try subtracting the height of the safe area's bottom inset when calculating the value for your constraint. Here is a sample

How to programmatically detect iPhone XS or iPhone X? [duplicate]

夙愿已清 提交于 2019-12-03 00:45:47
This question already has an answer here: Detect if the device is iPhone X 34 answers One of my apps connects to a web app service that delivers device specific news to to the user. To adapt this to the latest iPhone versions I need to programmatically distinguish between the iPhone XS and iPhone X. How can this be done? [[UIScreen mainScreen] bounds].size was always a good starting point to tell the different devices apart. However, iPhone XS and iPhone X have the same screen dimensions: 1125 x 2436. Thus using [[UIScreen mainScreen] bounds].size does not work in this case. Is there any other

Background image stretching in iPhone X

余生颓废 提交于 2019-12-02 17:42:04
问题 Currently we are using image asset with @1x, @2x and @3x which will support for all devices. But when we use the same image asset for iPhone X, the @3x image looks stretched in iPhone X. So please let me know how to support for the iPhone X device with the same image asset or is there any solutions available to overcome this issue. 回答1: An alternative is to select Aspect Fill . Then lower down in attribute inspector select Clip to Bounds . The image will fill your UIIMageView, but based on

iPhone X hide home indicator on view controller

北城以北 提交于 2019-12-02 17:04:13
I have a view controller that takes up the whole screen from top to bottom. I would like to hide the home bar indicator on the bottom of the screen on iPhone X devices. How can I do this in iOS 11? You should override prefersHomeIndicatorAutoHidden in your view controller to achieve that: override var prefersHomeIndicatorAutoHidden: Bool { return true } There is another alternative. If you are looking for the behavior where the indicator dims, then when the user swipes up it activates, and when they swipe up again the home action is invoked (I.E., two swipes are needed to invoke), then the

UICollectionView in landscape on iPhone X

爷,独闯天下 提交于 2019-12-02 16:36:38
When iPhone X is used landscape, you're supposed to check safeAreaInsets to make suitably large gutters on the left and right. UITableView has the new insetsContentViewsToSafeArea property (default true) to automatically keep cell contents in the safe area. I'm surprised that UICollectionView seems to not have anything similar. I'd expect that for a vertically-scrolling collection view, the left and right sides would be inset to the safe area when in landscape (and conversely, a horizontally-scrolling collection view would be inset if needed in portrait). The simplest way to ensure this

Extra bottom space/padding on iPhone X?

末鹿安然 提交于 2019-12-02 16:34:58
On the iPhone X in portrait mode, if you set a bottom constraint to safe area to 0, you will end up with an extra space at the bottom of the screen. How do you get programmatically the height of this extra padding ? I managed to manually determine the height of this padding which is 34 and here is how I managed to implement it with iPhone X detection: Swift 4.0 and Xcode 9.0 if UIDevice().userInterfaceIdiom == .phone { switch UIScreen.main.nativeBounds.height { case 2436: //iPhone X self.keyboardInAppOffset.constant = -34.0 default: self.keyboardInAppOffset.constant = 0 } } Is there a cleaner

why I see white white area in the bottom of my iPhoneX simulator?

*爱你&永不变心* 提交于 2019-12-02 01:47:34
问题 I have read some answer in the stackoverflow like this one Seeing black bars at the top and bottom of the iPhone X Simulator , but it seems little bit different since my issue only happens only in the bottom area of my screen as we can see, there is a white area in the bottom of my loginVC. I want my UIImage (background image) to cover that white screen area. i have set the image bottom constraint of the UIImage to the safe area like below I have also used "use safe area layout guides" what

iPhone X - Safe Area does not achieve full-screen experience?

蹲街弑〆低调 提交于 2019-12-01 17:52:05
The new HIG for iPhone X available here , specify: "Provide a full-screen experience. Make sure backgrounds extend to the edges of the display, and that vertically scrollable layouts, like tables and collections, continue all the way to the bottom." Now I'd like to understand how to accomplish that with Xcode 9 GM, since it seems to me that the only view allowed to extend to the whole screen is the UIViewController root view, and that whenever I try to drag constraints for a view above that, i.e. WKWebView to the root view, the constraints get actually connected to the safe area, leaving both

iPhone X - Safe Area does not achieve full-screen experience?

孤街浪徒 提交于 2019-12-01 17:06:48
问题 The new HIG for iPhone X available here, specify: "Provide a full-screen experience. Make sure backgrounds extend to the edges of the display, and that vertically scrollable layouts, like tables and collections, continue all the way to the bottom." Now I'd like to understand how to accomplish that with Xcode 9 GM, since it seems to me that the only view allowed to extend to the whole screen is the UIViewController root view, and that whenever I try to drag constraints for a view above that, i