├── PYTableViewController ├── Categoty │ ├── UITableView+Extension │ │ ├── UITableViewCell+Extension.h │ │ ├── UITableViewCell+Extension.m │ │ ├── UITableViewController+Extension.h │ │ └── UITableViewController+Extension.m │ ├── UIView+extension.h │ └── UIView+extension.m ├── Controller │ ├── PYTableViewController.h │ └── PYTableViewController.m ├── Model │ ├── PYArrowCell.h │ ├── PYArrowCell.m │ ├── PYCell.h │ ├── PYCell.m │ ├── PYCheckCell.h │ ├── PYCheckCell.m │ ├── PYDetailCell.h │ ├── PYDetailCell.m │ ├── PYGroup.h │ ├── PYGroup.m │ ├── PYLabelCell.h │ ├── PYLabelCell.m │ ├── PYSwitchCell.h │ └── PYSwitchCell.m ├── Other │ ├── PYConst.h │ └── PYConst.m └── View │ ├── PYTableViewCell.h │ └── PYTableViewCell.m ├── PYTableViewControllerExample ├── PYTableViewControllerExample.xcodeproj │ ├── project.pbxproj │ ├── project.xcworkspace │ │ ├── contents.xcworkspacedata │ │ └── xcuserdata │ │ │ └── iphone5solo.xcuserdatad │ │ │ └── UserInterfaceState.xcuserstate │ └── xcuserdata │ │ └── iphone5solo.xcuserdatad │ │ ├── xcdebugger │ │ └── Breakpoints_v2.xcbkptlist │ │ └── xcschemes │ │ ├── PYTableViewControllerExample.xcscheme │ │ └── xcschememanagement.plist ├── PYTableViewControllerExample │ ├── Assets.xcassets │ │ ├── AppIcon.appiconset │ │ │ └── Contents.json │ │ ├── Contents.json │ │ └── setting.imageset │ │ │ ├── Contents.json │ │ │ ├── apple-1.png │ │ │ ├── apple-2.png │ │ │ └── apple.png │ ├── Base.lproj │ │ ├── LaunchScreen.storyboard │ │ └── Main.storyboard │ ├── Classes │ │ ├── Controller │ │ │ ├── PYExampleTableViewController.h │ │ │ ├── PYExampleTableViewController.m │ │ │ ├── PYTempViewController.h │ │ │ └── PYTempViewController.m │ │ └── Others │ │ │ ├── AppDelegate.h │ │ │ └── AppDelegate.m │ ├── Info.plist │ └── main.m ├── PYTableViewControllerExampleTests │ ├── Info.plist │ └── PYTableViewControllerExampleTests.m └── PYTableViewControllerExampleUITests │ ├── Info.plist │ └── PYTableViewControllerExampleUITests.m └── README.md /PYTableViewController/Categoty/UITableView+Extension/UITableViewCell+Extension.h: -------------------------------------------------------------------------------- 1 | // 代码地址: https://github.com/iphone5solo/PYTableViewController 2 | // 代码地址: http://code4app.com/thread-8530-1-1.html 3 | // Created by CoderKo1o. 4 | // Copyright © 2016年 iphone5solo. All rights reserved. 5 | // 6 | 7 | #import 8 | #import 9 | 10 | typedef void(^UITableViewCellBlock)(); 11 | 12 | @interface UITableViewCell (Extension) 13 | 14 | /** 选中cell的操作 */ 15 | - (UITableViewCellBlock)operation; 16 | - (void)setOperation:(UITableViewCellBlock)operation; 17 | 18 | + (instancetype)cellWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier didSelectedCell:(void(^)(UITableViewCell *selectedcell))didSelectedCell; 19 | 20 | 21 | @end 22 | -------------------------------------------------------------------------------- /PYTableViewController/Categoty/UITableView+Extension/UITableViewCell+Extension.m: -------------------------------------------------------------------------------- 1 | // 代码地址: https://github.com/iphone5solo/PYTableViewController 2 | // 代码地址: http://code4app.com/thread-8530-1-1.html 3 | // Created by CoderKo1o. 4 | // Copyright © 2016年 iphone5solo. All rights reserved. 5 | // 6 | 7 | #import "UITableViewCell+Extension.h" 8 | 9 | static UITableViewCellBlock _operation; 10 | 11 | @implementation UITableViewCell (Extension) 12 | 13 | 14 | 15 | - (UITableViewCellBlock)operation 16 | { 17 | return objc_getAssociatedObject(self, &_operation); 18 | } 19 | 20 | - (void)setOperation:(UITableViewCellBlock)operation 21 | { 22 | objc_setAssociatedObject(self, &_operation, operation, OBJC_ASSOCIATION_COPY_NONATOMIC); 23 | } 24 | 25 | + (instancetype)cellWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier didSelectedCell:(void(^)(UITableViewCell *cell))didSelectedCell 26 | { 27 | UITableViewCell *cell = [[UITableViewCell alloc] initWithStyle:style reuseIdentifier:reuseIdentifier]; 28 | // 设置选中操作 29 | [cell setOperation:didSelectedCell]; 30 | return cell; 31 | 32 | } 33 | 34 | 35 | @end 36 | -------------------------------------------------------------------------------- /PYTableViewController/Categoty/UITableView+Extension/UITableViewController+Extension.h: -------------------------------------------------------------------------------- 1 | // 代码地址: https://github.com/iphone5solo/PYTableViewController 2 | // 代码地址: http://code4app.com/thread-8530-1-1.html 3 | // Created by CoderKo1o. 4 | // Copyright © 2016年 iphone5solo. All rights reserved. 5 | // 6 | 7 | #import 8 | // cell的组模型 9 | @interface Group : NSObject 10 | /** 组头标题*/ 11 | @property (nonatomic, copy) NSString *header; 12 | 13 | /** 组尾标题*/ 14 | @property (nonatomic, copy) NSString *footer; 15 | 16 | /** tableView的所有cell*/ 17 | @property (nonatomic, strong) NSArray *cells; 18 | 19 | @end 20 | 21 | @interface UITableViewController (Extension) 22 | 23 | 24 | - (NSMutableArray *)groups; 25 | - (void)setGroups:(NSMutableArray *)groups; 26 | 27 | @end 28 | -------------------------------------------------------------------------------- /PYTableViewController/Categoty/UITableView+Extension/UITableViewController+Extension.m: -------------------------------------------------------------------------------- 1 | // 代码地址: https://github.com/iphone5solo/PYTableViewController 2 | // 代码地址: http://code4app.com/thread-8530-1-1.html 3 | // Created by CoderKo1o. 4 | // Copyright © 2016年 iphone5solo. All rights reserved. 5 | // 6 | 7 | #import "UITableViewController+Extension.h" 8 | #import 9 | 10 | /** TableView的所有组*/ 11 | static NSMutableArray *_groups; 12 | 13 | @implementation Group 14 | 15 | - (NSArray *)cells 16 | { 17 | if (_cells == nil) { 18 | _cells = [NSArray array]; 19 | 20 | } 21 | return _cells; 22 | } 23 | @end 24 | 25 | @implementation UITableViewController (Extension) 26 | 27 | - (NSMutableArray *)groups 28 | { 29 | return objc_getAssociatedObject(self, &_groups); 30 | } 31 | 32 | - (void)setGroups:(NSMutableArray *)groups 33 | { 34 | return objc_setAssociatedObject(self, &_groups, groups, OBJC_ASSOCIATION_RETAIN_NONATOMIC); 35 | } 36 | 37 | 38 | @end 39 | -------------------------------------------------------------------------------- /PYTableViewController/Categoty/UIView+extension.h: -------------------------------------------------------------------------------- 1 | // 代码地址: https://github.com/iphone5solo/PYTableViewController 2 | // 代码地址: http://code4app.com/thread-8530-1-1.html 3 | // Created by CoderKo1o. 4 | // Copyright © 2016年 iphone5solo. All rights reserved. 5 | // 6 | 7 | #import 8 | 9 | @interface UIView (extension) 10 | @property (nonatomic, assign) CGFloat x; 11 | @property (nonatomic, assign) CGFloat y; 12 | @property (nonatomic, assign) CGFloat centerX; 13 | @property (nonatomic, assign) CGFloat centerY; 14 | @property (nonatomic, assign) CGFloat width; 15 | @property (nonatomic, assign) CGFloat height; 16 | @property (nonatomic, assign) CGSize size; 17 | @property (nonatomic, assign) CGPoint origin; 18 | 19 | /** 完全复制,返回一个属性一样的新对象 */ 20 | - (UIView *)copy; 21 | @end 22 | -------------------------------------------------------------------------------- /PYTableViewController/Categoty/UIView+extension.m: -------------------------------------------------------------------------------- 1 | // 代码地址: https://github.com/iphone5solo/PYTableViewController 2 | // 代码地址: http://code4app.com/thread-8530-1-1.html 3 | // Created by CoderKo1o. 4 | // Copyright © 2016年 iphone5solo. All rights reserved. 5 | // 6 | #import "UIView+extension.h" 7 | 8 | @implementation UIView (extension) 9 | 10 | - (void)setX:(CGFloat)x 11 | { 12 | CGRect frame = self.frame; 13 | frame.origin.x = x; 14 | self.frame = frame; 15 | } 16 | 17 | - (CGFloat)x 18 | { 19 | return self.origin.x; 20 | } 21 | 22 | - (void)setCenterX:(CGFloat)centerX 23 | { 24 | CGPoint center = self.center; 25 | center.x = centerX; 26 | self.center = center; 27 | } 28 | 29 | - (CGFloat)centerX 30 | { 31 | return self.center.x; 32 | } 33 | 34 | - (void)setCenterY:(CGFloat)centerY 35 | { 36 | CGPoint center = self.center; 37 | center.y = centerY; 38 | self.center = center; 39 | } 40 | 41 | - (CGFloat)centerY 42 | { 43 | return self.center.y; 44 | } 45 | 46 | - (void)setY:(CGFloat)y 47 | { 48 | CGRect frame = self.frame; 49 | frame.origin.y = y; 50 | self.frame = frame; 51 | } 52 | 53 | - (CGFloat)y 54 | { 55 | return self.frame.origin.y; 56 | } 57 | 58 | - (void)setSize:(CGSize)size 59 | { 60 | CGRect frame = self.frame; 61 | frame.size = size; 62 | self.frame = frame; 63 | 64 | } 65 | 66 | - (CGSize)size 67 | { 68 | return self.frame.size; 69 | } 70 | 71 | - (void)setHeight:(CGFloat)height 72 | { 73 | CGRect frame = self.frame; 74 | frame.size.height = height; 75 | self.frame = frame; 76 | } 77 | 78 | - (CGFloat)height 79 | { 80 | return self.frame.size.height; 81 | 82 | } 83 | 84 | 85 | - (void)setWidth:(CGFloat)width 86 | { 87 | CGRect frame = self.frame; 88 | frame.size.width = width; 89 | self.frame = frame; 90 | 91 | } 92 | - (CGFloat)width 93 | { 94 | return self.frame.size.width; 95 | } 96 | 97 | - (void)setOrigin:(CGPoint)origin 98 | { 99 | CGRect frame = self.frame; 100 | frame.origin = origin; 101 | self.frame = frame; 102 | } 103 | 104 | - (CGPoint)origin 105 | { 106 | return self.frame.origin; 107 | } 108 | 109 | - (UIView *)copy 110 | { 111 | NSData *tempData = [NSKeyedArchiver archivedDataWithRootObject:self]; 112 | return [NSKeyedUnarchiver unarchiveObjectWithData:tempData]; 113 | } 114 | @end 115 | -------------------------------------------------------------------------------- /PYTableViewController/Controller/PYTableViewController.h: -------------------------------------------------------------------------------- 1 | // 代码地址: https://github.com/iphone5solo/PYTableViewController 2 | // 代码地址: http://code4app.com/thread-8530-1-1.html 3 | // Created by CoderKo1o. 4 | // Copyright © 2016年 iphone5solo. All rights reserved. 5 | // 6 | #import 7 | #import "PYTableViewCell.h" 8 | #import "PYArrowCell.h" 9 | #import "PYDetailCell.h" 10 | #import "PYSwitchCell.h" 11 | #import "PYCell.h" 12 | #import "PYGroup.h" 13 | #import "PYLabelCell.h" 14 | #import "PYConst.h" 15 | #import "PYCheckCell.h" 16 | 17 | @interface PYTableViewController : UITableViewController 18 | 19 | /** tableView的所有组,包含着是PYGroup模型 */ 20 | @property (nonatomic, strong) NSMutableArray *groups; 21 | 22 | /** 选中的cell */ 23 | @property (nonatomic, strong) PYTableViewCell *selectedCell; 24 | /** 设置分隔线样式 */ 25 | @property (nonatomic, assign) PYTableViewCellSeparatorStyle separatorStyle; 26 | /** 设置自定义分割线(当设置了自定义,忽略separatorStyle属性) */ 27 | @property (nonatomic, strong) UIView *separatorView; 28 | 29 | @end 30 | -------------------------------------------------------------------------------- /PYTableViewController/Controller/PYTableViewController.m: -------------------------------------------------------------------------------- 1 | // 代码地址: https://github.com/iphone5solo/PYTableViewController 2 | // 代码地址: http://code4app.com/thread-8530-1-1.html 3 | // Created by CoderKo1o. 4 | // Copyright © 2016年 iphone5solo. All rights reserved. 5 | // 6 | 7 | #import "PYTableViewController.h" 8 | 9 | @interface PYTableViewController () 10 | 11 | @end 12 | 13 | @implementation PYTableViewController 14 | 15 | #pragma mark settings 16 | - (NSMutableArray *)groups 17 | { 18 | if (_groups == nil) { 19 | _groups = [NSMutableArray array]; 20 | } 21 | return _groups; 22 | } 23 | 24 | 25 | #pragma mark - 初始化 26 | - (instancetype)init 27 | { 28 | return [super initWithStyle:UITableViewStyleGrouped]; 29 | } 30 | 31 | 32 | - (void)setSeparatorStyle:(PYTableViewCellSeparatorStyle)separatorStyle 33 | { 34 | _separatorStyle = separatorStyle; 35 | if (separatorStyle == PYTableViewCellSeparatorStyleDefault) return; 36 | self.tableView.separatorStyle = UITableViewCellSeparatorStyleNone; 37 | } 38 | 39 | 40 | #pragma mark - datasource 41 | // 返回组数 42 | - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView 43 | { 44 | return self.groups.count; 45 | } 46 | 47 | // 返回每组的行数 48 | - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section 49 | { 50 | // 获取对象 51 | PYGroup *group = self.groups[section]; 52 | return group.cells.count; 53 | 54 | } 55 | 56 | // 返回每一行的内容 57 | - (PYTableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath 58 | { 59 | 60 | // 获取模型 61 | PYGroup *group = self.groups[indexPath.section]; 62 | PYCell *item = group.cells[indexPath.row]; 63 | 64 | // 创建自定义cell 65 | PYTableViewCell*cell = [PYTableViewCell cellWithTableView:tableView]; 66 | // 设置代理 67 | cell.delegate = self; 68 | cell.dataSource = self; 69 | 70 | // 绑定cell(注意:必须先绑定cell再设置数据,因为在设置cell数据时用到了tableViewCell) 71 | item.tableViewCell = cell; 72 | // 设置cell数据 73 | cell.item = item; 74 | // 设置分隔线样式(注意:必须要先设置完item,才能设置分隔线样式) 75 | cell.pyseparatorStyle = self.separatorStyle; 76 | // 设置自定义分隔线(注意: 先确定样式,再自定义) 77 | cell.separatorView = self.separatorView; 78 | 79 | return cell; 80 | } 81 | 82 | // 设置组标题 83 | - (NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section 84 | { 85 | // 获取模型 86 | PYGroup *group = self.groups[section]; 87 | return group.header; 88 | } 89 | 90 | // 设置尾部标题 91 | - (NSString *)tableView:(UITableView *)tableView titleForFooterInSection:(NSInteger)section 92 | { 93 | // 获取模型 94 | PYGroup *group = self.groups[section]; 95 | return group.footer; 96 | } 97 | 98 | 99 | // 选中某行 100 | - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath 101 | { 102 | // 获取模型 103 | PYGroup *group = self.groups[indexPath.section]; 104 | PYCell *item = group.cells[indexPath.row]; 105 | 106 | PYTableViewCell *selectedCell = [tableView cellForRowAtIndexPath:indexPath]; 107 | 108 | // 如果PYCheckCell 109 | if ([[item class] isSubclassOfClass:[PYCheckCell class]]) { 110 | // 获取当前组 111 | for (PYCheckCell *cell in group.cells) { 112 | cell.checked = [cell isEqual:item]; 113 | } 114 | // 刷新cell 115 | NSIndexSet *set = [NSIndexSet indexSetWithIndex:indexPath.section]; 116 | [tableView reloadSections:set withRowAnimation:UITableViewRowAnimationNone]; 117 | } 118 | // 如果PYLabelCell 119 | if ([[item class] isSubclassOfClass:[PYLabelCell class]]) { 120 | [tableView deselectRowAtIndexPath:indexPath animated:YES]; 121 | } 122 | 123 | // 执行操作(当两种方法同时实现,优先执行回调对象和对调方法,忽略block) 124 | if ([item.target respondsToSelector:item.action]) { // 实现方法 125 | [item.target performSelector:item.action withObject:selectedCell]; 126 | } else if (item.option) { 127 | item.option(selectedCell); 128 | } 129 | 130 | 131 | } 132 | 133 | - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath 134 | { 135 | // 获取模型 136 | PYGroup *group = self.groups[indexPath.section]; 137 | PYCell *item = group.cells[indexPath.row]; 138 | 139 | return item.height; 140 | } 141 | 142 | #pragma mark - 辅助按钮被点击 143 | - (void)tableView:(UITableView *)tableView accessoryButtonTappedForRowWithIndexPath:(NSIndexPath *)indexPath 144 | { 145 | PYGroup *group = self.groups[indexPath.section]; 146 | PYCell *item = group.cells[indexPath.row]; 147 | 148 | PYTableViewCell *selectedCell = [tableView cellForRowAtIndexPath:indexPath]; 149 | // 执行操作 150 | if (item.option) item.option(selectedCell); 151 | } 152 | @end 153 | -------------------------------------------------------------------------------- /PYTableViewController/Model/PYArrowCell.h: -------------------------------------------------------------------------------- 1 | // 代码地址: https://github.com/iphone5solo/PYTableViewController 2 | // 代码地址: http://code4app.com/thread-8530-1-1.html 3 | // Created by CoderKo1o. 4 | // Copyright © 2016年 iphone5solo. All rights reserved. 5 | // 6 | 7 | #import "PYCell.h" 8 | 9 | @interface PYArrowCell : PYCell 10 | 11 | @end 12 | -------------------------------------------------------------------------------- /PYTableViewController/Model/PYArrowCell.m: -------------------------------------------------------------------------------- 1 | // 代码地址: https://github.com/iphone5solo/PYTableViewController 2 | // 代码地址: http://code4app.com/thread-8530-1-1.html 3 | // Created by CoderKo1o. 4 | // Copyright © 2016年 iphone5solo. All rights reserved. 5 | // 6 | 7 | #import "PYArrowCell.h" 8 | 9 | @implementation PYArrowCell 10 | 11 | - (instancetype)init 12 | { 13 | if (self = [super init]) { 14 | // 默认辅助状态 15 | self.accessoryType = self.hiddenArrow ? UITableViewCellAccessoryNone : UITableViewCellAccessoryDisclosureIndicator; 16 | // 设置默认选中状态 17 | self.selectionStyle = UITableViewCellSelectionStyleDefault; 18 | } 19 | return self; 20 | } 21 | 22 | // 重写setAccessoryView:方法,包装accessoryView 23 | - (UIView *)accessoryView 24 | { 25 | UIView *accessoryView = [super accessoryView]; 26 | accessoryView.y = (self.height - accessoryView.height) * 0.5; 27 | accessoryView.x = [UIScreen mainScreen].bounds.size.width - accessoryView.width - 34; 28 | // 用button包装view,这样view就不会随着cell选中时高亮了 29 | [self.tableViewCell.arrowAccessoryView removeFromSuperview]; // 先移除 30 | UIButton *accessoryButton = [[UIButton alloc] init]; 31 | [accessoryButton addSubview:accessoryView]; 32 | self.tableViewCell.arrowAccessoryView = accessoryButton; 33 | [self.tableViewCell.contentView addSubview:accessoryButton]; 34 | 35 | return nil; 36 | } 37 | 38 | @end 39 | -------------------------------------------------------------------------------- /PYTableViewController/Model/PYCell.h: -------------------------------------------------------------------------------- 1 | // 代码地址: https://github.com/iphone5solo/PYTableViewController 2 | // 代码地址: http://code4app.com/thread-8530-1-1.html 3 | // Created by CoderKo1o. 4 | // Copyright © 2016年 iphone5solo. All rights reserved. 5 | // 6 | 7 | #import 8 | #import "PYTableViewCell.h" 9 | #import "PYConst.h" 10 | @class UITableViewCell; 11 | 12 | 13 | typedef void(^PYTableViewCellBlock)(PYTableViewCell *selectedCell); 14 | 15 | @interface PYCell : NSObject 16 | 17 | /** 选中cell的回调, 当实现了回调对象和回调方法则忽略该回调 */ 18 | @property (nonatomic, copy) PYTableViewCellBlock option; 19 | 20 | /** 回调对象 */ 21 | @property (weak, nonatomic) id target; 22 | /** 回调方法 */ 23 | @property (assign, nonatomic) SEL action; 24 | 25 | /** 标题 */ 26 | @property (nonatomic, copy) NSString *title; 27 | /** 标题字体大小 */ 28 | @property (nonatomic, strong) UIFont *titleFont; 29 | /** 标题颜色 */ 30 | @property (nonatomic, strong) UIColor *titleColor; 31 | /** 头像地址 */ 32 | @property (nonatomic, copy) NSString *icon; 33 | /** 头像 */ 34 | @property (nonatomic, strong) UIView *iconView; 35 | 36 | /** 背景图片 */ 37 | @property (nonatomic, copy) NSString *backgroundImage; 38 | /** 背景颜色 */ 39 | @property (nonatomic, strong) UIColor *backgroundColor; 40 | 41 | /** 附加说明 */ 42 | @property (nonatomic, copy) NSString *accessoryTitle; 43 | /** 附加说明字体颜色 */ 44 | @property (nonatomic, strong) UIColor *accessoryTitleColor; 45 | /** 附加说明字体大小 */ 46 | @property (nonatomic, strong) UIFont *accessoryTitleFont; 47 | /** 附加视图 */ 48 | @property (nonatomic, strong) UIView *accessoryView; 49 | 50 | /** 是否隐藏指示标 */ 51 | @property (nonatomic, assign) BOOL hiddenArrow; 52 | /** cell的高度 */ 53 | @property (nonatomic, assign) CGFloat height; 54 | /** cell的AccessoryType类型 */ 55 | @property (nonatomic, assign) UITableViewCellAccessoryType accessoryType; 56 | /** cell的选中状态 */ 57 | @property (nonatomic, assign) UITableViewCellSelectionStyle selectionStyle; 58 | /** 每一个模型绑定的tableViewcell */ 59 | @property (nonatomic, weak) PYTableViewCell *tableViewCell; 60 | 61 | 62 | 63 | + (instancetype)cellWithTitle:(NSString *)title; 64 | + (instancetype)cellWithTitle:(NSString *)title icon:(NSString *)icon; 65 | + (instancetype)cellWithTitle:(NSString *)title accessoryView:(UIView *)accessoryView; 66 | + (instancetype)cellWithTitle:(NSString *)title accessoryTitle:(NSString *)accessoryTitle; 67 | + (instancetype)cellWithTitle:(NSString *)title icon:(NSString *)icon accessoryView:(UIView *)accessoryView; 68 | + (instancetype)cellWithTitle:(NSString *)title icon:(NSString *)icon accessoryTitle:(NSString *)accessoryTitle; 69 | + (instancetype)cellWithTitle:(NSString *)title icon:(NSString *)icon backgroundImage:(NSString *)backgroundImage; 70 | 71 | + (instancetype)cellWithTitle:(NSString *)title didSelectedCell:(PYTableViewCellBlock)option; 72 | + (instancetype)cellWithTitle:(NSString *)title icon:(NSString *)icon didSelectedCell:(PYTableViewCellBlock) option; 73 | + (instancetype)cellWithTitle:(NSString *)title accessoryView:(UIView *)accessoryView didSelectedCell:(PYTableViewCellBlock)option; 74 | + (instancetype)cellWithTitle:(NSString *)title accessoryTitle:(NSString *)accessoryTitle didSelectedCell:(PYTableViewCellBlock)option; 75 | + (instancetype)cellWithTitle:(NSString *)title icon:(NSString *)icon accessoryView:(UIView *)accessoryView didSelectedCell:(PYTableViewCellBlock)option; 76 | + (instancetype)cellWithTitle:(NSString *)title icon:(NSString *)icon accessoryTitle:(NSString *)accessoryTitle didSelectedCell:(PYTableViewCellBlock)option; 77 | + (instancetype)cellWithTitle:(NSString *)title icon:(NSString *)icon backgroundImage:(NSString *)backgroundImage didSelectedCell:(PYTableViewCellBlock)option; 78 | 79 | + (instancetype)cellWithTitle:(NSString *)title didSelectedCellTarget:(id)target action:(SEL)action; 80 | + (instancetype)cellWithTitle:(NSString *)title icon:(NSString *)icon didSelectedCellTarget:(id)target action:(SEL)action; 81 | + (instancetype)cellWithTitle:(NSString *)title accessoryView:(UIView *)accessoryView didSelectedCellTarget:(id)target action:(SEL)action; 82 | + (instancetype)cellWithTitle:(NSString *)title accessoryTitle:(NSString *)accessoryTitle didSelectedCellTarget:(id)target action:(SEL)action; 83 | + (instancetype)cellWithTitle:(NSString *)title icon:(NSString *)icon accessoryView:(UIView *)accessoryView didSelectedCellTarget:(id)target action:(SEL)action; 84 | + (instancetype)cellWithTitle:(NSString *)title icon:(NSString *)icon accessoryTitle:(NSString *)accessoryTitle didSelectedCellTarget:(id)target action:(SEL)action; 85 | + (instancetype)cellWithTitle:(NSString *)title icon:(NSString *)icon backgroundImage:(NSString *)backgroundImage didSelectedCellTarget:(id)target action:(SEL)action; 86 | 87 | /** 设置回调对象和回调方法(此时,忽略option回调) */ 88 | - (void)didSelectedCellTarget:(id)target action:(SEL)action; 89 | 90 | @end 91 | -------------------------------------------------------------------------------- /PYTableViewController/Model/PYCell.m: -------------------------------------------------------------------------------- 1 | // 代码地址: https://github.com/iphone5solo/PYTableViewController 2 | // 代码地址: http://code4app.com/thread-8530-1-1.html 3 | // Created by CoderKo1o. 4 | // Copyright © 2016年 iphone5solo. All rights reserved. 5 | // 6 | 7 | #import "PYCell.h" 8 | 9 | @interface PYCell () 10 | 11 | 12 | @end 13 | 14 | @implementation PYCell 15 | 16 | - (CGFloat)height 17 | { 18 | // 默认高为44 19 | return _height ? _height : 44; 20 | } 21 | 22 | // 初始化 23 | - (instancetype)init 24 | { 25 | if (self = [super init]) { 26 | // 默认cell选中样式 27 | self.selectionStyle = UITableViewCellSelectionStyleNone; 28 | // 默认cell的辅助样式 29 | self.accessoryType = UITableViewCellAccessoryNone; 30 | } 31 | return self; 32 | } 33 | 34 | + (instancetype)cellWithTitle:(NSString *)title 35 | { 36 | PYCell *cell = [[self alloc] init]; 37 | cell.title = title; 38 | return cell; 39 | } 40 | 41 | 42 | + (instancetype)cellWithTitle:(NSString *)title icon:(NSString *)icon 43 | { 44 | PYCell *cell = [self cellWithTitle:title]; 45 | cell.icon = icon; 46 | return cell; 47 | } 48 | 49 | + (instancetype)cellWithTitle:(NSString *)title accessoryTitle:(NSString *)accessoryTitle 50 | { 51 | PYCell *cell = [self cellWithTitle:title]; 52 | cell.accessoryTitle = accessoryTitle; 53 | return cell; 54 | } 55 | 56 | + (instancetype)cellWithTitle:(NSString *)title accessoryView:(UIView *)accessoryView 57 | { 58 | PYCell *cell = [self cellWithTitle:title]; 59 | cell.accessoryView = accessoryView; 60 | return cell; 61 | } 62 | 63 | + (instancetype)cellWithTitle:(NSString *)title icon:(NSString *)icon accessoryTitle:(NSString *)accessoryTitle 64 | { 65 | PYCell *cell = [self cellWithTitle:title icon:icon]; 66 | cell.accessoryTitle = accessoryTitle; 67 | return cell; 68 | } 69 | 70 | + (instancetype)cellWithTitle:(NSString *)title icon:(NSString *)icon accessoryView:(UIView *)accessoryView 71 | { 72 | PYCell *cell = [self cellWithTitle:title icon:icon]; 73 | cell.accessoryView = accessoryView; 74 | return cell; 75 | } 76 | 77 | + (instancetype)cellWithTitle:(NSString *)title didSelectedCell:(PYTableViewCellBlock)option 78 | { 79 | PYCell *cell = [self cellWithTitle:title]; 80 | cell.option = option; 81 | return cell; 82 | } 83 | 84 | + (instancetype)cellWithTitle:(NSString *)title accessoryTitle:(NSString *)accessoryTitle didSelectedCell:(PYTableViewCellBlock)option 85 | { 86 | PYCell *cell = [self cellWithTitle:title didSelectedCell:option]; 87 | cell.accessoryTitle = accessoryTitle; 88 | return cell; 89 | } 90 | 91 | 92 | + (instancetype)cellWithTitle:(NSString *)title icon:(NSString *)icon accessoryTitle:(NSString *)accessoryTitle didSelectedCell:(PYTableViewCellBlock)option 93 | { 94 | 95 | PYCell *cell = [self cellWithTitle:title icon:icon didSelectedCell:option]; 96 | cell.accessoryTitle = accessoryTitle; 97 | return cell; 98 | } 99 | 100 | + (instancetype)cellWithTitle:(NSString *)title icon:(NSString *)icon didSelectedCell:(PYTableViewCellBlock)option 101 | { 102 | PYCell *cell = [self cellWithTitle:title icon:icon]; 103 | cell.option = option; 104 | return cell; 105 | } 106 | 107 | + (instancetype)cellWithTitle:(NSString *)title accessoryView:(UIView *)accessoryView didSelectedCell:(PYTableViewCellBlock) option 108 | { 109 | PYCell *cell = [self cellWithTitle:title accessoryView:accessoryView]; 110 | cell.option = option; 111 | return cell; 112 | } 113 | 114 | + (instancetype)cellWithTitle:(NSString *)title icon:(NSString *)icon backgroundImage:(NSString *)backgroundImage 115 | { 116 | PYCell *cell = [self cellWithTitle:title icon:icon]; 117 | cell.backgroundImage = backgroundImage; 118 | return cell; 119 | } 120 | 121 | + (instancetype)cellWithTitle:(NSString *)title icon:(NSString *)icon accessoryView:(UIView *)accessoryView didSelectedCell:(PYTableViewCellBlock)option 122 | { 123 | PYCell *cell = [self cellWithTitle:title icon:icon accessoryView:accessoryView]; 124 | cell.option = option; 125 | return cell; 126 | } 127 | 128 | + (instancetype)cellWithTitle:(NSString *)title icon:(NSString *)icon backgroundImage:(NSString *)backgroundImage didSelectedCell:(PYTableViewCellBlock)option 129 | { 130 | PYCell *cell = [self cellWithTitle:title icon:icon didSelectedCell:option]; 131 | cell.backgroundImage = backgroundImage; 132 | return cell; 133 | } 134 | 135 | + (instancetype)cellWithTitle:(NSString *)title didSelectedCellTarget:(id)target action:(SEL)action 136 | { 137 | PYCell *cell = [self cellWithTitle:title]; 138 | cell.target = target; 139 | cell.action = action; 140 | return cell; 141 | } 142 | 143 | + (instancetype)cellWithTitle:(NSString *)title icon:(NSString *)icon didSelectedCellTarget:(id)target action:(SEL)action 144 | { 145 | PYCell *cell = [self cellWithTitle:title icon:icon]; 146 | cell.target = target; 147 | cell.action = action; 148 | return cell; 149 | } 150 | 151 | + (instancetype)cellWithTitle:(NSString *)title accessoryView:(UIView *)accessoryView didSelectedCellTarget:(id)target action:(SEL)action 152 | { 153 | PYCell *cell = [self cellWithTitle:title accessoryView:accessoryView]; 154 | cell.target = target; 155 | cell.action = action; 156 | return cell; 157 | } 158 | 159 | + (instancetype)cellWithTitle:(NSString *)title accessoryTitle:(NSString *)accessoryTitle didSelectedCellTarget:(id)target action:(SEL)action 160 | { 161 | PYCell *cell = [self cellWithTitle:title accessoryTitle:accessoryTitle]; 162 | cell.target = target; 163 | cell.action = action; 164 | return cell; 165 | } 166 | 167 | + (instancetype)cellWithTitle:(NSString *)title icon:(NSString *)icon accessoryView:(UIView *)accessoryView didSelectedCellTarget:(id)target action:(SEL)action 168 | { 169 | PYCell *cell = [self cellWithTitle:title icon:icon accessoryView:accessoryView]; 170 | cell.target = target; 171 | cell.action = action; 172 | return cell; 173 | } 174 | 175 | + (instancetype)cellWithTitle:(NSString *)title icon:(NSString *)icon accessoryTitle:(NSString *)accessoryTitle didSelectedCellTarget:(id)target action:(SEL)action 176 | { 177 | PYCell *cell = [self cellWithTitle:title icon:icon accessoryTitle:accessoryTitle]; 178 | cell.target = target; 179 | cell.action = action; 180 | return cell; 181 | } 182 | 183 | + (instancetype)cellWithTitle:(NSString *)title icon:(NSString *)icon backgroundImage:(NSString *)backgroundImage didSelectedCellTarget:(id)target action:(SEL)action 184 | { 185 | PYCell *cell = [self cellWithTitle:title icon:icon backgroundImage:backgroundImage]; 186 | cell.target = target; 187 | cell.action = action; 188 | return cell; 189 | } 190 | 191 | - (void)didSelectedCellTarget:(id)target action:(SEL)action 192 | { 193 | self.target = target; 194 | self.action = action; 195 | } 196 | 197 | 198 | @end 199 | -------------------------------------------------------------------------------- /PYTableViewController/Model/PYCheckCell.h: -------------------------------------------------------------------------------- 1 | // 代码地址: https://github.com/iphone5solo/PYTableViewController 2 | // 代码地址: http://code4app.com/thread-8530-1-1.html 3 | // Created by CoderKo1o. 4 | // Copyright © 2016年 iphone5solo. All rights reserved. 5 | // 6 | 7 | #import "PYCell.h" 8 | 9 | @interface PYCheckCell : PYCell 10 | 11 | /** 是否选中 */ 12 | @property (nonatomic, assign, getter=isChecked) BOOL checked; 13 | 14 | @end 15 | -------------------------------------------------------------------------------- /PYTableViewController/Model/PYCheckCell.m: -------------------------------------------------------------------------------- 1 | // 代码地址: https://github.com/iphone5solo/PYTableViewController 2 | // 代码地址: http://code4app.com/thread-8530-1-1.html 3 | // Created by CoderKo1o. 4 | // Copyright © 2016年 iphone5solo. All rights reserved. 5 | // 6 | 7 | #import "PYCheckCell.h" 8 | 9 | @implementation PYCheckCell 10 | - (instancetype)init 11 | { 12 | if (self = [super init]) { 13 | // 默认辅助状态 14 | self.accessoryType = UITableViewCellAccessoryNone; 15 | // 设置默认选中状态 16 | self.selectionStyle = UITableViewCellSelectionStyleDefault; 17 | // 默认不选中 18 | self.checked = NO; 19 | } 20 | return self; 21 | } 22 | 23 | /** 重写accessoryView方法 **/ 24 | - (UIView *)accessoryView 25 | { 26 | self.tableViewCell.accessoryType = self.isChecked ? UITableViewCellAccessoryCheckmark : UITableViewCellAccessoryNone; 27 | 28 | return nil; 29 | } 30 | @end 31 | -------------------------------------------------------------------------------- /PYTableViewController/Model/PYDetailCell.h: -------------------------------------------------------------------------------- 1 | // 代码地址: https://github.com/iphone5solo/PYTableViewController 2 | // 代码地址: http://code4app.com/thread-8530-1-1.html 3 | // Created by CoderKo1o. 4 | // Copyright © 2016年 iphone5solo. All rights reserved. 5 | // 6 | 7 | #import "PYCell.h" 8 | 9 | @interface PYDetailCell : PYCell 10 | 11 | @end 12 | -------------------------------------------------------------------------------- /PYTableViewController/Model/PYDetailCell.m: -------------------------------------------------------------------------------- 1 | // 代码地址: https://github.com/iphone5solo/PYTableViewController 2 | // 代码地址: http://code4app.com/thread-8530-1-1.html 3 | // Created by CoderKo1o. 4 | // Copyright © 2016年 iphone5solo. All rights reserved. 5 | // 6 | 7 | #import "PYDetailCell.h" 8 | 9 | @implementation PYDetailCell 10 | 11 | - (instancetype)init 12 | { 13 | if (self = [super init]) { 14 | // 默认辅助样式 15 | self.accessoryType = UITableViewCellAccessoryDetailButton; 16 | // 设置默认选中状态 17 | self.selectionStyle = UITableViewCellSelectionStyleDefault; 18 | } 19 | return self; 20 | } 21 | 22 | /** 重写accessoryView方法,包装accessoryView **/ 23 | - (UIView *)accessoryView 24 | { 25 | UIView *accessoryView = [super accessoryView]; 26 | accessoryView.y = (self.height - accessoryView.height) * 0.5; 27 | accessoryView.x = [UIScreen mainScreen].bounds.size.width - accessoryView.width - 50; 28 | // 用button包装view,这样view就不会随着cell选中时高亮了 29 | [self.tableViewCell.detailAccessoryView removeFromSuperview]; // 先移除 30 | UIButton *accessoryButton = [[UIButton alloc] init]; 31 | [accessoryButton addSubview:accessoryView]; 32 | self.tableViewCell.detailAccessoryView = accessoryButton; 33 | [self.tableViewCell.contentView addSubview:accessoryButton]; 34 | 35 | return nil; 36 | } 37 | 38 | 39 | @end 40 | -------------------------------------------------------------------------------- /PYTableViewController/Model/PYGroup.h: -------------------------------------------------------------------------------- 1 | // 代码地址: https://github.com/iphone5solo/PYTableViewController 2 | // 代码地址: http://code4app.com/thread-8530-1-1.html 3 | // Created by CoderKo1o. 4 | // Copyright © 2016年 iphone5solo. All rights reserved. 5 | // 6 | 7 | #import 8 | 9 | @interface PYGroup : NSObject 10 | 11 | /** 头部标题*/ 12 | @property (nonatomic, copy) NSString *header; 13 | 14 | /** 尾部标题*/ 15 | @property (nonatomic, copy) NSString *footer; 16 | 17 | /** 每一组所有的cells,每一组都是PYCell模型*/ 18 | @property (nonatomic, strong) NSMutableArray *cells; 19 | 20 | 21 | #pragma mark - 快速创建组方法 22 | + (instancetype)group; 23 | + (instancetype)groupWithHeader:(NSString *)header; 24 | + (instancetype)groupWithFooter:(NSString *)footer; 25 | + (instancetype)groupWithcells:(NSMutableArray *)cells; 26 | + (instancetype)groupWithHeader:(NSString *)header footer:(NSString *)footer; 27 | + (instancetype)groupWithHeader:(NSString *)header cells:(NSMutableArray *)cells; 28 | + (instancetype)groupWithFooter:(NSString *)footer cells:(NSMutableArray *)cells; 29 | + (instancetype)groupWithHeader:(NSString *)header footer:(NSString *)footer cells:(NSMutableArray *)cells; 30 | 31 | @end 32 | -------------------------------------------------------------------------------- /PYTableViewController/Model/PYGroup.m: -------------------------------------------------------------------------------- 1 | // 代码地址: https://github.com/iphone5solo/PYTableViewController 2 | // 代码地址: http://code4app.com/thread-8530-1-1.html 3 | // Created by CoderKo1o. 4 | // Copyright © 2016年 iphone5solo. All rights reserved. 5 | // 6 | 7 | #import "PYGroup.h" 8 | 9 | @implementation PYGroup 10 | 11 | - (NSMutableArray *)cells 12 | { 13 | if (!_cells) { 14 | _cells = [NSMutableArray array]; 15 | } 16 | return _cells; 17 | } 18 | 19 | 20 | + (instancetype)group 21 | { 22 | return [[self alloc] init]; 23 | } 24 | 25 | + (instancetype)groupWithHeader:(NSString *)header 26 | { 27 | PYGroup *group = [self group]; 28 | group.header = header; 29 | return group; 30 | } 31 | 32 | + (instancetype)groupWithFooter:(NSString *)footer 33 | { 34 | PYGroup *group = [self group]; 35 | group.footer = footer; 36 | return group; 37 | } 38 | 39 | + (instancetype)groupWithcells:(NSMutableArray *)cells 40 | { 41 | PYGroup *group = [self group]; 42 | group.cells = cells; 43 | return group; 44 | } 45 | 46 | + (instancetype)groupWithHeader:(NSString *)header footer:(NSString *)footer 47 | { 48 | PYGroup *group = [self groupWithHeader:header]; 49 | group.footer = footer; 50 | return group; 51 | } 52 | 53 | + (instancetype)groupWithHeader:(NSString *)header cells:(NSMutableArray *)cells 54 | { 55 | PYGroup *group = [self groupWithHeader:header]; 56 | group.cells = cells; 57 | return group; 58 | } 59 | 60 | + (instancetype)groupWithFooter:(NSString *)footer cells:(NSMutableArray *)cells 61 | { 62 | PYGroup *group = [self groupWithFooter:footer]; 63 | group.cells = cells; 64 | return group; 65 | } 66 | 67 | + (instancetype)groupWithHeader:(NSString *)header footer:(NSString *)footer cells:(NSMutableArray *)cells 68 | { 69 | PYGroup *group = [self groupWithHeader:header footer:footer]; 70 | group.cells = cells; 71 | return group; 72 | } 73 | 74 | @end 75 | -------------------------------------------------------------------------------- /PYTableViewController/Model/PYLabelCell.h: -------------------------------------------------------------------------------- 1 | // 代码地址: https://github.com/iphone5solo/PYTableViewController 2 | // 代码地址: http://code4app.com/thread-8530-1-1.html 3 | // Created by CoderKo1o. 4 | // Copyright © 2016年 iphone5solo. All rights reserved. 5 | // 6 | 7 | #import "PYCell.h" 8 | 9 | @interface PYLabelCell : PYCell 10 | 11 | /** 文本内容*/ 12 | @property (nonatomic, copy) NSString *text; 13 | 14 | /** 可通过这个属性来自定义label */ 15 | @property (nonatomic, strong) UILabel *label; 16 | 17 | + (instancetype)cellWithText:(NSString *)text; 18 | + (instancetype)cellWithText:(NSString *)text didSelectedCell:(PYTableViewCellBlock)option; 19 | 20 | + (instancetype)cellWithLabel:(UILabel *)label; 21 | + (instancetype)cellWithLabel:(UILabel *)label didSelectedCell:(PYTableViewCellBlock)option; 22 | 23 | @end 24 | -------------------------------------------------------------------------------- /PYTableViewController/Model/PYLabelCell.m: -------------------------------------------------------------------------------- 1 | // 代码地址: https://github.com/iphone5solo/PYTableViewController 2 | // 代码地址: http://code4app.com/thread-8530-1-1.html 3 | // Created by CoderKo1o. 4 | // Copyright © 2016年 iphone5solo. All rights reserved. 5 | // 6 | #import "PYLabelCell.h" 7 | @interface PYLabelCell() 8 | 9 | 10 | 11 | @end 12 | 13 | @implementation PYLabelCell 14 | 15 | - (instancetype)init 16 | { 17 | if (self = [super init]) { 18 | // 默认辅助样式 19 | self.accessoryType = UITableViewCellAccessoryNone; 20 | // 设置默认选中状态 21 | self.selectionStyle = UITableViewCellSelectionStyleDefault; 22 | } 23 | return self; 24 | } 25 | 26 | 27 | - (void)setTableViewCell:(PYTableViewCell *)tableViewCell 28 | { 29 | [super setTableViewCell:tableViewCell]; 30 | 31 | [self.tableViewCell.labelView removeFromSuperview]; 32 | if (self.label) { // 有自定义label 33 | // 封装一个self.label 34 | UILabel *tempView = [[UILabel alloc] init]; 35 | [tempView addSubview:self.label]; 36 | self.tableViewCell.labelView = tempView; 37 | [self.tableViewCell.contentView addSubview:tempView]; 38 | } else { 39 | UILabel *label = [[UILabel alloc] init]; 40 | label.text = self.text; 41 | label.textAlignment = NSTextAlignmentCenter; 42 | label.frame = self.tableViewCell.bounds; 43 | label.backgroundColor = [UIColor clearColor]; 44 | self.tableViewCell.labelView = label; 45 | [self.tableViewCell.contentView addSubview:label]; 46 | } 47 | 48 | } 49 | 50 | + (instancetype)cellWithText:(NSString *)text 51 | { 52 | PYLabelCell *cell = [[self alloc] init]; 53 | cell.text = text; 54 | return cell; 55 | } 56 | 57 | + (instancetype)cellWithText:(NSString *)text didSelectedCell:(PYTableViewCellBlock)option 58 | { 59 | PYLabelCell *cell = [self cellWithText:text]; 60 | cell.option = option; 61 | return cell; 62 | } 63 | 64 | + (instancetype)cellWithLabel:(UILabel *)label 65 | { 66 | PYLabelCell *cell = [[self alloc] init]; 67 | cell.label = label; 68 | return cell; 69 | } 70 | 71 | + (instancetype)cellWithLabel:(UILabel *)label didSelectedCell:(PYTableViewCellBlock)option 72 | { 73 | PYLabelCell *cell = [self cellWithLabel:label]; 74 | cell.option = option; 75 | return cell; 76 | } 77 | 78 | 79 | @end 80 | -------------------------------------------------------------------------------- /PYTableViewController/Model/PYSwitchCell.h: -------------------------------------------------------------------------------- 1 | // 代码地址: https://github.com/iphone5solo/PYTableViewController 2 | // 代码地址: http://code4app.com/thread-8530-1-1.html 3 | // Created by CoderKo1o. 4 | // Copyright © 2016年 iphone5solo. All rights reserved. 5 | // 6 | 7 | #import "PYCell.h" 8 | @class PYTableViewCell; 9 | typedef void(^PYSwitchCellBlock)(UISwitch *switchButton, PYTableViewCell *tableViewCell, UITableView *tableView); 10 | 11 | @interface PYSwitchCell : PYCell 12 | /** 开关按钮 */ 13 | @property (nonatomic, strong) UISwitch *switchButton; 14 | 15 | /** 点击switcButton所作的操作 */ 16 | @property (nonatomic, copy) PYSwitchCellBlock opeation; 17 | 18 | + (instancetype)cellWithTitle:(NSString *)title didClickSwitchButton:(PYSwitchCellBlock) option; 19 | + (instancetype)cellWithTitle:(NSString *)title icon:(NSString *)icon didClickSwitchButton:(PYSwitchCellBlock) option; 20 | + (instancetype)cellWithTitle:(NSString *)title icon:(NSString *)icon backgroundImage:(NSString *)backgroundImage didClickSwitchButton:(PYSwitchCellBlock) option; 21 | 22 | @end 23 | -------------------------------------------------------------------------------- /PYTableViewController/Model/PYSwitchCell.m: -------------------------------------------------------------------------------- 1 | // 代码地址: https://github.com/iphone5solo/PYTableViewController 2 | // 代码地址: http://code4app.com/thread-8530-1-1.html 3 | // Created by CoderKo1o. 4 | // Copyright © 2016年 iphone5solo. All rights reserved. 5 | // 6 | 7 | #import "PYSwitchCell.h" 8 | #import "PYTableViewCell.h" 9 | 10 | @implementation PYSwitchCell 11 | 12 | - (instancetype)init 13 | { 14 | if (self = [super init]) { 15 | UISwitch *switchButton = [[UISwitch alloc] init]; 16 | self.switchButton = switchButton; 17 | [self.switchButton addTarget:self action:@selector(didClicked:) forControlEvents:UIControlEventValueChanged]; 18 | self.selectionStyle = UITableViewCellSelectionStyleNone; 19 | self.accessoryView = self.switchButton; 20 | } 21 | return self; 22 | } 23 | 24 | - (void)didClicked:(UISwitch *)sender 25 | { 26 | if (self.opeation) self.opeation(sender, self.tableViewCell, self.tableViewCell.tableView); 27 | } 28 | 29 | + (instancetype)cellWithTitle:(NSString *)title icon:(NSString *)icon didClickSwitchButton:(PYSwitchCellBlock) option 30 | { 31 | PYSwitchCell *cell = [self cellWithTitle:title icon:icon]; 32 | cell.opeation = option; 33 | return cell; 34 | } 35 | 36 | + (instancetype)cellWithTitle:(NSString *)title didClickSwitchButton:(PYSwitchCellBlock) option 37 | { 38 | PYSwitchCell *cell = [self cellWithTitle:title]; 39 | cell.opeation = option; 40 | return cell; 41 | } 42 | 43 | 44 | 45 | + (instancetype)cellWithTitle:(NSString *)title icon:(NSString *)icon backgroundImage:(NSString *)backgroundImage didClickSwitchButton:(PYSwitchCellBlock) option 46 | { 47 | PYSwitchCell *cell = [self cellWithTitle:title icon:icon backgroundImage:backgroundImage]; 48 | cell.opeation = option; 49 | return cell; 50 | } 51 | 52 | @end 53 | -------------------------------------------------------------------------------- /PYTableViewController/Other/PYConst.h: -------------------------------------------------------------------------------- 1 | #import 2 | #import "UIView+extension.h" 3 | 4 | #define PYMargin 10 5 | 6 | // 颜色 7 | #define PYColor(r,g,b) [UIColor colorWithRed:(r/255.0) green:(g/255.0) blue:(b/255.0) alpha:1.0] 8 | #define PYRandomColor PYColor(arc4random_uniform(256),arc4random_uniform(256),arc4random_uniform(256)) 9 | 10 | // 屏幕宽高 11 | #define PYScreenW [UIScreen mainScreen].bounds.size.width 12 | #define PYScreenH [UIScreen mainScreen].bounds.size.height 13 | 14 | // 分隔线颜色 15 | #define PYTableViewCellSeparatorColor PYColor(223, 223, 223) 16 | // 分隔线的左边距 17 | #define PYTableViewCellSeparatorMarginLeft 20 18 | // 分隔线样式 19 | typedef NS_ENUM(NSInteger, PYTableViewCellSeparatorStyle) { 20 | PYTableViewCellSeparatorStyleDefault = 0, // 系统默认分隔线 21 | PYTableViewCellSeparatorStyleNone = 1, // 没有分隔线 22 | PYTableViewCellSeparatorStyleLongSingleLine = 2, // 占据整个cell宽度的分隔线 23 | PYTableViewCellSeparatorStyleMarginSingleLine = 3, // 分割线左边带有一定间距(一般用在左边有imageView,分隔线左边距就是相当于imageView的x) 24 | PYTableViewCellSeparatorStyleCustomView // 自定义分割线 25 | }; -------------------------------------------------------------------------------- /PYTableViewController/Other/PYConst.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ko1o/PYTableViewController/fcca83b7eeb09f279445eac58c35badb347867fe/PYTableViewController/Other/PYConst.m -------------------------------------------------------------------------------- /PYTableViewController/View/PYTableViewCell.h: -------------------------------------------------------------------------------- 1 | // 代码地址: https://github.com/iphone5solo/PYTableViewController 2 | // 代码地址: http://code4app.com/thread-8530-1-1.html 3 | // Created by CoderKo1o. 4 | // Copyright © 2016年 iphone5solo. All rights reserved. 5 | // 6 | 7 | #import 8 | #import "PYConst.h" 9 | 10 | @class PYCell; 11 | 12 | @protocol PYTableViewCellDelegate 13 | 14 | 15 | @end 16 | 17 | @protocol PYTableViewCellDataSource 18 | 19 | @end 20 | 21 | @interface PYTableViewCell : UITableViewCell 22 | 23 | @property (nonatomic, weak) id delegate; 24 | @property (nonatomic, weak) id dataSource; 25 | 26 | /** cell的模型*/ 27 | @property (nonatomic, strong) PYCell *item; 28 | 29 | /** 每一个cell绑定一个tableView */ 30 | @property (nonatomic, weak) UITableView *tableView; 31 | 32 | /** 带箭头的cell的自定义辅助view */ 33 | @property (nonatomic, weak) UIButton *arrowAccessoryView; 34 | 35 | /** 带详情的cell的自定义辅助view */ 36 | @property (nonatomic, weak) UIButton *detailAccessoryView; 37 | 38 | /** 带文本按钮的cell的label */ 39 | @property (nonatomic, weak) UILabel *labelView; 40 | 41 | /** 获取cell的indexPath */ 42 | - (NSIndexPath *)indexPath; 43 | 44 | /** 设置分隔线样式 */ 45 | @property (nonatomic, assign) PYTableViewCellSeparatorStyle pyseparatorStyle; 46 | /** 设置自定义分割线(当设置了自定义,忽略separatorStyle属性) */ 47 | @property (nonatomic, strong) UIView *separatorView; 48 | 49 | + (instancetype)cellWithTableView:(UITableView *)tableView; 50 | 51 | + (instancetype)cellWithTableView:(UITableView *)tableView withTableViewCellStyle:(UITableViewCellStyle)style; 52 | 53 | 54 | @end 55 | -------------------------------------------------------------------------------- /PYTableViewController/View/PYTableViewCell.m: -------------------------------------------------------------------------------- 1 | // 代码地址: https://github.com/iphone5solo/PYTableViewController 2 | // 代码地址: http://code4app.com/thread-8530-1-1.html 3 | // Created by CoderKo1o. 4 | // Copyright © 2016年 iphone5solo. All rights reserved. 5 | // 6 | 7 | #import "PYTableViewCell.h" 8 | #import "PYCell.h" 9 | #import "PYArrowCell.h" 10 | #import "PYSwitchCell.h" 11 | #import "PYDetailCell.h" 12 | #import "PYLabelCell.h" 13 | #import "PYCheckCell.h" 14 | 15 | @interface PYTableViewCell () 16 | 17 | /** 用来包装separatorView */ 18 | @property (nonatomic, strong) UIView *separatorViewCopy; 19 | 20 | @end 21 | 22 | @implementation PYTableViewCell 23 | 24 | #pragma mark - 懒加载 25 | 26 | 27 | // 重用cell的ID 28 | static NSString *ID = @"PYCell"; 29 | 30 | #pragma mark - 初始化 31 | + (instancetype)cellWithTableView:(UITableView *)tableView 32 | { 33 | // 从缓存池查找Cell 34 | PYTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:ID]; 35 | if (!cell) { 36 | cell = [[PYTableViewCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:ID]; 37 | cell.tableView = tableView; 38 | 39 | } 40 | return cell; 41 | } 42 | 43 | + (instancetype)cellWithTableView:(UITableView *)tableView withTableViewCellStyle:(UITableViewCellStyle)style 44 | { 45 | // 从缓存池查找Cell 46 | PYTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:ID]; 47 | if (!cell) { 48 | cell = [[PYTableViewCell alloc] initWithStyle:style reuseIdentifier:ID]; 49 | cell.tableView = tableView; 50 | } 51 | return cell; 52 | } 53 | 54 | 55 | // 设置分隔线样式 56 | - (void)setPyseparatorStyle:(PYTableViewCellSeparatorStyle)pyseparatorStyle 57 | { 58 | _pyseparatorStyle = pyseparatorStyle; 59 | 60 | if (self.pyseparatorStyle == PYTableViewCellSeparatorStyleDefault) return; 61 | 62 | [self.separatorViewCopy removeFromSuperview]; // 先移除 63 | 64 | UIView *separatorView = [self.separatorView copy]; 65 | 66 | self.separatorViewCopy = separatorView; 67 | if (self.pyseparatorStyle == PYTableViewCellSeparatorStyleCustomView) { // 自定义分隔线 68 | [self addSubview:self.separatorViewCopy]; 69 | return; 70 | } 71 | separatorView.height = 0.5; 72 | separatorView.width = self.width; 73 | separatorView.y = self.height - separatorView.height; 74 | separatorView.backgroundColor = PYTableViewCellSeparatorColor; 75 | if (self.pyseparatorStyle == PYTableViewCellSeparatorStyleLongSingleLine) { 76 | separatorView.x = 0; 77 | [self addSubview:separatorView]; 78 | } else if (self.pyseparatorStyle == PYTableViewCellSeparatorStyleMarginSingleLine) { 79 | separatorView.x = PYTableViewCellSeparatorMarginLeft; 80 | [self addSubview:separatorView]; 81 | } 82 | } 83 | 84 | // 设置自定义分隔线 85 | - (void)setSeparatorView:(UIView *)separatorView 86 | { 87 | _separatorView = separatorView; 88 | 89 | // 如果没有自定义就返回 90 | if (!separatorView) return; 91 | 92 | // 取消系统自带的分隔线 93 | self.tableView.separatorStyle = UITableViewCellSeparatorStyleNone; 94 | 95 | // 设置样式为自定义 96 | [self setPyseparatorStyle:PYTableViewCellSeparatorStyleCustomView]; 97 | } 98 | 99 | 100 | - (NSIndexPath *)indexPath 101 | { 102 | return [self.tableView indexPathForCell:self]; 103 | } 104 | 105 | #pragma mark - setting 106 | - (void)setItem:(PYCell *)item 107 | { 108 | _item = item; 109 | 110 | // 设置Cell的数据 111 | self.backgroundColor = item.backgroundColor ? item.backgroundColor : [UIColor whiteColor]; 112 | self.textLabel.text = item.title; 113 | self.textLabel.font = item.titleFont ? item.titleFont : [UIFont systemFontOfSize:18]; 114 | self.textLabel.textColor = item.titleColor ? item.titleColor : [UIColor blackColor]; 115 | self.detailTextLabel.text = item.accessoryTitle; 116 | self.detailTextLabel.font = item.accessoryTitleFont ? item.accessoryTitleFont : [UIFont systemFontOfSize:14]; 117 | self.detailTextLabel.textColor = item.accessoryTitleColor ? item.accessoryTitleColor : [UIColor grayColor]; 118 | self.imageView.image = item.icon.length ? [UIImage imageNamed:item.icon] : nil; 119 | self.selectionStyle = item.selectionStyle; 120 | self.accessoryType = item.accessoryType; 121 | self.accessoryView = item.accessoryView; 122 | self.backgroundView = item.backgroundImage ? [[UIImageView alloc] initWithImage:[UIImage imageNamed:item.backgroundImage]] : nil; 123 | 124 | 125 | self.arrowAccessoryView.hidden = ![item isKindOfClass:[PYArrowCell class]]; 126 | self.detailAccessoryView.hidden = ![item isKindOfClass:[PYDetailCell class]]; 127 | self.labelView.hidden = ![item isKindOfClass:[PYLabelCell class]]; 128 | } 129 | 130 | @end 131 | -------------------------------------------------------------------------------- /PYTableViewControllerExample/PYTableViewControllerExample.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 6B8248BB1CF6916B00F134F6 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 6B8248BA1CF6916B00F134F6 /* main.m */; }; 11 | 6B8248C41CF6916B00F134F6 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 6B8248C21CF6916B00F134F6 /* Main.storyboard */; }; 12 | 6B8248C61CF6916B00F134F6 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 6B8248C51CF6916B00F134F6 /* Assets.xcassets */; }; 13 | 6B8248C91CF6916B00F134F6 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 6B8248C71CF6916B00F134F6 /* LaunchScreen.storyboard */; }; 14 | 6B8248D41CF6916B00F134F6 /* PYTableViewControllerExampleTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 6B8248D31CF6916B00F134F6 /* PYTableViewControllerExampleTests.m */; }; 15 | 6B8248DF1CF6916B00F134F6 /* PYTableViewControllerExampleUITests.m in Sources */ = {isa = PBXBuildFile; fileRef = 6B8248DE1CF6916B00F134F6 /* PYTableViewControllerExampleUITests.m */; }; 16 | 6B8248F11CF691F300F134F6 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 6B8248F01CF691F300F134F6 /* AppDelegate.m */; }; 17 | 6B8248F41CF692A600F134F6 /* PYExampleTableViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 6B8248F31CF692A600F134F6 /* PYExampleTableViewController.m */; }; 18 | 6B82493E1CF6CC3600F134F6 /* PYTempViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 6B82493C1CF6CC3600F134F6 /* PYTempViewController.m */; }; 19 | 6BA280171CFC127A007FE7E8 /* UITableViewCell+Extension.m in Sources */ = {isa = PBXBuildFile; fileRef = 6BA27FF91CFC127A007FE7E8 /* UITableViewCell+Extension.m */; }; 20 | 6BA280181CFC127A007FE7E8 /* UITableViewController+Extension.m in Sources */ = {isa = PBXBuildFile; fileRef = 6BA27FFB1CFC127A007FE7E8 /* UITableViewController+Extension.m */; }; 21 | 6BA280191CFC127A007FE7E8 /* UIView+extension.m in Sources */ = {isa = PBXBuildFile; fileRef = 6BA27FFD1CFC127A007FE7E8 /* UIView+extension.m */; }; 22 | 6BA2801A1CFC127A007FE7E8 /* PYTableViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 6BA280001CFC127A007FE7E8 /* PYTableViewController.m */; }; 23 | 6BA2801B1CFC127A007FE7E8 /* PYArrowCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 6BA280031CFC127A007FE7E8 /* PYArrowCell.m */; }; 24 | 6BA2801C1CFC127A007FE7E8 /* PYCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 6BA280051CFC127A007FE7E8 /* PYCell.m */; }; 25 | 6BA2801D1CFC127A007FE7E8 /* PYCheckCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 6BA280071CFC127A007FE7E8 /* PYCheckCell.m */; }; 26 | 6BA2801E1CFC127A007FE7E8 /* PYDetailCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 6BA280091CFC127A007FE7E8 /* PYDetailCell.m */; }; 27 | 6BA2801F1CFC127A007FE7E8 /* PYGroup.m in Sources */ = {isa = PBXBuildFile; fileRef = 6BA2800B1CFC127A007FE7E8 /* PYGroup.m */; }; 28 | 6BA280201CFC127A007FE7E8 /* PYLabelCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 6BA2800D1CFC127A007FE7E8 /* PYLabelCell.m */; }; 29 | 6BA280211CFC127A007FE7E8 /* PYSwitchCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 6BA2800F1CFC127A007FE7E8 /* PYSwitchCell.m */; }; 30 | 6BA280221CFC127A007FE7E8 /* PYConst.m in Sources */ = {isa = PBXBuildFile; fileRef = 6BA280121CFC127A007FE7E8 /* PYConst.m */; }; 31 | 6BA280231CFC127A007FE7E8 /* PYTableViewCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 6BA280151CFC127A007FE7E8 /* PYTableViewCell.m */; }; 32 | /* End PBXBuildFile section */ 33 | 34 | /* Begin PBXContainerItemProxy section */ 35 | 6B8248D01CF6916B00F134F6 /* PBXContainerItemProxy */ = { 36 | isa = PBXContainerItemProxy; 37 | containerPortal = 6B8248AE1CF6916B00F134F6 /* Project object */; 38 | proxyType = 1; 39 | remoteGlobalIDString = 6B8248B51CF6916B00F134F6; 40 | remoteInfo = PYTableViewControllerExample; 41 | }; 42 | 6B8248DB1CF6916B00F134F6 /* PBXContainerItemProxy */ = { 43 | isa = PBXContainerItemProxy; 44 | containerPortal = 6B8248AE1CF6916B00F134F6 /* Project object */; 45 | proxyType = 1; 46 | remoteGlobalIDString = 6B8248B51CF6916B00F134F6; 47 | remoteInfo = PYTableViewControllerExample; 48 | }; 49 | /* End PBXContainerItemProxy section */ 50 | 51 | /* Begin PBXFileReference section */ 52 | 6B8248B61CF6916B00F134F6 /* PYTableViewControllerExample.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = PYTableViewControllerExample.app; sourceTree = BUILT_PRODUCTS_DIR; }; 53 | 6B8248BA1CF6916B00F134F6 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; 54 | 6B8248C31CF6916B00F134F6 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 55 | 6B8248C51CF6916B00F134F6 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 56 | 6B8248C81CF6916B00F134F6 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 57 | 6B8248CA1CF6916B00F134F6 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 58 | 6B8248CF1CF6916B00F134F6 /* PYTableViewControllerExampleTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = PYTableViewControllerExampleTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 59 | 6B8248D31CF6916B00F134F6 /* PYTableViewControllerExampleTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = PYTableViewControllerExampleTests.m; sourceTree = ""; }; 60 | 6B8248D51CF6916B00F134F6 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 61 | 6B8248DA1CF6916B00F134F6 /* PYTableViewControllerExampleUITests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = PYTableViewControllerExampleUITests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 62 | 6B8248DE1CF6916B00F134F6 /* PYTableViewControllerExampleUITests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = PYTableViewControllerExampleUITests.m; sourceTree = ""; }; 63 | 6B8248E01CF6916B00F134F6 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 64 | 6B8248EF1CF691F300F134F6 /* AppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; 65 | 6B8248F01CF691F300F134F6 /* AppDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; }; 66 | 6B8248F21CF692A600F134F6 /* PYExampleTableViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PYExampleTableViewController.h; sourceTree = ""; }; 67 | 6B8248F31CF692A600F134F6 /* PYExampleTableViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PYExampleTableViewController.m; sourceTree = ""; }; 68 | 6B82493B1CF6CC3600F134F6 /* PYTempViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PYTempViewController.h; sourceTree = ""; }; 69 | 6B82493C1CF6CC3600F134F6 /* PYTempViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PYTempViewController.m; sourceTree = ""; }; 70 | 6BA27FF81CFC127A007FE7E8 /* UITableViewCell+Extension.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UITableViewCell+Extension.h"; sourceTree = ""; }; 71 | 6BA27FF91CFC127A007FE7E8 /* UITableViewCell+Extension.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UITableViewCell+Extension.m"; sourceTree = ""; }; 72 | 6BA27FFA1CFC127A007FE7E8 /* UITableViewController+Extension.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UITableViewController+Extension.h"; sourceTree = ""; }; 73 | 6BA27FFB1CFC127A007FE7E8 /* UITableViewController+Extension.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UITableViewController+Extension.m"; sourceTree = ""; }; 74 | 6BA27FFC1CFC127A007FE7E8 /* UIView+extension.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UIView+extension.h"; sourceTree = ""; }; 75 | 6BA27FFD1CFC127A007FE7E8 /* UIView+extension.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UIView+extension.m"; sourceTree = ""; }; 76 | 6BA27FFF1CFC127A007FE7E8 /* PYTableViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PYTableViewController.h; sourceTree = ""; }; 77 | 6BA280001CFC127A007FE7E8 /* PYTableViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PYTableViewController.m; sourceTree = ""; }; 78 | 6BA280021CFC127A007FE7E8 /* PYArrowCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PYArrowCell.h; sourceTree = ""; }; 79 | 6BA280031CFC127A007FE7E8 /* PYArrowCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PYArrowCell.m; sourceTree = ""; }; 80 | 6BA280041CFC127A007FE7E8 /* PYCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PYCell.h; sourceTree = ""; }; 81 | 6BA280051CFC127A007FE7E8 /* PYCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PYCell.m; sourceTree = ""; }; 82 | 6BA280061CFC127A007FE7E8 /* PYCheckCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PYCheckCell.h; sourceTree = ""; }; 83 | 6BA280071CFC127A007FE7E8 /* PYCheckCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PYCheckCell.m; sourceTree = ""; }; 84 | 6BA280081CFC127A007FE7E8 /* PYDetailCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PYDetailCell.h; sourceTree = ""; }; 85 | 6BA280091CFC127A007FE7E8 /* PYDetailCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PYDetailCell.m; sourceTree = ""; }; 86 | 6BA2800A1CFC127A007FE7E8 /* PYGroup.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PYGroup.h; sourceTree = ""; }; 87 | 6BA2800B1CFC127A007FE7E8 /* PYGroup.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PYGroup.m; sourceTree = ""; }; 88 | 6BA2800C1CFC127A007FE7E8 /* PYLabelCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PYLabelCell.h; sourceTree = ""; }; 89 | 6BA2800D1CFC127A007FE7E8 /* PYLabelCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PYLabelCell.m; sourceTree = ""; }; 90 | 6BA2800E1CFC127A007FE7E8 /* PYSwitchCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PYSwitchCell.h; sourceTree = ""; }; 91 | 6BA2800F1CFC127A007FE7E8 /* PYSwitchCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PYSwitchCell.m; sourceTree = ""; }; 92 | 6BA280111CFC127A007FE7E8 /* PYConst.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PYConst.h; sourceTree = ""; }; 93 | 6BA280121CFC127A007FE7E8 /* PYConst.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PYConst.m; sourceTree = ""; }; 94 | 6BA280141CFC127A007FE7E8 /* PYTableViewCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PYTableViewCell.h; sourceTree = ""; }; 95 | 6BA280151CFC127A007FE7E8 /* PYTableViewCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PYTableViewCell.m; sourceTree = ""; }; 96 | /* End PBXFileReference section */ 97 | 98 | /* Begin PBXFrameworksBuildPhase section */ 99 | 6B8248B31CF6916B00F134F6 /* Frameworks */ = { 100 | isa = PBXFrameworksBuildPhase; 101 | buildActionMask = 2147483647; 102 | files = ( 103 | ); 104 | runOnlyForDeploymentPostprocessing = 0; 105 | }; 106 | 6B8248CC1CF6916B00F134F6 /* Frameworks */ = { 107 | isa = PBXFrameworksBuildPhase; 108 | buildActionMask = 2147483647; 109 | files = ( 110 | ); 111 | runOnlyForDeploymentPostprocessing = 0; 112 | }; 113 | 6B8248D71CF6916B00F134F6 /* Frameworks */ = { 114 | isa = PBXFrameworksBuildPhase; 115 | buildActionMask = 2147483647; 116 | files = ( 117 | ); 118 | runOnlyForDeploymentPostprocessing = 0; 119 | }; 120 | /* End PBXFrameworksBuildPhase section */ 121 | 122 | /* Begin PBXGroup section */ 123 | 6B8248AD1CF6916B00F134F6 = { 124 | isa = PBXGroup; 125 | children = ( 126 | 6B8248B81CF6916B00F134F6 /* PYTableViewControllerExample */, 127 | 6B8248D21CF6916B00F134F6 /* PYTableViewControllerExampleTests */, 128 | 6B8248DD1CF6916B00F134F6 /* PYTableViewControllerExampleUITests */, 129 | 6B8248B71CF6916B00F134F6 /* Products */, 130 | ); 131 | sourceTree = ""; 132 | }; 133 | 6B8248B71CF6916B00F134F6 /* Products */ = { 134 | isa = PBXGroup; 135 | children = ( 136 | 6B8248B61CF6916B00F134F6 /* PYTableViewControllerExample.app */, 137 | 6B8248CF1CF6916B00F134F6 /* PYTableViewControllerExampleTests.xctest */, 138 | 6B8248DA1CF6916B00F134F6 /* PYTableViewControllerExampleUITests.xctest */, 139 | ); 140 | name = Products; 141 | sourceTree = ""; 142 | }; 143 | 6B8248B81CF6916B00F134F6 /* PYTableViewControllerExample */ = { 144 | isa = PBXGroup; 145 | children = ( 146 | 6B8248EC1CF691F300F134F6 /* Classes */, 147 | 6B8248B91CF6916B00F134F6 /* Supporting Files */, 148 | ); 149 | path = PYTableViewControllerExample; 150 | sourceTree = ""; 151 | }; 152 | 6B8248B91CF6916B00F134F6 /* Supporting Files */ = { 153 | isa = PBXGroup; 154 | children = ( 155 | 6B8248C21CF6916B00F134F6 /* Main.storyboard */, 156 | 6B8248C51CF6916B00F134F6 /* Assets.xcassets */, 157 | 6B8248C71CF6916B00F134F6 /* LaunchScreen.storyboard */, 158 | 6B8248CA1CF6916B00F134F6 /* Info.plist */, 159 | 6B8248BA1CF6916B00F134F6 /* main.m */, 160 | ); 161 | name = "Supporting Files"; 162 | sourceTree = ""; 163 | }; 164 | 6B8248D21CF6916B00F134F6 /* PYTableViewControllerExampleTests */ = { 165 | isa = PBXGroup; 166 | children = ( 167 | 6B8248D31CF6916B00F134F6 /* PYTableViewControllerExampleTests.m */, 168 | 6B8248D51CF6916B00F134F6 /* Info.plist */, 169 | ); 170 | path = PYTableViewControllerExampleTests; 171 | sourceTree = ""; 172 | }; 173 | 6B8248DD1CF6916B00F134F6 /* PYTableViewControllerExampleUITests */ = { 174 | isa = PBXGroup; 175 | children = ( 176 | 6B8248DE1CF6916B00F134F6 /* PYTableViewControllerExampleUITests.m */, 177 | 6B8248E01CF6916B00F134F6 /* Info.plist */, 178 | ); 179 | path = PYTableViewControllerExampleUITests; 180 | sourceTree = ""; 181 | }; 182 | 6B8248EC1CF691F300F134F6 /* Classes */ = { 183 | isa = PBXGroup; 184 | children = ( 185 | 6BA27FF31CFC127A007FE7E8 /* PYTableViewController */, 186 | 6B8248ED1CF691F300F134F6 /* PYExampleController */, 187 | 6B8248EE1CF691F300F134F6 /* Others */, 188 | ); 189 | path = Classes; 190 | sourceTree = ""; 191 | }; 192 | 6B8248ED1CF691F300F134F6 /* PYExampleController */ = { 193 | isa = PBXGroup; 194 | children = ( 195 | 6B8248F21CF692A600F134F6 /* PYExampleTableViewController.h */, 196 | 6B8248F31CF692A600F134F6 /* PYExampleTableViewController.m */, 197 | 6B82493B1CF6CC3600F134F6 /* PYTempViewController.h */, 198 | 6B82493C1CF6CC3600F134F6 /* PYTempViewController.m */, 199 | ); 200 | name = PYExampleController; 201 | path = Controller; 202 | sourceTree = ""; 203 | }; 204 | 6B8248EE1CF691F300F134F6 /* Others */ = { 205 | isa = PBXGroup; 206 | children = ( 207 | 6B8248EF1CF691F300F134F6 /* AppDelegate.h */, 208 | 6B8248F01CF691F300F134F6 /* AppDelegate.m */, 209 | ); 210 | path = Others; 211 | sourceTree = ""; 212 | }; 213 | 6BA27FF31CFC127A007FE7E8 /* PYTableViewController */ = { 214 | isa = PBXGroup; 215 | children = ( 216 | 6BA27FF41CFC127A007FE7E8 /* Categoty */, 217 | 6BA27FFE1CFC127A007FE7E8 /* Controller */, 218 | 6BA280011CFC127A007FE7E8 /* Model */, 219 | 6BA280101CFC127A007FE7E8 /* Other */, 220 | 6BA280131CFC127A007FE7E8 /* View */, 221 | ); 222 | name = PYTableViewController; 223 | path = ../../../PYTableViewController; 224 | sourceTree = ""; 225 | }; 226 | 6BA27FF41CFC127A007FE7E8 /* Categoty */ = { 227 | isa = PBXGroup; 228 | children = ( 229 | 6BA27FF71CFC127A007FE7E8 /* UITableView+Extension */, 230 | 6BA27FFC1CFC127A007FE7E8 /* UIView+extension.h */, 231 | 6BA27FFD1CFC127A007FE7E8 /* UIView+extension.m */, 232 | ); 233 | path = Categoty; 234 | sourceTree = ""; 235 | }; 236 | 6BA27FF71CFC127A007FE7E8 /* UITableView+Extension */ = { 237 | isa = PBXGroup; 238 | children = ( 239 | 6BA27FF81CFC127A007FE7E8 /* UITableViewCell+Extension.h */, 240 | 6BA27FF91CFC127A007FE7E8 /* UITableViewCell+Extension.m */, 241 | 6BA27FFA1CFC127A007FE7E8 /* UITableViewController+Extension.h */, 242 | 6BA27FFB1CFC127A007FE7E8 /* UITableViewController+Extension.m */, 243 | ); 244 | path = "UITableView+Extension"; 245 | sourceTree = ""; 246 | }; 247 | 6BA27FFE1CFC127A007FE7E8 /* Controller */ = { 248 | isa = PBXGroup; 249 | children = ( 250 | 6BA27FFF1CFC127A007FE7E8 /* PYTableViewController.h */, 251 | 6BA280001CFC127A007FE7E8 /* PYTableViewController.m */, 252 | ); 253 | path = Controller; 254 | sourceTree = ""; 255 | }; 256 | 6BA280011CFC127A007FE7E8 /* Model */ = { 257 | isa = PBXGroup; 258 | children = ( 259 | 6BA280021CFC127A007FE7E8 /* PYArrowCell.h */, 260 | 6BA280031CFC127A007FE7E8 /* PYArrowCell.m */, 261 | 6BA280041CFC127A007FE7E8 /* PYCell.h */, 262 | 6BA280051CFC127A007FE7E8 /* PYCell.m */, 263 | 6BA280061CFC127A007FE7E8 /* PYCheckCell.h */, 264 | 6BA280071CFC127A007FE7E8 /* PYCheckCell.m */, 265 | 6BA280081CFC127A007FE7E8 /* PYDetailCell.h */, 266 | 6BA280091CFC127A007FE7E8 /* PYDetailCell.m */, 267 | 6BA2800A1CFC127A007FE7E8 /* PYGroup.h */, 268 | 6BA2800B1CFC127A007FE7E8 /* PYGroup.m */, 269 | 6BA2800C1CFC127A007FE7E8 /* PYLabelCell.h */, 270 | 6BA2800D1CFC127A007FE7E8 /* PYLabelCell.m */, 271 | 6BA2800E1CFC127A007FE7E8 /* PYSwitchCell.h */, 272 | 6BA2800F1CFC127A007FE7E8 /* PYSwitchCell.m */, 273 | ); 274 | path = Model; 275 | sourceTree = ""; 276 | }; 277 | 6BA280101CFC127A007FE7E8 /* Other */ = { 278 | isa = PBXGroup; 279 | children = ( 280 | 6BA280111CFC127A007FE7E8 /* PYConst.h */, 281 | 6BA280121CFC127A007FE7E8 /* PYConst.m */, 282 | ); 283 | path = Other; 284 | sourceTree = ""; 285 | }; 286 | 6BA280131CFC127A007FE7E8 /* View */ = { 287 | isa = PBXGroup; 288 | children = ( 289 | 6BA280141CFC127A007FE7E8 /* PYTableViewCell.h */, 290 | 6BA280151CFC127A007FE7E8 /* PYTableViewCell.m */, 291 | ); 292 | path = View; 293 | sourceTree = ""; 294 | }; 295 | /* End PBXGroup section */ 296 | 297 | /* Begin PBXNativeTarget section */ 298 | 6B8248B51CF6916B00F134F6 /* PYTableViewControllerExample */ = { 299 | isa = PBXNativeTarget; 300 | buildConfigurationList = 6B8248E31CF6916B00F134F6 /* Build configuration list for PBXNativeTarget "PYTableViewControllerExample" */; 301 | buildPhases = ( 302 | 6B8248B21CF6916B00F134F6 /* Sources */, 303 | 6B8248B31CF6916B00F134F6 /* Frameworks */, 304 | 6B8248B41CF6916B00F134F6 /* Resources */, 305 | ); 306 | buildRules = ( 307 | ); 308 | dependencies = ( 309 | ); 310 | name = PYTableViewControllerExample; 311 | productName = PYTableViewControllerExample; 312 | productReference = 6B8248B61CF6916B00F134F6 /* PYTableViewControllerExample.app */; 313 | productType = "com.apple.product-type.application"; 314 | }; 315 | 6B8248CE1CF6916B00F134F6 /* PYTableViewControllerExampleTests */ = { 316 | isa = PBXNativeTarget; 317 | buildConfigurationList = 6B8248E61CF6916B00F134F6 /* Build configuration list for PBXNativeTarget "PYTableViewControllerExampleTests" */; 318 | buildPhases = ( 319 | 6B8248CB1CF6916B00F134F6 /* Sources */, 320 | 6B8248CC1CF6916B00F134F6 /* Frameworks */, 321 | 6B8248CD1CF6916B00F134F6 /* Resources */, 322 | ); 323 | buildRules = ( 324 | ); 325 | dependencies = ( 326 | 6B8248D11CF6916B00F134F6 /* PBXTargetDependency */, 327 | ); 328 | name = PYTableViewControllerExampleTests; 329 | productName = PYTableViewControllerExampleTests; 330 | productReference = 6B8248CF1CF6916B00F134F6 /* PYTableViewControllerExampleTests.xctest */; 331 | productType = "com.apple.product-type.bundle.unit-test"; 332 | }; 333 | 6B8248D91CF6916B00F134F6 /* PYTableViewControllerExampleUITests */ = { 334 | isa = PBXNativeTarget; 335 | buildConfigurationList = 6B8248E91CF6916B00F134F6 /* Build configuration list for PBXNativeTarget "PYTableViewControllerExampleUITests" */; 336 | buildPhases = ( 337 | 6B8248D61CF6916B00F134F6 /* Sources */, 338 | 6B8248D71CF6916B00F134F6 /* Frameworks */, 339 | 6B8248D81CF6916B00F134F6 /* Resources */, 340 | ); 341 | buildRules = ( 342 | ); 343 | dependencies = ( 344 | 6B8248DC1CF6916B00F134F6 /* PBXTargetDependency */, 345 | ); 346 | name = PYTableViewControllerExampleUITests; 347 | productName = PYTableViewControllerExampleUITests; 348 | productReference = 6B8248DA1CF6916B00F134F6 /* PYTableViewControllerExampleUITests.xctest */; 349 | productType = "com.apple.product-type.bundle.ui-testing"; 350 | }; 351 | /* End PBXNativeTarget section */ 352 | 353 | /* Begin PBXProject section */ 354 | 6B8248AE1CF6916B00F134F6 /* Project object */ = { 355 | isa = PBXProject; 356 | attributes = { 357 | LastUpgradeCheck = 0730; 358 | ORGANIZATIONNAME = iphone5solo; 359 | TargetAttributes = { 360 | 6B8248B51CF6916B00F134F6 = { 361 | CreatedOnToolsVersion = 7.3.1; 362 | }; 363 | 6B8248CE1CF6916B00F134F6 = { 364 | CreatedOnToolsVersion = 7.3.1; 365 | TestTargetID = 6B8248B51CF6916B00F134F6; 366 | }; 367 | 6B8248D91CF6916B00F134F6 = { 368 | CreatedOnToolsVersion = 7.3.1; 369 | TestTargetID = 6B8248B51CF6916B00F134F6; 370 | }; 371 | }; 372 | }; 373 | buildConfigurationList = 6B8248B11CF6916B00F134F6 /* Build configuration list for PBXProject "PYTableViewControllerExample" */; 374 | compatibilityVersion = "Xcode 3.2"; 375 | developmentRegion = English; 376 | hasScannedForEncodings = 0; 377 | knownRegions = ( 378 | en, 379 | Base, 380 | ); 381 | mainGroup = 6B8248AD1CF6916B00F134F6; 382 | productRefGroup = 6B8248B71CF6916B00F134F6 /* Products */; 383 | projectDirPath = ""; 384 | projectRoot = ""; 385 | targets = ( 386 | 6B8248B51CF6916B00F134F6 /* PYTableViewControllerExample */, 387 | 6B8248CE1CF6916B00F134F6 /* PYTableViewControllerExampleTests */, 388 | 6B8248D91CF6916B00F134F6 /* PYTableViewControllerExampleUITests */, 389 | ); 390 | }; 391 | /* End PBXProject section */ 392 | 393 | /* Begin PBXResourcesBuildPhase section */ 394 | 6B8248B41CF6916B00F134F6 /* Resources */ = { 395 | isa = PBXResourcesBuildPhase; 396 | buildActionMask = 2147483647; 397 | files = ( 398 | 6B8248C91CF6916B00F134F6 /* LaunchScreen.storyboard in Resources */, 399 | 6B8248C61CF6916B00F134F6 /* Assets.xcassets in Resources */, 400 | 6B8248C41CF6916B00F134F6 /* Main.storyboard in Resources */, 401 | ); 402 | runOnlyForDeploymentPostprocessing = 0; 403 | }; 404 | 6B8248CD1CF6916B00F134F6 /* Resources */ = { 405 | isa = PBXResourcesBuildPhase; 406 | buildActionMask = 2147483647; 407 | files = ( 408 | ); 409 | runOnlyForDeploymentPostprocessing = 0; 410 | }; 411 | 6B8248D81CF6916B00F134F6 /* Resources */ = { 412 | isa = PBXResourcesBuildPhase; 413 | buildActionMask = 2147483647; 414 | files = ( 415 | ); 416 | runOnlyForDeploymentPostprocessing = 0; 417 | }; 418 | /* End PBXResourcesBuildPhase section */ 419 | 420 | /* Begin PBXSourcesBuildPhase section */ 421 | 6B8248B21CF6916B00F134F6 /* Sources */ = { 422 | isa = PBXSourcesBuildPhase; 423 | buildActionMask = 2147483647; 424 | files = ( 425 | 6BA280201CFC127A007FE7E8 /* PYLabelCell.m in Sources */, 426 | 6BA280221CFC127A007FE7E8 /* PYConst.m in Sources */, 427 | 6BA2801F1CFC127A007FE7E8 /* PYGroup.m in Sources */, 428 | 6BA2801C1CFC127A007FE7E8 /* PYCell.m in Sources */, 429 | 6BA2801E1CFC127A007FE7E8 /* PYDetailCell.m in Sources */, 430 | 6BA280211CFC127A007FE7E8 /* PYSwitchCell.m in Sources */, 431 | 6BA280181CFC127A007FE7E8 /* UITableViewController+Extension.m in Sources */, 432 | 6BA280231CFC127A007FE7E8 /* PYTableViewCell.m in Sources */, 433 | 6BA2801A1CFC127A007FE7E8 /* PYTableViewController.m in Sources */, 434 | 6BA280171CFC127A007FE7E8 /* UITableViewCell+Extension.m in Sources */, 435 | 6B8248F11CF691F300F134F6 /* AppDelegate.m in Sources */, 436 | 6B8248BB1CF6916B00F134F6 /* main.m in Sources */, 437 | 6BA2801B1CFC127A007FE7E8 /* PYArrowCell.m in Sources */, 438 | 6B8248F41CF692A600F134F6 /* PYExampleTableViewController.m in Sources */, 439 | 6BA280191CFC127A007FE7E8 /* UIView+extension.m in Sources */, 440 | 6B82493E1CF6CC3600F134F6 /* PYTempViewController.m in Sources */, 441 | 6BA2801D1CFC127A007FE7E8 /* PYCheckCell.m in Sources */, 442 | ); 443 | runOnlyForDeploymentPostprocessing = 0; 444 | }; 445 | 6B8248CB1CF6916B00F134F6 /* Sources */ = { 446 | isa = PBXSourcesBuildPhase; 447 | buildActionMask = 2147483647; 448 | files = ( 449 | 6B8248D41CF6916B00F134F6 /* PYTableViewControllerExampleTests.m in Sources */, 450 | ); 451 | runOnlyForDeploymentPostprocessing = 0; 452 | }; 453 | 6B8248D61CF6916B00F134F6 /* Sources */ = { 454 | isa = PBXSourcesBuildPhase; 455 | buildActionMask = 2147483647; 456 | files = ( 457 | 6B8248DF1CF6916B00F134F6 /* PYTableViewControllerExampleUITests.m in Sources */, 458 | ); 459 | runOnlyForDeploymentPostprocessing = 0; 460 | }; 461 | /* End PBXSourcesBuildPhase section */ 462 | 463 | /* Begin PBXTargetDependency section */ 464 | 6B8248D11CF6916B00F134F6 /* PBXTargetDependency */ = { 465 | isa = PBXTargetDependency; 466 | target = 6B8248B51CF6916B00F134F6 /* PYTableViewControllerExample */; 467 | targetProxy = 6B8248D01CF6916B00F134F6 /* PBXContainerItemProxy */; 468 | }; 469 | 6B8248DC1CF6916B00F134F6 /* PBXTargetDependency */ = { 470 | isa = PBXTargetDependency; 471 | target = 6B8248B51CF6916B00F134F6 /* PYTableViewControllerExample */; 472 | targetProxy = 6B8248DB1CF6916B00F134F6 /* PBXContainerItemProxy */; 473 | }; 474 | /* End PBXTargetDependency section */ 475 | 476 | /* Begin PBXVariantGroup section */ 477 | 6B8248C21CF6916B00F134F6 /* Main.storyboard */ = { 478 | isa = PBXVariantGroup; 479 | children = ( 480 | 6B8248C31CF6916B00F134F6 /* Base */, 481 | ); 482 | name = Main.storyboard; 483 | sourceTree = ""; 484 | }; 485 | 6B8248C71CF6916B00F134F6 /* LaunchScreen.storyboard */ = { 486 | isa = PBXVariantGroup; 487 | children = ( 488 | 6B8248C81CF6916B00F134F6 /* Base */, 489 | ); 490 | name = LaunchScreen.storyboard; 491 | sourceTree = ""; 492 | }; 493 | /* End PBXVariantGroup section */ 494 | 495 | /* Begin XCBuildConfiguration section */ 496 | 6B8248E11CF6916B00F134F6 /* Debug */ = { 497 | isa = XCBuildConfiguration; 498 | buildSettings = { 499 | ALWAYS_SEARCH_USER_PATHS = NO; 500 | CLANG_ANALYZER_NONNULL = YES; 501 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 502 | CLANG_CXX_LIBRARY = "libc++"; 503 | CLANG_ENABLE_MODULES = YES; 504 | CLANG_ENABLE_OBJC_ARC = YES; 505 | CLANG_WARN_BOOL_CONVERSION = YES; 506 | CLANG_WARN_CONSTANT_CONVERSION = YES; 507 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 508 | CLANG_WARN_EMPTY_BODY = YES; 509 | CLANG_WARN_ENUM_CONVERSION = YES; 510 | CLANG_WARN_INT_CONVERSION = YES; 511 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 512 | CLANG_WARN_UNREACHABLE_CODE = YES; 513 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 514 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 515 | COPY_PHASE_STRIP = NO; 516 | DEBUG_INFORMATION_FORMAT = dwarf; 517 | ENABLE_STRICT_OBJC_MSGSEND = YES; 518 | ENABLE_TESTABILITY = YES; 519 | GCC_C_LANGUAGE_STANDARD = gnu99; 520 | GCC_DYNAMIC_NO_PIC = NO; 521 | GCC_NO_COMMON_BLOCKS = YES; 522 | GCC_OPTIMIZATION_LEVEL = 0; 523 | GCC_PREPROCESSOR_DEFINITIONS = ( 524 | "DEBUG=1", 525 | "$(inherited)", 526 | ); 527 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 528 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 529 | GCC_WARN_UNDECLARED_SELECTOR = YES; 530 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 531 | GCC_WARN_UNUSED_FUNCTION = YES; 532 | GCC_WARN_UNUSED_VARIABLE = YES; 533 | IPHONEOS_DEPLOYMENT_TARGET = 9.3; 534 | MTL_ENABLE_DEBUG_INFO = YES; 535 | ONLY_ACTIVE_ARCH = YES; 536 | SDKROOT = iphoneos; 537 | }; 538 | name = Debug; 539 | }; 540 | 6B8248E21CF6916B00F134F6 /* Release */ = { 541 | isa = XCBuildConfiguration; 542 | buildSettings = { 543 | ALWAYS_SEARCH_USER_PATHS = NO; 544 | CLANG_ANALYZER_NONNULL = YES; 545 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 546 | CLANG_CXX_LIBRARY = "libc++"; 547 | CLANG_ENABLE_MODULES = YES; 548 | CLANG_ENABLE_OBJC_ARC = YES; 549 | CLANG_WARN_BOOL_CONVERSION = YES; 550 | CLANG_WARN_CONSTANT_CONVERSION = YES; 551 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 552 | CLANG_WARN_EMPTY_BODY = YES; 553 | CLANG_WARN_ENUM_CONVERSION = YES; 554 | CLANG_WARN_INT_CONVERSION = YES; 555 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 556 | CLANG_WARN_UNREACHABLE_CODE = YES; 557 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 558 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 559 | COPY_PHASE_STRIP = NO; 560 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 561 | ENABLE_NS_ASSERTIONS = NO; 562 | ENABLE_STRICT_OBJC_MSGSEND = YES; 563 | GCC_C_LANGUAGE_STANDARD = gnu99; 564 | GCC_NO_COMMON_BLOCKS = YES; 565 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 566 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 567 | GCC_WARN_UNDECLARED_SELECTOR = YES; 568 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 569 | GCC_WARN_UNUSED_FUNCTION = YES; 570 | GCC_WARN_UNUSED_VARIABLE = YES; 571 | IPHONEOS_DEPLOYMENT_TARGET = 9.3; 572 | MTL_ENABLE_DEBUG_INFO = NO; 573 | SDKROOT = iphoneos; 574 | VALIDATE_PRODUCT = YES; 575 | }; 576 | name = Release; 577 | }; 578 | 6B8248E41CF6916B00F134F6 /* Debug */ = { 579 | isa = XCBuildConfiguration; 580 | buildSettings = { 581 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 582 | GCC_PRECOMPILE_PREFIX_HEADER = NO; 583 | GCC_PREFIX_HEADER = ""; 584 | INFOPLIST_FILE = PYTableViewControllerExample/Info.plist; 585 | IPHONEOS_DEPLOYMENT_TARGET = 8.0; 586 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 587 | PRODUCT_BUNDLE_IDENTIFIER = com.NextStep.PYTableViewControllerExample; 588 | PRODUCT_NAME = "$(TARGET_NAME)"; 589 | }; 590 | name = Debug; 591 | }; 592 | 6B8248E51CF6916B00F134F6 /* Release */ = { 593 | isa = XCBuildConfiguration; 594 | buildSettings = { 595 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 596 | GCC_PRECOMPILE_PREFIX_HEADER = NO; 597 | GCC_PREFIX_HEADER = ""; 598 | INFOPLIST_FILE = PYTableViewControllerExample/Info.plist; 599 | IPHONEOS_DEPLOYMENT_TARGET = 8.0; 600 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 601 | PRODUCT_BUNDLE_IDENTIFIER = com.NextStep.PYTableViewControllerExample; 602 | PRODUCT_NAME = "$(TARGET_NAME)"; 603 | }; 604 | name = Release; 605 | }; 606 | 6B8248E71CF6916B00F134F6 /* Debug */ = { 607 | isa = XCBuildConfiguration; 608 | buildSettings = { 609 | BUNDLE_LOADER = "$(TEST_HOST)"; 610 | INFOPLIST_FILE = PYTableViewControllerExampleTests/Info.plist; 611 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 612 | PRODUCT_BUNDLE_IDENTIFIER = com.NextStep.PYTableViewControllerExampleTests; 613 | PRODUCT_NAME = "$(TARGET_NAME)"; 614 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/PYTableViewControllerExample.app/PYTableViewControllerExample"; 615 | }; 616 | name = Debug; 617 | }; 618 | 6B8248E81CF6916B00F134F6 /* Release */ = { 619 | isa = XCBuildConfiguration; 620 | buildSettings = { 621 | BUNDLE_LOADER = "$(TEST_HOST)"; 622 | INFOPLIST_FILE = PYTableViewControllerExampleTests/Info.plist; 623 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 624 | PRODUCT_BUNDLE_IDENTIFIER = com.NextStep.PYTableViewControllerExampleTests; 625 | PRODUCT_NAME = "$(TARGET_NAME)"; 626 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/PYTableViewControllerExample.app/PYTableViewControllerExample"; 627 | }; 628 | name = Release; 629 | }; 630 | 6B8248EA1CF6916B00F134F6 /* Debug */ = { 631 | isa = XCBuildConfiguration; 632 | buildSettings = { 633 | INFOPLIST_FILE = PYTableViewControllerExampleUITests/Info.plist; 634 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 635 | PRODUCT_BUNDLE_IDENTIFIER = com.NextStep.PYTableViewControllerExampleUITests; 636 | PRODUCT_NAME = "$(TARGET_NAME)"; 637 | TEST_TARGET_NAME = PYTableViewControllerExample; 638 | }; 639 | name = Debug; 640 | }; 641 | 6B8248EB1CF6916B00F134F6 /* Release */ = { 642 | isa = XCBuildConfiguration; 643 | buildSettings = { 644 | INFOPLIST_FILE = PYTableViewControllerExampleUITests/Info.plist; 645 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 646 | PRODUCT_BUNDLE_IDENTIFIER = com.NextStep.PYTableViewControllerExampleUITests; 647 | PRODUCT_NAME = "$(TARGET_NAME)"; 648 | TEST_TARGET_NAME = PYTableViewControllerExample; 649 | }; 650 | name = Release; 651 | }; 652 | /* End XCBuildConfiguration section */ 653 | 654 | /* Begin XCConfigurationList section */ 655 | 6B8248B11CF6916B00F134F6 /* Build configuration list for PBXProject "PYTableViewControllerExample" */ = { 656 | isa = XCConfigurationList; 657 | buildConfigurations = ( 658 | 6B8248E11CF6916B00F134F6 /* Debug */, 659 | 6B8248E21CF6916B00F134F6 /* Release */, 660 | ); 661 | defaultConfigurationIsVisible = 0; 662 | defaultConfigurationName = Release; 663 | }; 664 | 6B8248E31CF6916B00F134F6 /* Build configuration list for PBXNativeTarget "PYTableViewControllerExample" */ = { 665 | isa = XCConfigurationList; 666 | buildConfigurations = ( 667 | 6B8248E41CF6916B00F134F6 /* Debug */, 668 | 6B8248E51CF6916B00F134F6 /* Release */, 669 | ); 670 | defaultConfigurationIsVisible = 0; 671 | defaultConfigurationName = Release; 672 | }; 673 | 6B8248E61CF6916B00F134F6 /* Build configuration list for PBXNativeTarget "PYTableViewControllerExampleTests" */ = { 674 | isa = XCConfigurationList; 675 | buildConfigurations = ( 676 | 6B8248E71CF6916B00F134F6 /* Debug */, 677 | 6B8248E81CF6916B00F134F6 /* Release */, 678 | ); 679 | defaultConfigurationIsVisible = 0; 680 | defaultConfigurationName = Release; 681 | }; 682 | 6B8248E91CF6916B00F134F6 /* Build configuration list for PBXNativeTarget "PYTableViewControllerExampleUITests" */ = { 683 | isa = XCConfigurationList; 684 | buildConfigurations = ( 685 | 6B8248EA1CF6916B00F134F6 /* Debug */, 686 | 6B8248EB1CF6916B00F134F6 /* Release */, 687 | ); 688 | defaultConfigurationIsVisible = 0; 689 | defaultConfigurationName = Release; 690 | }; 691 | /* End XCConfigurationList section */ 692 | }; 693 | rootObject = 6B8248AE1CF6916B00F134F6 /* Project object */; 694 | } 695 | -------------------------------------------------------------------------------- /PYTableViewControllerExample/PYTableViewControllerExample.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /PYTableViewControllerExample/PYTableViewControllerExample.xcodeproj/project.xcworkspace/xcuserdata/iphone5solo.xcuserdatad/UserInterfaceState.xcuserstate: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ko1o/PYTableViewController/fcca83b7eeb09f279445eac58c35badb347867fe/PYTableViewControllerExample/PYTableViewControllerExample.xcodeproj/project.xcworkspace/xcuserdata/iphone5solo.xcuserdatad/UserInterfaceState.xcuserstate -------------------------------------------------------------------------------- /PYTableViewControllerExample/PYTableViewControllerExample.xcodeproj/xcuserdata/iphone5solo.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | -------------------------------------------------------------------------------- /PYTableViewControllerExample/PYTableViewControllerExample.xcodeproj/xcuserdata/iphone5solo.xcuserdatad/xcschemes/PYTableViewControllerExample.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 33 | 39 | 40 | 41 | 43 | 49 | 50 | 51 | 52 | 53 | 59 | 60 | 61 | 62 | 63 | 64 | 74 | 76 | 82 | 83 | 84 | 85 | 86 | 87 | 93 | 95 | 101 | 102 | 103 | 104 | 106 | 107 | 110 | 111 | 112 | -------------------------------------------------------------------------------- /PYTableViewControllerExample/PYTableViewControllerExample.xcodeproj/xcuserdata/iphone5solo.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | PYTableViewControllerExample.xcscheme 8 | 9 | orderHint 10 | 0 11 | 12 | 13 | SuppressBuildableAutocreation 14 | 15 | 6B8248B51CF6916B00F134F6 16 | 17 | primary 18 | 19 | 20 | 6B8248CE1CF6916B00F134F6 21 | 22 | primary 23 | 24 | 25 | 6B8248D91CF6916B00F134F6 26 | 27 | primary 28 | 29 | 30 | 31 | 32 | 33 | -------------------------------------------------------------------------------- /PYTableViewControllerExample/PYTableViewControllerExample/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "size" : "29x29", 6 | "scale" : "2x" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "size" : "29x29", 11 | "scale" : "3x" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "size" : "40x40", 16 | "scale" : "2x" 17 | }, 18 | { 19 | "idiom" : "iphone", 20 | "size" : "40x40", 21 | "scale" : "3x" 22 | }, 23 | { 24 | "idiom" : "iphone", 25 | "size" : "60x60", 26 | "scale" : "2x" 27 | }, 28 | { 29 | "idiom" : "iphone", 30 | "size" : "60x60", 31 | "scale" : "3x" 32 | } 33 | ], 34 | "info" : { 35 | "version" : 1, 36 | "author" : "xcode" 37 | } 38 | } -------------------------------------------------------------------------------- /PYTableViewControllerExample/PYTableViewControllerExample/Assets.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "version" : 1, 4 | "author" : "xcode" 5 | } 6 | } -------------------------------------------------------------------------------- /PYTableViewControllerExample/PYTableViewControllerExample/Assets.xcassets/setting.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "apple-1.png", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "filename" : "apple.png", 11 | "scale" : "2x" 12 | }, 13 | { 14 | "idiom" : "universal", 15 | "filename" : "apple-2.png", 16 | "scale" : "3x" 17 | } 18 | ], 19 | "info" : { 20 | "version" : 1, 21 | "author" : "xcode" 22 | } 23 | } -------------------------------------------------------------------------------- /PYTableViewControllerExample/PYTableViewControllerExample/Assets.xcassets/setting.imageset/apple-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ko1o/PYTableViewController/fcca83b7eeb09f279445eac58c35badb347867fe/PYTableViewControllerExample/PYTableViewControllerExample/Assets.xcassets/setting.imageset/apple-1.png -------------------------------------------------------------------------------- /PYTableViewControllerExample/PYTableViewControllerExample/Assets.xcassets/setting.imageset/apple-2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ko1o/PYTableViewController/fcca83b7eeb09f279445eac58c35badb347867fe/PYTableViewControllerExample/PYTableViewControllerExample/Assets.xcassets/setting.imageset/apple-2.png -------------------------------------------------------------------------------- /PYTableViewControllerExample/PYTableViewControllerExample/Assets.xcassets/setting.imageset/apple.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ko1o/PYTableViewController/fcca83b7eeb09f279445eac58c35badb347867fe/PYTableViewControllerExample/PYTableViewControllerExample/Assets.xcassets/setting.imageset/apple.png -------------------------------------------------------------------------------- /PYTableViewControllerExample/PYTableViewControllerExample/Base.lproj/LaunchScreen.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /PYTableViewControllerExample/PYTableViewControllerExample/Base.lproj/Main.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | -------------------------------------------------------------------------------- /PYTableViewControllerExample/PYTableViewControllerExample/Classes/Controller/PYExampleTableViewController.h: -------------------------------------------------------------------------------- 1 | // 代码地址: https://github.com/iphone5solo/PYTableViewController 2 | // 代码地址: http://code4app.com/thread-8530-1-1.html 3 | // Created by CoderKo1o. 4 | // Copyright © 2016年 iphone5solo. All rights reserved. 5 | // 6 | 7 | #import 8 | #import "PYTableViewController.h" 9 | 10 | @interface PYExampleTableViewController : PYTableViewController 11 | 12 | @end 13 | -------------------------------------------------------------------------------- /PYTableViewControllerExample/PYTableViewControllerExample/Classes/Controller/PYExampleTableViewController.m: -------------------------------------------------------------------------------- 1 | // 代码地址: https://github.com/iphone5solo/PYTableViewController 2 | // 代码地址: http://code4app.com/thread-8530-1-1.html 3 | // Created by CoderKo1o. 4 | // Copyright © 2016年 iphone5solo. All rights reserved. 5 | // 6 | #import "PYExampleTableViewController.h" 7 | #import "PYTempViewController.h" 8 | #import "PYTableViewCell.h" 9 | 10 | #define PYTitle @"标题" 11 | #define PYAccessoryTitle @"附加说明" 12 | #define PYIcon @"setting" 13 | 14 | @interface PYExampleTableViewController () 15 | 16 | @end 17 | 18 | @implementation PYExampleTableViewController 19 | 20 | - (void)viewDidLoad { 21 | [super viewDidLoad]; 22 | 23 | // 初始化 24 | [self setup]; 25 | 26 | // 创建组一 27 | [self createGroup1]; 28 | 29 | // 创建组二 30 | [self createGroup2]; 31 | 32 | // 创建组三 33 | [self createGroup3]; 34 | 35 | // 创建组四 36 | [self createGroup4]; 37 | 38 | // 创建组五 39 | [self createGroup5]; 40 | 41 | // 创建组六 42 | [self createGroup6]; 43 | 44 | } 45 | 46 | /** 初始化 */ 47 | - (void)setup 48 | { 49 | self.title = @"PYTableViewController"; 50 | } 51 | 52 | /** 创建第六组 */ 53 | - (void)createGroup6 54 | { 55 | PYGroup *group6 = [[PYGroup alloc] init]; 56 | group6.header = @"单选样式"; 57 | 58 | PYCheckCell *cell1 = [PYCheckCell cellWithTitle:@"男" didSelectedCell:^(PYTableViewCell *selectedCell) { 59 | // 单选选中时,执行代码写在这里 60 | NSLog(@"选中---男"); 61 | }]; 62 | PYCheckCell *cell2 = [PYCheckCell cellWithTitle:@"女" didSelectedCell:^(PYTableViewCell *selectedCell) { 63 | // 单选选中时,执行代码写在这里 64 | NSLog(@"选中---女"); 65 | }]; 66 | 67 | // 添加所有cell 68 | group6.cells = (NSMutableArray *)@[cell1, cell2]; 69 | 70 | // 添加组到所有组中 71 | [self.groups addObject:group6]; 72 | } 73 | 74 | /** 创建第五组 */ 75 | - (void)createGroup5 76 | { 77 | PYGroup *group5 = [[PYGroup alloc] init]; 78 | group5.header = @"文本按钮样式"; 79 | 80 | PYLabelCell *cell1 = [PYLabelCell cellWithText:@"退出登录" didSelectedCell:^(PYTableViewCell *selectedCell) { 81 | UIActionSheet *sheet = [[UIActionSheet alloc] initWithTitle:@"退出后不会删除任何历史数据,下次登录依然可以使用本账号" delegate:nil cancelButtonTitle:@"取消" destructiveButtonTitle:@"退出登录" otherButtonTitles:nil, nil]; 82 | [sheet showInView:self.view]; 83 | }]; 84 | 85 | // 自定义label 86 | UILabel *label = [[UILabel alloc] init]; 87 | label.text = @"自定义label"; 88 | label.textColor = PYRandomColor; 89 | label.font = [UIFont systemFontOfSize:22]; 90 | label.size = CGSizeMake(PYScreenW, 44); 91 | PYLabelCell *cell2 = [PYLabelCell cellWithLabel:label didSelectedCell:^(PYTableViewCell *selectedCell) { 92 | UIActionSheet *sheet = [[UIActionSheet alloc] initWithTitle:@"这是自定义Label的操作" delegate:nil cancelButtonTitle:@"取消" destructiveButtonTitle:@"确定" otherButtonTitles:nil, nil]; 93 | [sheet showInView:self.view]; 94 | }]; 95 | 96 | // 添加所有cell 97 | group5.cells = (NSMutableArray *)@[cell1, cell2]; 98 | 99 | // 添加组到所有组中 100 | [self.groups addObject:group5]; 101 | } 102 | 103 | 104 | /** 创建第四组 */ 105 | - (void)createGroup4 106 | { 107 | PYGroup *group4 = [[PYGroup alloc] init]; 108 | group4.header = @"详情样式"; 109 | 110 | // 执行选中详情cell的操作 111 | void (^operation)() = ^{ 112 | PYTempViewController *tempVc = [[PYTempViewController alloc] init]; 113 | [self.navigationController pushViewController:tempVc animated:YES]; 114 | }; 115 | PYDetailCell *cell1 = [PYDetailCell cellWithTitle:PYTitle didSelectedCell:^(PYTableViewCell *selectedCell) { 116 | // 执行操作代码写在这里 117 | operation(); 118 | }]; 119 | PYDetailCell *cell2 = [PYDetailCell cellWithTitle:PYTitle accessoryTitle:PYAccessoryTitle]; 120 | // 为cell2添加执行操作 121 | cell2.option = ^(PYTableViewCell *selectedCell) { 122 | // 执行操作代码写在这里 123 | operation(); 124 | }; 125 | // 自定义辅助view 126 | UIView *accessoryView1 = [[UIView alloc] initWithFrame:CGRectMake(20, 0, 30, 30)]; 127 | accessoryView1.backgroundColor = PYRandomColor; 128 | PYDetailCell *cell3 = [PYDetailCell cellWithTitle:PYTitle accessoryView:accessoryView1 didSelectedCell:^(PYTableViewCell *selectedCell) { 129 | // 执行操作代码写在这里 130 | operation(); 131 | }]; 132 | PYDetailCell *cell4 = [PYDetailCell cellWithTitle:PYTitle icon:@"setting" didSelectedCell:^(PYTableViewCell *selectedCell) { 133 | // 执行操作代码写在这里 134 | operation(); 135 | }]; 136 | 137 | // 添加所有cell 138 | group4.cells = (NSMutableArray *)@[cell1, cell2, cell3, cell4]; 139 | 140 | // 添加组到所有组中 141 | [self.groups addObject:group4]; 142 | 143 | } 144 | 145 | /** 创建第三组 */ 146 | - (void)createGroup3 147 | { 148 | PYGroup *group3 = [[PYGroup alloc] init]; 149 | group3.header = @"开关样式"; 150 | 151 | // 开关值变化时所作的操作 152 | void (^operation)(UISwitch *switchButton, PYTableViewCell *tableViewCell, UITableView *tableView) = ^(UISwitch *switchButton, PYTableViewCell *tableViewCell, UITableView *tableView){ 153 | // 根据开关状态,执行相应操作 154 | NSIndexPath *indexPath = [tableView indexPathForCell:tableViewCell]; 155 | if (switchButton.isOn) { // 开 156 | NSString *msg = [NSString stringWithFormat:@"开关状态:开\n选中的cell 组:%zd 行:%zd", indexPath.section, indexPath.row]; 157 | UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:nil message:msg delegate:nil cancelButtonTitle:@"关闭" otherButtonTitles:nil, nil]; 158 | [alertView show]; 159 | } else { // 关 160 | NSString *msg = [NSString stringWithFormat:@"开关状态:关\n选中的cell 组:%zd 行:%zd", indexPath.section, indexPath.row]; 161 | UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:nil message:msg delegate:nil cancelButtonTitle:@"关闭" otherButtonTitles:nil, nil]; 162 | [alertView show]; 163 | } 164 | }; 165 | 166 | PYSwitchCell *cell1 = [PYSwitchCell cellWithTitle:PYTitle didClickSwitchButton:^(UISwitch *switchButton, PYTableViewCell *tableViewCell, UITableView *tableView) { 167 | // switch按钮点击时执行操作代码可以写在这里 168 | operation(switchButton, tableViewCell, tableView); 169 | }]; 170 | 171 | PYSwitchCell *cell2 = [PYSwitchCell cellWithTitle:nil icon:PYIcon]; 172 | // 为switchButton添加操作 173 | cell2.opeation = ^(UISwitch *switchButton, PYTableViewCell *tableViewCell, UITableView *tableView) { 174 | // switch按钮点击时执行操作代码可以写在这里 175 | operation(switchButton, tableViewCell, tableView); 176 | }; 177 | 178 | PYSwitchCell *cell3 = [PYSwitchCell cellWithTitle:PYTitle icon:PYIcon didClickSwitchButton:^(UISwitch *switchButton, PYTableViewCell *tableViewCell, UITableView *tableView) { 179 | // switch按钮点击时执行操作代码可以写在这里 180 | operation(switchButton, tableViewCell, tableView); 181 | }]; 182 | 183 | // 添加所有cell 184 | group3.cells = (NSMutableArray *)@[cell1, cell2, cell3]; 185 | 186 | // 添加组到所有组中 187 | [self.groups addObject:group3]; 188 | } 189 | 190 | 191 | 192 | /** 创建第二组 */ 193 | - (void)createGroup2 194 | { 195 | 196 | // 执行选中cell的操作 197 | void (^operation)() = ^{ 198 | PYTempViewController *tempVc = [[PYTempViewController alloc] init]; 199 | [self.navigationController pushViewController:tempVc animated:YES]; 200 | }; 201 | // 默认样式 202 | PYArrowCell *cell1 = [PYArrowCell cellWithTitle:PYTitle didSelectedCell:^(PYTableViewCell *selectedCell) { 203 | // 执行操作,为了方便,这里以上面的block来执行操作,使用者可以直接在这里写相应的操作代码 204 | operation(); 205 | }]; 206 | 207 | PYArrowCell *cell2 = [PYArrowCell cellWithTitle:PYTitle accessoryTitle:PYAccessoryTitle didSelectedCellTarget:self action:@selector(didSelectedCell:)]; 208 | 209 | // 添加辅助视图 210 | UIView *accessoryView1 = [[UIView alloc] initWithFrame:CGRectMake(20, 0, 30, 30)]; 211 | accessoryView1.backgroundColor = PYRandomColor; 212 | PYArrowCell *cell3 = [PYArrowCell cellWithTitle:PYTitle accessoryView:accessoryView1]; 213 | cell3.target = self; 214 | cell3.action = @selector(didSelectedCell:); 215 | 216 | PYArrowCell *cell4 = [PYArrowCell cellWithTitle:PYTitle icon:PYIcon didSelectedCell:^(PYTableViewCell *selectedCell) { 217 | // 执行操作 218 | operation(); 219 | }]; 220 | PYArrowCell *cell5 = [PYArrowCell cellWithTitle:PYTitle icon:PYIcon accessoryTitle:PYAccessoryTitle didSelectedCell:^(PYTableViewCell *selectedCell) { 221 | // 执行操作 222 | operation(); 223 | }]; 224 | 225 | // 添加辅助视图 226 | UIView *accessoryView2 = [[UIView alloc] initWithFrame:CGRectMake(20, 0, 30, 30)]; 227 | accessoryView2.backgroundColor = PYRandomColor; 228 | PYArrowCell *cell6 = [PYArrowCell cellWithTitle:PYTitle icon:PYIcon accessoryView:accessoryView2 didSelectedCell:^(PYTableViewCell *selectedCell) { 229 | // 执行操作 230 | operation(); 231 | }]; 232 | 233 | // 自定义样式 234 | PYArrowCell *cell7 = [PYArrowCell cellWithTitle:PYTitle icon:PYIcon accessoryTitle:PYAccessoryTitle]; 235 | cell7.option = operation; 236 | cell7.titleFont = [UIFont boldSystemFontOfSize:25]; 237 | cell7.titleColor = PYRandomColor; 238 | cell7.accessoryTitleColor = PYRandomColor; 239 | cell7.backgroundColor = PYRandomColor; 240 | 241 | 242 | // 快速创建组并添加到所有组中 243 | [self.groups addObject:[PYGroup groupWithHeader:@"箭头样式" cells:(NSMutableArray *)@[cell1, cell2, cell3, cell4, cell5, cell6, cell7]]]; 244 | 245 | } 246 | 247 | /** 创建第一组 */ 248 | - (void)createGroup1 249 | { 250 | PYGroup *group1 = [PYGroup groupWithHeader:@"普通样式"]; 251 | // 默认样式 252 | PYCell *cell1 = [PYCell cellWithTitle:PYTitle]; 253 | PYCell *cell2 = [PYCell cellWithTitle:PYTitle accessoryTitle:PYAccessoryTitle]; 254 | // 辅助视图 255 | UIView *accessoryView1 = [[UIView alloc] initWithFrame:CGRectMake(20, 100, 30, 30)]; 256 | accessoryView1.backgroundColor = PYRandomColor; 257 | PYCell *cell3 = [PYCell cellWithTitle:PYTitle accessoryView:accessoryView1]; 258 | PYCell *cell4 = [PYCell cellWithTitle:PYTitle icon:PYIcon]; 259 | PYCell *cell5 = [PYCell cellWithTitle:PYTitle icon:PYIcon accessoryTitle:PYAccessoryTitle]; 260 | 261 | UIView *accessoryView2 = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 30, 30)]; 262 | accessoryView2.backgroundColor = PYRandomColor; 263 | PYCell *cell6 = [PYCell cellWithTitle:PYTitle icon:PYIcon accessoryView:accessoryView2]; 264 | 265 | // 自定义样式 266 | PYCell *cell7 = [PYCell cellWithTitle:PYTitle icon:PYIcon accessoryTitle:PYAccessoryTitle]; 267 | cell7.accessoryTitleFont = [UIFont systemFontOfSize:12]; 268 | cell7.accessoryTitleColor = PYRandomColor; 269 | cell7.titleColor = [UIColor greenColor]; 270 | cell7.titleFont = [UIFont boldSystemFontOfSize:25]; 271 | cell7.backgroundColor = PYRandomColor; 272 | 273 | // 添加所有cell 274 | group1.cells = (NSMutableArray *)@[cell1, cell2, cell3, cell4, cell5, cell6, cell7]; 275 | 276 | // 把组添加到所以组中 277 | [self.groups addObject:group1]; 278 | } 279 | 280 | // 选中cell时调用 281 | - (void)didSelectedCell:(PYTableViewCell *)selectedCell 282 | { 283 | NSLog(@"选中的cell---%zd--%zd", selectedCell.indexPath.section, selectedCell.indexPath.row); 284 | PYTempViewController *tempVc = [[PYTempViewController alloc] init]; 285 | [self.navigationController pushViewController:tempVc animated:YES]; 286 | } 287 | 288 | 289 | @end 290 | -------------------------------------------------------------------------------- /PYTableViewControllerExample/PYTableViewControllerExample/Classes/Controller/PYTempViewController.h: -------------------------------------------------------------------------------- 1 | // 代码地址: https://github.com/iphone5solo/PYTableViewController 2 | // 代码地址: http://code4app.com/thread-8530-1-1.html 3 | // Created by CoderKo1o. 4 | // Copyright © 2016年 iphone5solo. All rights reserved. 5 | // 6 | 7 | #import 8 | #import "PYConst.h" 9 | 10 | @interface PYTempViewController : UIViewController 11 | 12 | @end 13 | -------------------------------------------------------------------------------- /PYTableViewControllerExample/PYTableViewControllerExample/Classes/Controller/PYTempViewController.m: -------------------------------------------------------------------------------- 1 | // 代码地址: https://github.com/iphone5solo/PYTableViewController 2 | // 代码地址: http://code4app.com/thread-8530-1-1.html 3 | // Created by CoderKo1o. 4 | // Copyright © 2016年 iphone5solo. All rights reserved. 5 | // 6 | 7 | #import "PYTempViewController.h" 8 | 9 | @interface PYTempViewController () 10 | 11 | @end 12 | 13 | @implementation PYTempViewController 14 | 15 | - (void)viewDidLoad { 16 | [super viewDidLoad]; 17 | 18 | // 设置控制器标题 19 | self.title = @"tempViewComtroller"; 20 | 21 | // 设置控制器背景颜色 22 | self.view.backgroundColor = PYRandomColor; 23 | } 24 | 25 | - (void)didReceiveMemoryWarning { 26 | [super didReceiveMemoryWarning]; 27 | // Dispose of any resources that can be recreated. 28 | } 29 | 30 | @end 31 | -------------------------------------------------------------------------------- /PYTableViewControllerExample/PYTableViewControllerExample/Classes/Others/AppDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.h 3 | // PYTableViewControllerExample 4 | // 5 | // Created by 谢培艺 on 16/5/26. 6 | // Copyright © 2016年 iphone5solo. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface AppDelegate : UIResponder 12 | 13 | @property (strong, nonatomic) UIWindow *window; 14 | 15 | 16 | @end 17 | 18 | -------------------------------------------------------------------------------- /PYTableViewControllerExample/PYTableViewControllerExample/Classes/Others/AppDelegate.m: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.m 3 | // PYTableViewControllerExample 4 | // 5 | // Created by 谢培艺 on 16/5/26. 6 | // Copyright © 2016年 iphone5solo. All rights reserved. 7 | // 8 | 9 | #import "AppDelegate.h" 10 | 11 | @interface AppDelegate () 12 | 13 | @end 14 | 15 | @implementation AppDelegate 16 | 17 | 18 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { 19 | // Override point for customization after application launch. 20 | return YES; 21 | } 22 | 23 | - (void)applicationWillResignActive:(UIApplication *)application { 24 | // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state. 25 | // Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game. 26 | } 27 | 28 | - (void)applicationDidEnterBackground:(UIApplication *)application { 29 | // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later. 30 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. 31 | } 32 | 33 | - (void)applicationWillEnterForeground:(UIApplication *)application { 34 | // Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background. 35 | } 36 | 37 | - (void)applicationDidBecomeActive:(UIApplication *)application { 38 | // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface. 39 | } 40 | 41 | - (void)applicationWillTerminate:(UIApplication *)application { 42 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. 43 | } 44 | 45 | @end 46 | -------------------------------------------------------------------------------- /PYTableViewControllerExample/PYTableViewControllerExample/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | APPL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | LSRequiresIPhoneOS 24 | 25 | UILaunchStoryboardName 26 | LaunchScreen 27 | UIMainStoryboardFile 28 | Main 29 | UIRequiredDeviceCapabilities 30 | 31 | armv7 32 | 33 | UISupportedInterfaceOrientations 34 | 35 | UIInterfaceOrientationPortrait 36 | 37 | 38 | 39 | -------------------------------------------------------------------------------- /PYTableViewControllerExample/PYTableViewControllerExample/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // PYTableViewControllerExample 4 | // 5 | // Created by 谢培艺 on 16/5/26. 6 | // Copyright © 2016年 iphone5solo. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "AppDelegate.h" 11 | 12 | int main(int argc, char * argv[]) { 13 | @autoreleasepool { 14 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /PYTableViewControllerExample/PYTableViewControllerExampleTests/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | BNDL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | 24 | 25 | -------------------------------------------------------------------------------- /PYTableViewControllerExample/PYTableViewControllerExampleTests/PYTableViewControllerExampleTests.m: -------------------------------------------------------------------------------- 1 | // 2 | // PYTableViewControllerExampleTests.m 3 | // PYTableViewControllerExampleTests 4 | // 5 | // Created by 谢培艺 on 16/5/26. 6 | // Copyright © 2016年 iphone5solo. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface PYTableViewControllerExampleTests : XCTestCase 12 | 13 | @end 14 | 15 | @implementation PYTableViewControllerExampleTests 16 | 17 | - (void)setUp { 18 | [super setUp]; 19 | // Put setup code here. This method is called before the invocation of each test method in the class. 20 | } 21 | 22 | - (void)tearDown { 23 | // Put teardown code here. This method is called after the invocation of each test method in the class. 24 | [super tearDown]; 25 | } 26 | 27 | - (void)testExample { 28 | // This is an example of a functional test case. 29 | // Use XCTAssert and related functions to verify your tests produce the correct results. 30 | } 31 | 32 | - (void)testPerformanceExample { 33 | // This is an example of a performance test case. 34 | [self measureBlock:^{ 35 | // Put the code you want to measure the time of here. 36 | }]; 37 | } 38 | 39 | @end 40 | -------------------------------------------------------------------------------- /PYTableViewControllerExample/PYTableViewControllerExampleUITests/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | BNDL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | 24 | 25 | -------------------------------------------------------------------------------- /PYTableViewControllerExample/PYTableViewControllerExampleUITests/PYTableViewControllerExampleUITests.m: -------------------------------------------------------------------------------- 1 | // 2 | // PYTableViewControllerExampleUITests.m 3 | // PYTableViewControllerExampleUITests 4 | // 5 | // Created by 谢培艺 on 16/5/26. 6 | // Copyright © 2016年 iphone5solo. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface PYTableViewControllerExampleUITests : XCTestCase 12 | 13 | @end 14 | 15 | @implementation PYTableViewControllerExampleUITests 16 | 17 | - (void)setUp { 18 | [super setUp]; 19 | 20 | // Put setup code here. This method is called before the invocation of each test method in the class. 21 | 22 | // In UI tests it is usually best to stop immediately when a failure occurs. 23 | self.continueAfterFailure = NO; 24 | // UI tests must launch the application that they test. Doing this in setup will make sure it happens for each test method. 25 | [[[XCUIApplication alloc] init] launch]; 26 | 27 | // In UI tests it’s important to set the initial state - such as interface orientation - required for your tests before they run. The setUp method is a good place to do this. 28 | } 29 | 30 | - (void)tearDown { 31 | // Put teardown code here. This method is called after the invocation of each test method in the class. 32 | [super tearDown]; 33 | } 34 | 35 | - (void)testExample { 36 | // Use recording to get started writing UI tests. 37 | // Use XCTAssert and related functions to verify your tests produce the correct results. 38 | } 39 | 40 | @end 41 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # PYTableViewController 2 | - 这是一款对系统的UITableViewController的封装。通过简单的操作,快速完成一个基本的tableViewController 3 | 4 | ## 内容 5 | * 开始 6 | * [什么地方会用到PYTableViewController](#什么地方会用到PYTableViewController) 7 | * [PYTableViewController框架的主要类](#PYTableViewController框架的主要类) 8 | * 框架使用 9 | * [如何使用PYTableViewController](#如何使用PYTableViewController) 10 | * [具体使用(详情见示例程序中的PYExampleTableViewController)](#具体使用(详情见示例程序中的PYExampleTableViewController)) 11 | * [为选中cell时添加操作](#为选中cell时添加操作) 12 | 13 | * [期待](#期待) 14 | 15 | ## 什么地方会用到PYTableViewController 16 | - 几乎每个像样软件都会用到UITableViewController,所以你就可以使用到PYTableViewController 17 | - 主要用在`我的`模块、`个人信息`、`设置`等。如下是各大流行软件使用UITableViewContller的截图 18 | 19 | ![(img1)](https://github.com/iphone5solo/learngit/raw/master/imagesForPYTableViewController/IMG_0209.PNG) 20 | ![(img1)](https://github.com/iphone5solo/learngit/raw/master/imagesForPYTableViewController/IMG_0210.PNG) 21 | ![(img1)](https://github.com/iphone5solo/learngit/raw/master/imagesForPYTableViewController/IMG_0211.PNG) 22 | ![(img1)](https://github.com/iphone5solo/learngit/raw/master/imagesForPYTableViewController/IMG_0212.PNG) 23 | ![(img1)](https://github.com/iphone5solo/learngit/raw/master/imagesForPYTableViewController/IMG_0213.PNG) 24 | ![(img1)](https://github.com/iphone5solo/learngit/raw/master/imagesForPYTableViewController/IMG_0214.PNG) 25 | ![(img1)](https://github.com/iphone5solo/learngit/raw/master/imagesForPYTableViewController/IMG_0215.PNG) 26 | 27 | ## PYTableViewController框架的主要类 28 | 29 | 本框架的设计是使用MVC设计模式,所有组和cell都是通过模型`PYGroup`、`PYCell`这两个类及其子类组成 30 | 31 | ### PYCell的子类 32 | ```objc 33 | 34 | PYArrowCell PYCheckCell PYDetailCell 35 | PYLabelCell PYSwitchCell 36 | 37 | ``` 38 | 39 | ### PYTableViewController 40 | ```objc 41 | 42 | @interface PYTableViewController : UITableViewController 43 | 44 | /** tableView的所有组,包含着是PYGroup模型 */ 45 | @property (nonatomic, strong) NSMutableArray *groups; 46 | 47 | /** 选中的cell */ 48 | @property (nonatomic, strong) PYTableViewCell *selectedCell; 49 | 50 | @end 51 | 52 | ``` 53 | 54 | ### PYGroup 55 | ```objc 56 | 57 | 58 | @interface PYGroup : NSObject 59 | 60 | /** 头部标题 */ 61 | @property (nonatomic, copy) NSString *header; 62 | 63 | /** 尾部标题 */ 64 | @property (nonatomic, copy) NSString *footer; 65 | 66 | /** 每一组所有的cells,每一组都是PYCell模型 */ 67 | @property (nonatomic, strong) NSMutableArray *cells; 68 | 69 | @end 70 | 71 | ``` 72 | 73 | 74 | ## 如何使用PYTableViewController 75 | * 手动导入: 76 | - 将`PYTableViewContreoller`文件夹中的所有文件拽入项目中 77 | - 创建一个tableViewController继承`PYTableViewController` 78 | 79 | ### 具体使用(详情见示例程序中的PYExampleTableViewController): 80 | 1. 通过继承`PYTableViewController`类创建tableViewController 81 | 2. 通过模型`PYGroup`创建组group 82 | 3. 通过模型`PYCell`及其子类模型创建cell 83 | 4. 添加所有cell到group.cells数组中 84 | 5. 添加所有组到tableViewController.groups数组中 85 | 86 | 示例代码: 87 | 88 | ```objc 89 | // 以下代码是放在继承PYTableViewController的tableViewController的viewDidLoad方法中,self代表tableViewController对象 90 | 91 | // 1. 创建组group 92 | PYGroup *group = [[PYGroup alloc] init]; 93 | 94 | // 2. 创建cell 95 | PYCell *cell = [PYCell cellWithTitle:PYTitle]; 96 | 97 | // 3. 添加所有cell 98 | group.cells = (NSMutableArray *)@[cell1]; 99 | 100 | // 4. 把组添加到所以组中 101 | [self.groups addObject:group]; 102 | 103 | ``` 104 | 105 | ## 为选中cell时添加操作 106 | #### 注意:当下面两种方法同时实现,优先选用回调对象(target)和回调方法(SEL),即block不再调用 107 | 108 | * 通过回调(block) 109 | 110 | ```objc 111 | // 在创建cell时,直接通过block为选中cell添加操作。 112 | PYArrowCell *cell = [PYArrowCell cellWithTitle:PYTitle didSelectedCell:^(PYTableViewCell *selectedCell, UITableView *tableView) { 113 | // 使用者可以直接在这里写相应的操作代码 114 | }]; 115 | // 或者 116 | // 创建cell 117 | PYArrowCell *cell = [PYArrowCell cellWithTitle:PYTitle accessoryTitle:PYAccessoryTitle]; 118 | // 为cell的option属性赋值一个block添加操作 119 | cell.option = ^(PYTableViewCell *selectedCell, UITableView *tableView) { 120 | // 使用者可以直接在这里写相应的操作代码 121 | }; 122 | ``` 123 | 124 | * 通过回调对象(target)和回调方法(SEL) 125 | 126 | ```objc 127 | // 在创建cell时,直接通过添加参数taeget和action为cell添加操作 128 | PYArrowCell *cell = [PYArrowCell cellWithTitle:PYTitle accessoryTitle:PYAccessoryTitle didSelectedCellTarget:self action:@selector(didSelectedCell:)]; 129 | // 或者 130 | // 创建cell 131 | PYArrowCell *cell = [PYArrowCell cellWithTitle:PYTitle accessoryView:accessoryView1]; 132 | // 设置回调对象 133 | cell.target = self; 134 | // 设置回调方法(使用者可以直接在这个方法中添加相应的操作代码) 135 | cell.action = @selector(didSelectedCell:); 136 | ``` 137 | 138 | 139 | ## 期待 140 | - 如果在使用过程中遇到BUG,希望您呢个Issues我,谢谢(或者尝试下载最新的框架代码看看BUG修复没有) 141 | - 如果在使用过程中发现功能不够用,希望你能Issues我,我非常想为这个框架增加更多好用的功能,谢谢 142 | - 如果你想为PYTableViewController输出代码,请拼命Pull Requests我 143 | --------------------------------------------------------------------------------