Demonstrates how to implement a custom accessory view for your UITableView in the form of a checkmark button. It shows you how to override the appearance or control of the accessory view, much like that of "UITableViewCellAccessoryDetailDisclosureButton". It implements the custom accessory view by setting the table's "accessoryView" property with a UIButton of type "UIButtonTypeCustom". It can be toggled by selecting the entire table row by implementing UITableView's "didSelectRowAtIndexPath". The green checkmark is trackable (checked/unchecked), and can be toggled independent of table selection.
iOS 6.0 SDK
iOS 5.0 or later
Using the Sample
Launch the Accessory project using Xcode.
To run in the simulator, set the Active SDK to Simulator. To run on a device, set the Active SDK to the appropriate Device setting. When launched, touch the entire row to make the accessory view appear checked, touch again to uncheck it. Then touch the actual accessory to the right to check and uncheck it as well.
main.m - Main source file for this sample.
AppDelegate.h/.m - The application's delegate to setup its window and content.
MyTableViewController.h/.m - The main UITableViewController controlling the UITableView and its custom accessory view.
Changes from Previous Versions
1.0 - First release.
1.1 - Upgraded for 3.0 SDK due to deprecated APIs; in "cellForRowAtIndexPath" it now uses UITableViewCell's initWithStyle.
1.2 - Upgraded project to build with the iOS 4.0 SDK.
1.3 - Upgraded for iOS 6.0, now using Automatic Reference Counting (ARC) and storyboards, updated to adopt current best practices for Objective-C.
Copyright (C) 2008-2013 Apple Inc. All rights reserved.
© 2013 Apple Inc. All Rights Reserved. (Last updated: 2013-01-10)