mirror of
https://github.com/zhigang1992/RETableViewManager.git
synced 2026-06-15 10:37:55 +08:00
Add ability to assign actions for accessoryButton
This commit is contained in:
@@ -54,17 +54,21 @@
|
||||
|
||||
section = [[RETableViewSection alloc] initWithHeaderTitle:@"Accessories"];
|
||||
[_manager addSection:section];
|
||||
[section addItem:[REStringItem itemWithTitle:@"Accessory 1" actionBlock:^(RETableViewItem *item) {
|
||||
[section addItem:[REStringItem itemWithTitle:@"Accessory 1" accessoryType:UITableViewCellAccessoryDisclosureIndicator actionBlock:^(RETableViewItem *item) {
|
||||
[weakSelf.tableView deselectRowAtIndexPath:item.indexPath animated:YES];
|
||||
} accessoryType:UITableViewCellAccessoryDisclosureIndicator]];
|
||||
}]];
|
||||
|
||||
[section addItem:[REStringItem itemWithTitle:@"Accessory 2" actionBlock:^(RETableViewItem *item) {
|
||||
REStringItem *accessoryItem2 = [REStringItem itemWithTitle:@"Accessory 2" accessoryType:UITableViewCellAccessoryDetailDisclosureButton actionBlock:^(RETableViewItem *item) {
|
||||
[weakSelf.tableView deselectRowAtIndexPath:item.indexPath animated:YES];
|
||||
} accessoryType:UITableViewCellAccessoryDetailDisclosureButton]];
|
||||
}];
|
||||
accessoryItem2.accessoryButtonActionBlock = ^(RETableViewItem *item) {
|
||||
NSLog(@"Accessory button in accessoryItem2 was tapped");
|
||||
};
|
||||
[section addItem:accessoryItem2];
|
||||
|
||||
[section addItem:[REStringItem itemWithTitle:@"Accessory 2" actionBlock:^(RETableViewItem *item) {
|
||||
[section addItem:[REStringItem itemWithTitle:@"Accessory 2" accessoryType:UITableViewCellAccessoryCheckmark actionBlock:^(RETableViewItem *item) {
|
||||
[weakSelf.tableView deselectRowAtIndexPath:item.indexPath animated:YES];
|
||||
} accessoryType:UITableViewCellAccessoryCheckmark]];
|
||||
}]];
|
||||
|
||||
// Set delegate and datasource
|
||||
//
|
||||
|
||||
@@ -30,13 +30,13 @@
|
||||
RETableViewSection *section = [[RETableViewSection alloc] init];
|
||||
[_manager addSection:section];
|
||||
|
||||
[section addItem:[REStringItem itemWithTitle:@"Forms" actionBlock:^(RETableViewItem *item) {
|
||||
[section addItem:[REStringItem itemWithTitle:@"Forms" accessoryType:UITableViewCellAccessoryDisclosureIndicator actionBlock:^(RETableViewItem *item) {
|
||||
[weakSelf.navigationController pushViewController:[[ControlsViewController alloc] initWithStyle:UITableViewStyleGrouped] animated:YES];
|
||||
} accessoryType:UITableViewCellAccessoryDisclosureIndicator]];
|
||||
}]];
|
||||
|
||||
[section addItem:[REStringItem itemWithTitle:@"List" actionBlock:^(RETableViewItem *item) {
|
||||
[section addItem:[REStringItem itemWithTitle:@"List" accessoryType:UITableViewCellAccessoryDisclosureIndicator actionBlock:^(RETableViewItem *item) {
|
||||
[weakSelf.navigationController pushViewController:[[ListViewController alloc] initWithStyle:UITableViewStylePlain] animated:YES];
|
||||
} accessoryType:UITableViewCellAccessoryDisclosureIndicator]];
|
||||
}]];
|
||||
|
||||
// Set delegate and datasource
|
||||
//
|
||||
|
||||
Reference in New Issue
Block a user