iOS中Cell使用的标准附加控件(Swift版本)

该博客主要介绍了在Swift开发中,基类属性控制“标准附加控件”的类型。详细讲解了UITableViewCellAccessoryNone、UITableViewCellAccessoryDisclosureIndicator等几种附件类型的定义、显示效果及特点,还给出了相关英文词汇的发音和释义。

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

Overview 概述

基类UITableViewCellaccessoryType属性可以用来控制"标准附加控件"的类型, 其声明如下:

typedef NS_ENUM(NSInteger, UITableViewCellAccessoryType) {
	// 默认值, don't show any accessory view
    UITableViewCellAccessoryNone,
    // regular chevron. doesn't track                                                      
    UITableViewCellAccessoryDisclosureIndicator,
    // info button w/ chevron. tracks
    UITableViewCellAccessoryDetailDisclosureButton API_UNAVAILABLE(tvos),
    // checkmark. doesn't track
    UITableViewCellAccessoryCheckmark,
    // info button. tracks
    UITableViewCellAccessoryDetailButton API_AVAILABLE(ios(7.0))  API_UNAVAILABLE(tvos) 
};

Display Effect 显示效果

在这里插入图片描述

Detailed explanation 详解

UITableViewCellAccessoryNone

Enumeration Case 值为 0, 在 Swift 中定义为 UITableViewCell.AccessoryType.none, 是 UITableViewCell 属性 accessoryType 的默认值, 表示没有任何附件视图。

UITableViewCellAccessoryDisclosureIndicator

Enumeration Case 值为 1, 在 Swift 中定义为 UITableViewCell.AccessoryType.disclosureIndicator, 用于呈现新内容的 V 字形 (chevron-shaped) 控件, 此控件的 userInteractionEnabled 默认为 false, 单独点击不会触发 touch 事件 (doesn’t track touches), 系统也没有提供任何关联的回调方法. 建议通过 cell 的点击事件触发新内容的呈现.

UITableViewCellAccessoryDetailDisclosureButton

Enumeration Case 值为 2, 在 Swift 中定义为 UITableViewCell.AccessoryType.detailDisclosureButton, 样式为左侧信息按钮 + 右侧disclosure(V字形)控件。信息按钮的关联代理方法为: tableView(_:accessoryButtonTappedForRowWith:).

UITableViewCellAccessoryCheckmark

Enumeration Case 值为 3, 在 Swift 中定义为 UITableViewCell.AccessoryType.checkmark, 选择此选项以显示复选标记图像。 这种类型的附件视图不跟踪触摸 (doesn’t track touches)。

UITableViewCellAccessoryDetailButton

Enumeration Case 值为 4, 在 Swift 中定义为 UITableViewCell.AccessoryType.detailButton, 选择此选项会显示一个按钮,点击该按钮会显示有关该行的信息。 使用委托的 tableView(_:accessoryButtonTappedForRowWith:) 方法来响应按钮中的点击。

Related English Vocabulary 相关英文词汇

1. Accessory

pronunciation 发音

[əkˈsesəri], 英[əkˈsesəri]

definition 释义
  • N-COUNT 附件;配件;附属物
  • ADJ 附属的;辅助的;非主要的

2. Disclosure

pronunciation 发音


/ dɪsˈkləʊʒə(r) /

/ dɪsˈkloʊʒər /

definition 释义

n. 披露, 公开;

3. Indicator

pronunciation 发音


/ ˈɪndɪkeɪtə(r) /

/ ˈɪndɪkeɪtər /

definition 释义

n. 标志,指示器 ;

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

依旧风轻

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值