Cupcake icon indicating copy to clipboard operation
Cupcake copied to clipboard

Safe Area vs Top Layout Guide

Open onedv opened this issue 6 years ago • 1 comments

Hi! Thanks a lot for this cool library :)

I use Swift 4 with latest Xcode 9 and want to embed a table in the view of my main view controller, which I embedded in a navigation controller via the storyboard in interface builder, looks quite similar to the cupcake demo. Now on newer projects, I do not have the top and bottom layout guides, as they are deprecated, only the safe area. When I add a GroupTable to my main view now, the navigation item / bar on top overlays the group table I created. I have to add it with e.g. addTo(self.view, 60, 0, 0, 0) in setupUI so that the table is rendered below the navigation bar. If I run the same code on iOS 9.3 devices (with 60 top), this adds a not so nice margin between the header and the table, meaning I have to use different parameters for addTo for iOS 9.3 and iOS 11 to get the same result. Do you know if this needs a fix in the library or is the problem somewhere else / can be fixed otherwise?

Thanks a lot for your support! Cheers

onedv avatar Jan 26 '18 17:01 onedv

Sorry for taking so long to reply. Unfortunately, Cupcake have not any knowledge of layout guides and safe area. Since it is written before iOS 11 and layout guides are view controller things.

I don't know why automatic adjusts insets act different betweens iOS 9 and iOS 11. In my test, you have to manually setting tableView.contentInsetAdjustmentBehavior to .automatic in order to fix overlay problem.

Nevertheless, Cupcake do support layout margin which work well as safe area: GroupTable(...).embedIn(self.view, "0", 0, 0, 0)

Thanks for the long post ^^

nerdycat avatar Feb 02 '18 10:02 nerdycat