Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the extend edge property in UIViewController for ?

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.

like image 488
3366784 Avatar asked Nov 12 '14 19:11

3366784


2 Answers

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?

like image 166
carlodurso Avatar answered Sep 22 '22 17:09

carlodurso


See the images below:

I set 44 height red topview and 44 height red footview of tableview.

UIRectEdgeTop: The top edge of the rectangle.
UIRectEdgeBottom: The bottom edge of the rectangle.

enter image description here

enter image description here

like image 42
jiexishede Avatar answered Sep 23 '22 17:09

jiexishede