What is the extend edge property in UIViewController for ?

守給你的承諾、 提交于 2020-01-22 20:03:05

问题


I have read on the forums about this property, mostly its people setting this this property to false or unchecking it in the storyboard. I have done this myself because when I have a UINavigation Controller embedded in a View, the top bar pushes my UITextView down so the text starts editing at the bottom.

Unchecking Extended Edges Under Top Bars in the StoryBoard in the UIViewController solves my problem but I don't understand what is going on.

Can someone give an explanation on what the purpose of this property is, I would like to know more about it.


回答1:


By default, UITableViewController's views are automatically inset in iOS7 so that they don't start below the navigation bar/status bar. This is controller by the "Adjust scroll view insets" setting on the Attributes Inspector tab of the UITableViewController in Interface Builder, or by the setAutomaticallyAdjustsScrollViewInsets: method of UIViewController.

For a UIViewController's contents, if you don't want its view's contents to extend under the top/bottom bars, you can use the Extend Edges Under Top Bars/Under Bottom Bars settings in Interface Builder. This is accessible via the edgesForExtendedLayout property.

Reference: Why does UIViewController extend under UINavigationBar, while UITableViewController doesn't?




回答2:


TheedgesForExtendedLayout property, together with the extendedLayoutIncludesOpaqueBars property, determines whether or not view controllers' views underlap top and bottom bars (navigation bar, toolbar, etc.)



来源:https://stackoverflow.com/questions/26894642/what-is-the-extend-edge-property-in-uiviewcontroller-for

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!