IOS7 TableView Adaptation

Source: Internet
Author: User

iOS7 apps are full-screen, meaning that all the controller's view defaults from the screen (0,0) start.

To achieve full-screen effect, the official added several properties to Uiviewcontroller:

1 @property (nonatomic,assign) Uirectedge edgesforextendedlayout Ns_available_ios (7_0); Defaults to UIRectEdgeAll2  @property (nonatomic,assign) BOOL extendedlayoutincludesopaquebars Ns_available_ios (7_0); Defaults to NO, but bars is translucent by default on 7_0.  3  @property (nonatomic,assign) BOOL automaticallyadjustsscrollviewinsets Ns_available_ios (7_0);//Defaults to YES


One:
Attribute edgesforextendedlayout, which means that the edge is about to unfold around

The edgesforextendedlayout value is a struct, the default value is Uirectedgeall,

That is, when a controller is added to the parent controller, it fills the entire screen up or down.

For example 1:

Uiviewcontroller when added to Uinavcontroller, the y value of Uiviewcontroller = = y of the status bar

At this time set self.edgesforextendedlayout = Uirectedgenone;

Y value of Uiviewcontroller = = Nav Bar y + nav bar height

/*

This condition can also be set, the transparency property of bar in the navigation bar is translucent to No

Self.navigationController.navigationBar.translucent = NO;

The Translucent property defaults to no before IOS6,

The navigation bar under IOS7 is semi-transparent by default, and yes, so this property does not occupy space.

*/

For example 2:

When Uitableviewcontroller is added to Uitabbarcontroller, the bottom part of the Uitableviewcontroller cell is blocked by Tabbar

At this time set self.edgesforextendedlayout = Uirectedgenone;

Y value of Tabbar = = Cgrectgetmaxy (uitableviewcontroller)

Two:

Self.extendedlayoutincludesopaquebars = YES; expansion includes status bar

Three:

Self.automaticallyadjustsscrollviewinsets = YES;

When the design to ScrollView, TableView, when the data is set, the interior will change the top value of Contentinsets For example: group-style TableView under the controller with navigation bar, The head of the No. 0 Group will have a portion of the height h due to the No. 0 set of No. 0 cells of the group-style Tabelview iOS7, and the Y value in TableView is 35!!!

And after the cell data has been set, the system will execute by default

Self.automaticallyadjustsscrollviewinsets = YES;

That is TableView's contentinset.top = 64; The Y-value of the No. 0 row of cell No. 0 = 64 + 35. To reach the Y value of the No. 0 set of No. 0 row cells = The effect at the bottom of the navigation bar. Before the cell sets the data,

Tableview.contentinset = Uiedgeinsetsmake (-35, 0, 0, 0);

In this way, after the cell has set up the data, the system changes the top value by 64, just to achieve the effect. To achieve high effects such as the head of each group,

Tableview.sectionheaderheight = Cellsectionheight;

tableview.sectionfooterheight = 0; Tableview.contentinset = Uiedgeinsetsmake (cellSectionHeight-35, 0, 0, 0);

Original: http://wyfpkx.blog.163.com/blog/static/17260843920142422043416/

IOS7 TableView Adaptation

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.