safearealayoutguide

Swift 4.2 SafeAreaLayoutGuide frame is the same as view.frame on View Did Load

て烟熏妆下的殇ゞ 提交于 2019-12-24 21:06:17
问题 I'm using safearealayout guides, programmatically (i.e.) without storyboards. I want to access the safeAreaLayoutGuides , layoutFrame size within my app but don't know when to call it. If you call on viewDidLoad , the size returned is the same as the full view.frame size . When does the app catch up and readjust? My full app has 5 screens within a menubarcontroller . The first screen loads with content constrained to view.topAnchor when I've activated view.safeAreaLayoutGuide.topAnchor . If

How to calculate iOS 11 size in different orientation?

可紊 提交于 2019-12-21 03:33:14
问题 I calculate itemSize dependent on safe area for UICollectionView with horizontal scroll and custom layout. But for iPhone X safe area has different size for different orientation. My question is how should I calculate safe area size for landscape orientation in viewWillTransition function? Or how is it possible to do without this calculation? 回答1: EDIT To get safe area size without creating any additional views, use this: view.safeAreaLayoutGuide.layoutFrame.size If you want to use

How to set unsafe area background color for ios 11

末鹿安然 提交于 2019-12-18 11:28:19
问题 Creating some new view controllers with xcode 9 so now I have a few safe areas to deal with. I am currently trying to do something fullproof, meaning keeping the unsafe area as it is (since I always display the status bar) and having the background color extending to the fullscreen (to keep a similar behaviour to what I used to have). On an additional note, this also affect page controls since when you have some the system will put them in the bottom unsafe area which will also be displayed

Migrating a project using autoresizing masks for iPhone X

女生的网名这么多〃 提交于 2019-12-12 08:59:09
问题 We have some legacy projects that are still using Autoresizing masks, and everything was working fine until iOS 11 and iPhone X. With the introduction of safe area layout guides, what's the best solution to support iPhone X? We can convert all interfaces with autoresizing masks to use auto-layouts. This appears to be a significant effort, considering views are being dynamically added and adjusted. We keep using autoresizing masks but adjust the interfaces to add inset margins for iPhone X and

AVKit.AVPlayerViewController - controls not visible with iOS11 and upwards

戏子无情 提交于 2019-12-12 06:57:19
问题 I have a videoPlayer with controls. These are not visible with iOS11 + no problem up to iOS10 This is a demo with the iPhone8 simulator iPhone 8 Demo This is a demo with the iPhoneX simulator. The controls aren't showing at the bottom of the player iPhone X Demo I believe this has a lot to do with the new safe area. We are using contentOffset (below) to offset from the top. Changing the value makes no difference. No controls visible This is the code below I am using to configure the player :

IphoneX View hidden beside the Tabbar controller's tabbar

戏子无情 提交于 2019-12-11 18:55:55
问题 I have tabbar controller from one of the tab one view controller is pushed. in pushed view controller there is view (Camera) which is fixed height and with bottom with safearea. This view is hidden beside the tabbar in iPhone X but with other device it is correctly visible. Please suggest solution Thanks in advance Here is constraint in Iphone 6 in Iphone X See the camera view is hidden 回答1: I managed to solve this issue by uncheck under bottom bar of view controller. It is strange that with

safeAreaLayoutGuide returning wrong values on blocked rotation

淺唱寂寞╮ 提交于 2019-12-10 18:28:09
问题 In my application I do have two viewControllers: VideoListViewController - portrait only VideoPlayerViewController - landscape only VideoListViewController opens VideoPlayerViewController via self.present(viewController...) I'm blocking orientations via: override var supportedInterfaceOrientations: UIInterfaceOrientationMask { return .portrait } My problem is that portrait only view receives the landspace safe area... On my VideoListViewController.layoutSubviews I printed self

iPhone X - Set the color of the area around home indicator

℡╲_俬逩灬. 提交于 2019-12-07 08:45:35
问题 I'm pretty much new to Xcode when trying to align a sheet to the safe area of iPhone X, it leaves a transparent area below the sheet. Is there a way to set the fill of that area w/o expanding the sheet or align outside of the safe area? 回答1: Here is my tiny extension. If anybody can suggest an improvement to not access added view by "magic number" tag - welcome! extension UIViewController { private static let insetBackgroundViewTag = 98721 //Cool number func paintSafeAreaBottomInset(withColor

UITableview merging with the home indicator on iPhone X

怎甘沉沦 提交于 2019-12-06 08:15:18
问题 I have a UITableView created programmatically. This UITableView merges with the home indicator on an iPhone X device. How can I fix this issue? 回答1: Programatically, set bottom anchor of tableview with bottom anchor of SafeAreaLayout. Here is sample/test code, how to programatically set safe area layout with respect to interface elements. if #available(iOS 11, *) { let guide = view.safeAreaLayoutGuide NSLayoutConstraint.activate([ table.topAnchor.constraintEqualToSystemSpacingBelow(guide

iPhone X - Set the color of the area around home indicator

十年热恋 提交于 2019-12-05 15:25:15
I'm pretty much new to Xcode when trying to align a sheet to the safe area of iPhone X, it leaves a transparent area below the sheet. Is there a way to set the fill of that area w/o expanding the sheet or align outside of the safe area? Here is my tiny extension. If anybody can suggest an improvement to not access added view by "magic number" tag - welcome! extension UIViewController { private static let insetBackgroundViewTag = 98721 //Cool number func paintSafeAreaBottomInset(withColor color: UIColor) { guard #available(iOS 11.0, *) else { return } if let insetView = view.viewWithTag