[UITableViewCell]附属视图管理

Managing Accessory Views

  • accessoryType Property

    The type of standard accessory view the cell should use (normal state).

    Cell使用的标准附属视图类型

    Declaration

    SWIFT

    var accessoryType: UITableViewCellAccessoryType

    OBJECTIVE-C

    @property(nonatomicUITableViewCellAccessoryType accessoryType

    Discussion

    附属视图显示在表格视图正常状态下的cell右。标准的附属视图包括V型揭示标;查看UITableViewCellAccessoryType关于有效的accessoryType常量的描述。默认的accessoryType为UITableViewCellAccessoryNone。如果通过accessoryView属性设置了一个自定义的附属视图,那么这个属性的默认值就会被忽略。如果cell被激活了并且附属类型为UITableViewCellAccessoryDetailDisclosureButton, 那么附属视图就会追踪触摸,当敲击发生的时候,发送给数据源对象一个tableView:accessoryButtonTappedForRowWithIndexPath:消息。

    如果附属类型的图片设置给了普通和编辑两种状态,它会在状态间交替隐退,使用editingAccessoryType属性来给编辑模式期间的cell设置附属类型。如果这个属性没有同时给两个状态设置,cell便会会动画滑入或者滑出。

    The accessory view appears in the right side of the cell in the table view’s normal (default) state. The standard accessory views include the disclosure chevron; for a description of valid accessoryType constants, see UITableViewCellAccessoryType. The default is UITableViewCellAccessoryNone. If a custom accessory view is set through the accessoryView property, the value of this property is ignored. If the cell is enabled and the accessory type is UITableViewCellAccessoryDetailDisclosureButton, the accessory view tracks touches and, when tapped, sends the data-source object a tableView:accessoryButtonTappedForRowWithIndexPath:message. 

    The accessory-type image cross-fades between normal and editing states if it set for both states; use the editingAccessoryTypeproperty to set the accessory type for the cell during editing mode. If this property is not set for both states, the cell is animated to slide in or out, as necessary. 

    Availability

    Available in iOS 2.0 and later.

  • accessoryView Property

    A view that is used, typically as a control, on the right side of the cell (normal state).

    Declaration

    SWIFT

    var accessoryView: UIView?

    OBJECTIVE-C

    @property(nonatomicstrongUIView *accessoryView

    Discussion

    如果这个属性的值不是nil的话,UITableViewCell类便会使用一个给予的视图作为表格视图常规状态下的附属视图;它会忽视accessoryType属性的值。 被提供的附属视图可以是controller框架或者是一个自定义的视图。附属视图显示在cell的右边

     

    If the value of this property is not nil, the UITableViewCell class uses the given view for the accessory view in the table view’s normal (default) state; it ignores the value of the accessoryType property. The provided accessory view can be a framework-provided control or label or a custom view. The accessory view appears in the right side of the cell.

    The accessory view cross-fades between normal and editing states if it set for both states; use the editingAccessoryView property to set the accessory view for the cell during editing mode. If this property is not set for both states, the cell is animated to slide in or out, as necessary. 

    Availability

    Available in iOS 2.0 and later.

  • The type of standard accessory view the cell should use in the table view’s editing state.

    Declaration

    SWIFT

    var editingAccessoryType: UITableViewCellAccessoryType

    OBJECTIVE-C

    @property(nonatomicUITableViewCellAccessoryType editingAccessoryType

    Discussion

    The accessory view appears in the right side of the cell when the table view is in editing mode. The standard accessory views include the disclosure chevron; for a description of valid constants, see UITableViewCellAccessoryType. The default is UITableViewCellAccessoryNone. If a custom accessory view for editing mode is set through the editingAccessoryView property, the value of this property is ignored. If the cell is enabled and the accessory type is UITableViewCellAccessoryDetailDisclosureButton, the accessory view tracks touches and, when tapped, sends the delegate object a tableView:accessoryButtonTappedForRowWithIndexPath: message. 

    The accessory type cross-fades between normal and editing states if it set for both states; use the accessoryType property to set the accessory view for the cell during the table view’s normal state. If this property is not set for both states, the cell is animated to slide or out, as necessary. 

    Availability

    Available in iOS 3.0 and later.

  • A view that is used typically as a control on the right side of the cell when it is in editing mode.

    Declaration

    SWIFT

    var editingAccessoryView: UIView?

    OBJECTIVE-C

    @property(nonatomicstrongUIView *editingAccessoryView

    Discussion

    If the value of this property is not nil, the UITableViewCell class uses the given view for the accessory view in the table view’s editing state; it ignores the value of the editingAccessoryType property. The provided accessory view can be a framework-provided control or label or a custom view. The accessory view appears in the right side of the cell. 

    The accessory type cross-fades between normal and editing states if it set for both states; use the accessoryType property to set the accessory view for the cell during the table view’s normal state. If this property is not set for both states, the cell is animated to slide or out, as necessary. 

    Availability

    Available in iOS 3.0 and later.

posted @ 2015-07-01 11:34  baaingSheep  阅读(367)  评论(0编辑  收藏  举报