UITableView类用法大全:UITableView属性

Posted 爱木之心

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了UITableView类用法大全:UITableView属性相关的知识,希望对你有一定的参考价值。

【storyboard创建tableView步骤】
1.设置根视图
2.选中视图,设置导航栏editor/embed in/navigationcontroller
3.cell设置Identifier标识
4.创建tableviewcontroller类,跟tableviewcontroller控件关联上
5.storyboard会自动遵守<</span>UITabBarControllerDelegate,UITableViewDataSource>
6.只需要实现必要的协议方法即可。
 

 
【UITableView属性】
  • UITableViewStyle 样式
     UITableViewStylePlain,//只有一个分区
     UITableViewStyleGrouped //可以有多个分区
 

Returns the style of the receiver. (read-only)

Declaration

SWIFT

var style: UITableViewStyle { get }

OBJECTIVE-C

@property(nonatomicreadonlyUITableViewStyle style

The height of each row (table cell) in the receiver.

Declaration

SWIFT

var rowHeight: CGFloat

OBJECTIVE-C

@property(nonatomicCGFloat rowHeight

The style for table cells used as separators.

Declaration

SWIFT

var separatorStyle: UITableViewCellSeparatorStyle

OBJECTIVE-C

@property(nonatomicUITableViewCellSeparatorStyle separatorStyle
     UITableViewCellSeparatorStyleNone,// 没分割线
     UITableViewCellSeparatorStyleSingleLine,//单线
     UITableViewCellSeparatorStyleSingleLineEtched // 双线?
 

The color of separator rows in the table view.

Declaration

SWIFT

var separatorColor: UIColor!

OBJECTIVE-C

@property(nonatomicretainUIColor *separatorColor

 

The effect applied to table separators.

Declaration

SWIFT

@NSCopying var separatorEffect: UIVisualEffect?

OBJECTIVE-C

@property(nonatomiccopyUIVisualEffect *separatorEffect

 

The background view of the table view.

Declaration

SWIFT

var backgroundView: UIView?

OBJECTIVE-C

@property(nonatomicreadwriteretainUIView *backgroundView

 

Specifies the default inset of cell separators.

Declaration

SWIFT

var separatorInset: UIEdgeInsets

OBJECTIVE-C

@property(nonatomicUIEdgeInsets separatorInset

 

Returns an accessory view that is displayed above the table.

Declaration

SWIFT

var tableHeaderView: UIView?

OBJECTIVE-C

@property(nonatomicretainUIView *tableHeaderView


Returns an accessory view that is displayed below the table.

Declaration

SWIFT

var tableFooterView: UIView?

OBJECTIVE-C

@property(nonatomicretainUIView *tableFooterView

 

The height of section headers in the receiving table view.

Declaration

SWIFT

var sectionHeaderHeight: CGFloat

OBJECTIVE-C

@property(nonatomicCGFloat sectionHeaderHeight

 

The height of section footers in the receiving table view.

Declaration

SWIFT

var sectionFooterHeight: CGFloat

OBJECTIVE-C

@property(nonatomicCGFloat sectionFooterHeight

 

The estimated height of rows in the table view.

Declaration

SWIFT

var estimatedRowHeight: CGFloat

OBJECTIVE-C

@property(nonatomicCGFloat estimatedRowHeight

 

The estimated height of section headers in the table view.

Declaration

SWIFT

var estimatedSectionHeaderHeight: CGFloat

OBJECTIVE-C

@property(nonatomicCGFloat estimatedSectionHeaderHeight

The estimated height of section footers in the table view.

Declaration

SWIFT

var estimatedSectionFooterHeight: CGFloat

OBJECTIVE-C

@property(nonatomicCGFloat estimatedSectionFooterHeight

 

以上是关于UITableView类用法大全:UITableView属性的主要内容,如果未能解决你的问题,请参考以下文章

MVC中HtmlHelper用法大全参考

从 UItableview 删除一行时崩溃

UITableView API大百科

iOS开发UI篇—UITableview控件使用小结

刷新 UITableView 而不刷新节标题

UINavigationController 如何成为 UITableView 的 navigationController?