Reference article:
http://stackoverflow.com/questions/18798792/ Explaining-difference-between-automaticallyadjustsscrollviewinsets-extendedlayo
http://redth.codes/ios7-full-screen-layout/
IOS 7 later introduced a series of properties in Viewcontroller to manage page layouts.
Here's an explanation from Apple's official documentation, which is too abstract to read, so experiment with the code.
extendedLayoutIncludesOpaqueBars
A Boolean value indicating whether or not the extended layout includes opaque bars.automaticallyAdjustsScrollViewInsets
A Boolean value that indicates whether the view controller should automatically adjust its scroll view insets.
edgesForExtendedLayout Property
The extended edges to use for the layout.EdgesforextendedlayoutCreate a new item for a single page, then add Uinavigationcontroller to set the background to red, the interface effect is as follows: So you can see that after iOS7, the layout of the view is the default full screen, Navigation bar is semi-transparent by default, You can see the red background below the navigation bar.
-(void) viewdidload { [super viewdidload]; Self.edgesforextendedlayout = Uirectedgenone;}
Set the edgesforextendedlayout to Uirectedgenone, indicating that the view is not extended to the entire screen. The page works as follows:
Uirectedge is an enumeration type, and the other values are very easy to understand by literal means.
typedef enum:nsuinteger { Uirectedgenone = 0, uirectedgetop = 1 << 0, uirectedgeleft = 1 << 1, uirectedgebottom = 1 << 2, uirectedgeright = 1 << 3, uirectedgeall = Uirectedge Top | Uirectedgeleft | Uirectedgebottom | Uirectedgeright} Uirectedge;
automaticallyAdjustsScrollViewInsets
This property is used if the page is ScrollView or uitableview, and usually we want the ScrollView or uitableview content to appear below the Uinavigation bar.
By setting Edgesforextendedlayout = Uirectedgenone or self. Navigationcontroller. Navigationbar. Translucent = no; You can have the layout of the view start from below the Uinavigation bar, but one side effect is that when the page is sliding, view has no way to occupy the full screen.
Automaticallyadjustsscrollviewinsets will be able to complete this requirement well.
Self.automaticallyadjustsscrollviewinsets = NO;
At this time UITableView will be blocked by Uinavigation bar.
Self.automaticallyadjustsscrollviewinsets = YES;
At this point you can see that the content of UITableView will start from below Uinavigation Bar, and the view of this page still occupies the entire screen, so this property is completely done!
Extendedlayout in IOS 7