swift 学习笔记 UITableView (一)Table View Styles and Accessory Views

这篇博客介绍了Swift中UITableView的两种样式:Plain和Grouped,以及它们各自的特点。Plain风格允许每个section有多个row,并支持自定义的header和footer视图。Grouped风格的背景则更为分隔,提供不同的视觉效果。此外,还提到了UITableView的不同Cell样式,包括默认样式、Subtitle样式等。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

Table View Styles 和 附属的views


Table View有各种不同的Style去match不同的porpose, 而且, UIKit framework提供了标准的Style,同样也为cell提供了标准的子view。


table View Styles


根据外观可以区分成两个table view: Plain 和 Grouped


Plain table view:

如下图,一个plain table view可以有一个或多个section, 每个section可以有一个或多个row,每个色彩体噢内可以有自己的header  & footer( header和footer也可以包含custom view, 比如图片), 当用户在section中滚动时,header和footer会浮动在上/下屏幕



以下为plain table view中的贵族,indexed list. 


A table view configured as an indexed list


plain table view中的鳥丝:


A table view configured as an selection list


Grouped table Views


下面介绍table View中的战斗view Grouped table view, 区别于plain 他的背景不是单纯的白,他的背景会被分开来


A table view in the grouped style


section的成分:


Header and footer of a section



不同的UITableView Cell Style


以下为四多金花老大: UITableViewCellStyleDefault 



老二:UITableViewCellStyleSubtitle




三:UITableViewCellStyleValue1 



四:UITableViewCellStyleValue2 




阿克塞萨日(已炸): Accessory Views


Standard accessory views

Description

Disclosure indicator

Disclosure indicatorUITableViewCellAccessoryDisclosureIndicator. You use the disclosure indicator when selecting a cell results in the display of another table view reflecting the next level in the data model hierarchy.

Detail disclosure button

Detail disclosure buttonUITableViewCellAccessoryDetailDisclosureButton. You use the detail disclosure button when selecting a cell results in a detail view of that item (which may or may not be a table view).

Check mark

CheckmarkUITableViewCellAccessoryCheckmark. You use a checkmark when a touch on a row results in the selection of that item. This kind of table view is known as a selection list, and it is analogous to a pop-up list. Selection lists can limit selections to one row, or they can allow multiple rows with checkmarks.



评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值