iOS开发--UItableView类属性

本文介绍如何使用Storyboard创建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(nonatomic, readonly) UITableViewStyle style

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

Declaration

SWIFT

var rowHeight: CGFloat

OBJECTIVE-C

@property(nonatomic) CGFloat rowHeight

The style for table cells used as separators.

Declaration

SWIFT

var separatorStyle: UITableViewCellSeparatorStyle

OBJECTIVE-C

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

The color of separator rows in the table view.

Declaration

SWIFT

var separatorColor: UIColor!

OBJECTIVE-C

@property(nonatomic, retain) UIColor *separatorColor


The effect applied to table separators.

Declaration

SWIFT

@NSCopying var separatorEffect: UIVisualEffect?

OBJECTIVE-C

@property(nonatomic, copy) UIVisualEffect *separatorEffect


The background view of the table view.

Declaration

SWIFT

var backgroundView: UIView?

OBJECTIVE-C

@property(nonatomic, readwrite, retain) UIView *backgroundView


Specifies the default inset of cell separators.

Declaration

SWIFT

var separatorInset: UIEdgeInsets

OBJECTIVE-C

@property(nonatomic) UIEdgeInsets separatorInset


Returns an accessory view that is displayed above the table.

Declaration

SWIFT

var tableHeaderView: UIView?

OBJECTIVE-C

@property(nonatomic, retain) UIView *tableHeaderView


Returns an accessory view that is displayed below the table.

Declaration

SWIFT

var tableFooterView: UIView?

OBJECTIVE-C

@property(nonatomic, retain) UIView *tableFooterView


The height of section headers in the receiving table view.

Declaration

SWIFT

var sectionHeaderHeight: CGFloat

OBJECTIVE-C

@property(nonatomic) CGFloat sectionHeaderHeight


The height of section footers in the receiving table view.

Declaration

SWIFT

var sectionFooterHeight: CGFloat

OBJECTIVE-C

@property(nonatomic) CGFloat sectionFooterHeight


The estimated height of rows in the table view.

Declaration

SWIFT

var estimatedRowHeight: CGFloat

OBJECTIVE-C

@property(nonatomic) CGFloat estimatedRowHeight


The estimated height of section headers in the table view.

Declaration

SWIFT

var estimatedSectionHeaderHeight: CGFloat

OBJECTIVE-C

@property(nonatomic) CGFloat estimatedSectionHeaderHeight

The estimated height of section footers in the table view.

Declaration

SWIFT

var estimatedSectionFooterHeight: CGFloat

OBJECTIVE-C

@property(nonatomic) CGFloat estimatedSectionFooterHeight

评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值