iOS Development UI Chapter-a brief introduction to the use of static cells

Source: Internet
Author: User

iOS Development UI Chapter-a brief introduction to the use of static cells

First, the realization of the effect and description

Description: Observe the above display effect, you can find the entire interface is a tableview to show, the above data are fixed, and almost will not change.

There are several ways to accomplish the above effect:

(1) You can directly use the code, return three groups, in judging how many rows per group, what data to display, so write "dead" code is not recommended to use.

(2) A little more flexible, you can put the plist file a lazy load of the way, loaded into the program, dynamic access. But looking at the interface structure, it is easy to see that this needs to be nested in the model, very cumbersome.

(3) Storyboard provides a static cell this function, can be very convenient to complete the above interface display effect. (Hint: Rarely used in real-world development)

Second, the use of static cells to complete the simple interface display process

In a similar development, if the entire interface is TableView, the controller inherits from the Uitableviewcontroller directly.

Modify the host controller to inherit from Uitableviewcontroller

1/Geneva-QQ dynamic (static cell)2 //3 //Created by Xin on 14-10-13.4 //Copyright (c) 2014 Liang. All rights reserved.5 //6 7 #import<UIKit/UIKit.h>8 9 @interfaceTxviewcontroller:uitableviewcontrollerTen  One @end

Delete the default UIView in storyboard and drag a Viewcontroller directly

When dragged into a viewcontroller, it will have a cell on the default, by default, the cell is dynamic, it is invisible by default.

By setting the cell to static, the resulting note that is set to static cell (static cell) in the content of the properties panel must change this property here.

To associate it with the host controller

Next, you can set the displayed picture and text in turn.

There are two ways to set a title:

1 is double-click Change

2 is click on child control lable Modify

Set the number of groups to which the secondary view is set, as required by the interface, and how many rows each group has.  Settings group: Click TableView to set the sections property of the Properties panel. Set the number of rows per group: Tip: If you write a cell that does not change thousands of years, then you can write one line in a group, then copy it, and modify it slightly. Note: Static cells are actually in development, rarely used, and are only described here as knowledge points.

iOS Development UI Chapter-a brief introduction to the use of static cells

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.