├── README.md ├── TableViewSettingList.xcodeproj ├── project.pbxproj ├── project.xcworkspace │ ├── contents.xcworkspacedata │ └── xcuserdata │ │ └── wangchangfei.xcuserdatad │ │ └── UserInterfaceState.xcuserstate └── xcuserdata │ └── wangchangfei.xcuserdatad │ ├── xcdebugger │ └── Breakpoints_v2.xcbkptlist │ └── xcschemes │ ├── TableViewSettingList.xcscheme │ └── xcschememanagement.plist └── TableViewSettingList ├── AppDelegate.h ├── AppDelegate.m ├── Assets.xcassets ├── AppIcon.appiconset │ └── Contents.json ├── CellArrow.imageset │ ├── CellArrow@2x.png │ └── Contents.json ├── Contents.json └── icon │ ├── Contents.json │ ├── DeviceRankNoLikeIcon.imageset │ ├── Contents.json │ └── DeviceRankNoLikeIcon@2x.png │ ├── FootStep.imageset │ ├── Contents.json │ └── FootStep@2x.png │ ├── icon1.imageset │ ├── Contents.json │ ├── icon1@2x.png │ └── icon1@3x.png │ ├── icon2.imageset │ ├── Contents.json │ ├── icon2@2x.png │ └── icon2@3x.png │ ├── icon3.imageset │ ├── Contents.json │ ├── icon3@2x.png │ └── icon3@3x.png │ ├── icon4.imageset │ ├── Contents.json │ ├── icon4@2x.png │ └── icon4@3x.png │ ├── icon_header.imageset │ ├── Contents.json │ └── icon_header@2x.png │ └── icon_touxiang.imageset │ ├── Contents.json │ └── icon_touxiang@2x.png ├── Info.plist ├── TableViewSettingList ├── Controller │ ├── CFSettingTableViewController.h │ └── CFSettingTableViewController.m ├── Model │ ├── CFSettingArrowItem.h │ ├── CFSettingArrowItem.m │ ├── CFSettingGroup.h │ ├── CFSettingGroup.m │ ├── CFSettingIconArrowItem.h │ ├── CFSettingIconArrowItem.m │ ├── CFSettingIconItem.h │ ├── CFSettingIconItem.m │ ├── CFSettingItem.h │ ├── CFSettingItem.m │ ├── CFSettingLabelArrowItem.h │ ├── CFSettingLabelArrowItem.m │ ├── CFSettingLabelItem.h │ ├── CFSettingLabelItem.m │ ├── CFSettingSwitchItem.h │ └── CFSettingSwitchItem.m ├── TableViewSettingList.h ├── Tool │ ├── CFSaveTool.h │ ├── CFSaveTool.m │ ├── Const.h │ ├── UIColor+Hex.h │ └── UIColor+Hex.m └── View │ ├── CFIconArrowView.h │ ├── CFIconArrowView.m │ ├── CFLabelArrowView.h │ ├── CFLabelArrowView.m │ ├── CFSettingCell.h │ └── CFSettingCell.m ├── TableViewSettingListDemo ├── DemoViewController.h ├── DemoViewController.m ├── Item1ViewController.h └── Item1ViewController.m └── main.m /README.md: -------------------------------------------------------------------------------- 1 | # TableViewSettingList 2 | ### 快速实现APP中的设置界面效果 3 | ### 测试环境:Xcode 7.0,iOS 7.0 以上 4 | 5 | ![image](http://cdn.cocimg.com/bbs/attachment/Fid_19/19_332211_cb7c79b31692752.png) 6 | ![image](http://cdn.cocimg.com/bbs/attachment/Fid_19/19_332211_550ce9a4925a741.png) 7 | 8 | 9 | ### 集成步骤: 10 | 11 | ###### 0、把TableViewSettingList文件夹拽入自己项目中 12 | 13 | ###### 1、新建一个UITableViewController继承自CFSettingTableViewController 14 | 15 | ###### 2、相关代码 16 | 17 | ```swift 18 | // cell箭头名称 19 | self.icon_arrow = @"CellArrow"; 20 | 21 | //设置相关参数 22 | //cell背景颜色 23 | self.backgroundColor_Normal = [UIColor whiteColor]; 24 | 25 | //cell选中背景颜色 26 | self.backgroundColor_Selected = CFCellBackgroundColor_Highlighted; 27 | 28 | //cell右边Label字体 29 | self.rightLabelFont = [UIFont systemFontOfSize:15]; 30 | 31 | //cell右边Label文字颜色 32 | self.rightLabelFontColor = CFRightLabelTextColor; 33 | 34 | 35 | CFSettingArrowItem *item1 =[CFSettingArrowItem itemWithIcon:@"icon1" title:@"朋友圈" destVcClass:[Item1ViewController class]]; 36 | CFSettingGroup *group1 = [[CFSettingGroup alloc] init]; 37 | group1.items = @[ item1]; 38 | 39 | 40 | CFSettingArrowItem *item2 =[CFSettingArrowItem itemWithIcon:@"icon2" title:@"扫一扫" destVcClass:[Item1ViewController class]]; 41 | 42 | CFSettingArrowItem *item3 =[CFSettingArrowItem itemWithIcon:@"icon3" title:@"摇一摇"]; 43 | __weak typeof(self) weakSelf = self; 44 | item3.opration = ^{ 45 | Item1ViewController *vc = [[Item1ViewController alloc]init]; 46 | [weakSelf.navigationController pushViewController:vc animated:YES]; 47 | }; 48 | 49 | CFSettingGroup *group2 = [[CFSettingGroup alloc] init]; 50 | group2.items = @[ item2,item3 ]; 51 | 52 | 53 | CFSettingIconArrowItem *item4 =[CFSettingIconArrowItem itemWithIcon:@"icon4" title:@"附近的人" destVcClass:[Item1ViewController class]]; 54 | item4.icon_right = @"FootStep"; 55 | CFSettingGroup *group3 = [[CFSettingGroup alloc] init]; 56 | group3.items = @[ item4]; 57 | 58 | group3.header = @"头部文本"; 59 | group3.footer = @"底部文本"; 60 | group3.headerHeight = 30; 61 | group3.footerHeight = 30; 62 | 63 | 64 | CFSettingLabelArrowItem *item5 =[CFSettingLabelArrowItem itemWithIcon:@"icon2" title:@"扫一扫" destVcClass:[Item1ViewController class]]; 65 | item5.text_right = @"扫一扫扫一扫"; 66 | 67 | CFSettingLabelItem *item6 =[CFSettingLabelItem itemWithIcon:@"icon3" title:@"摇一摇"]; 68 | item6.text_right = @"摇一摇摇一摇"; 69 | CFSettingGroup *group4 = [[CFSettingGroup alloc] init]; 70 | group4.items = @[ item5,item6 ]; 71 | 72 | 73 | CFSettingSwitchItem *item7 =[CFSettingSwitchItem itemWithIcon:@"icon3" title:@"账号保护"]; 74 | // 用户第一次设置前 默认打开开关 75 | item7.defaultOn = YES; 76 | // 开关状态改变时执行的操作 77 | item7.opration_switch = ^(BOOL isON){ 78 | CFLog(@"UISwitch状态改变 %d",isON); 79 | }; 80 | 81 | BOOL isON = [CFSettingSwitchItem isONSwitchByTitle:item7.title]; 82 | CFLog(@"是否打开了开关 %d",isON); 83 | 84 | CFSettingGroup *group5 = [[CFSettingGroup alloc] init]; 85 | group5.items = @[ item7 ]; 86 | 87 | 88 | CFSettingIconItem *item8 =[CFSettingIconItem itemWithIcon:@"icon3" title:@"右边头像"]; 89 | item8.cellHeight = 60; 90 | item8.icon_right =@"icon_touxiang"; 91 | CFSettingGroup *group6 = [[CFSettingGroup alloc] init]; 92 | group6.items = @[ item8 ]; 93 | 94 | [self.dataList addObject:group1]; 95 | [self.dataList addObject:group2]; 96 | [self.dataList addObject:group3]; 97 | [self.dataList addObject:group4]; 98 | [self.dataList addObject:group5]; 99 | [self.dataList addObject:group6]; 100 | 101 | ``` 102 | -------------------------------------------------------------------------------- /TableViewSettingList.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | D5C67F4D1BB3A62C00DE5291 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = D5C67F4C1BB3A62C00DE5291 /* main.m */; }; 11 | D5C67F501BB3A62C00DE5291 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = D5C67F4F1BB3A62C00DE5291 /* AppDelegate.m */; }; 12 | D5C67F581BB3A62C00DE5291 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = D5C67F571BB3A62C00DE5291 /* Assets.xcassets */; }; 13 | D5C67F9D1BB3A81700DE5291 /* CFSettingTableViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = D5C67F841BB3A81700DE5291 /* CFSettingTableViewController.m */; settings = {ASSET_TAGS = (); }; }; 14 | D5C67F9E1BB3A81700DE5291 /* CFSettingArrowItem.m in Sources */ = {isa = PBXBuildFile; fileRef = D5C67F871BB3A81700DE5291 /* CFSettingArrowItem.m */; settings = {ASSET_TAGS = (); }; }; 15 | D5C67F9F1BB3A81700DE5291 /* CFSettingGroup.m in Sources */ = {isa = PBXBuildFile; fileRef = D5C67F891BB3A81700DE5291 /* CFSettingGroup.m */; settings = {ASSET_TAGS = (); }; }; 16 | D5C67FA01BB3A81700DE5291 /* CFSettingIconArrowItem.m in Sources */ = {isa = PBXBuildFile; fileRef = D5C67F8B1BB3A81700DE5291 /* CFSettingIconArrowItem.m */; settings = {ASSET_TAGS = (); }; }; 17 | D5C67FA11BB3A81700DE5291 /* CFSettingIconItem.m in Sources */ = {isa = PBXBuildFile; fileRef = D5C67F8D1BB3A81700DE5291 /* CFSettingIconItem.m */; settings = {ASSET_TAGS = (); }; }; 18 | D5C67FA21BB3A81700DE5291 /* CFSettingItem.m in Sources */ = {isa = PBXBuildFile; fileRef = D5C67F8F1BB3A81700DE5291 /* CFSettingItem.m */; settings = {ASSET_TAGS = (); }; }; 19 | D5C67FA31BB3A81700DE5291 /* CFSettingLabelArrowItem.m in Sources */ = {isa = PBXBuildFile; fileRef = D5C67F911BB3A81700DE5291 /* CFSettingLabelArrowItem.m */; settings = {ASSET_TAGS = (); }; }; 20 | D5C67FA41BB3A81700DE5291 /* CFSettingLabelItem.m in Sources */ = {isa = PBXBuildFile; fileRef = D5C67F931BB3A81700DE5291 /* CFSettingLabelItem.m */; settings = {ASSET_TAGS = (); }; }; 21 | D5C67FA51BB3A81700DE5291 /* CFSettingSwitchItem.m in Sources */ = {isa = PBXBuildFile; fileRef = D5C67F951BB3A81700DE5291 /* CFSettingSwitchItem.m */; settings = {ASSET_TAGS = (); }; }; 22 | D5C67FA61BB3A81700DE5291 /* CFIconArrowView.m in Sources */ = {isa = PBXBuildFile; fileRef = D5C67F981BB3A81700DE5291 /* CFIconArrowView.m */; settings = {ASSET_TAGS = (); }; }; 23 | D5C67FA71BB3A81700DE5291 /* CFLabelArrowView.m in Sources */ = {isa = PBXBuildFile; fileRef = D5C67F9A1BB3A81700DE5291 /* CFLabelArrowView.m */; settings = {ASSET_TAGS = (); }; }; 24 | D5C67FA81BB3A81700DE5291 /* CFSettingCell.m in Sources */ = {isa = PBXBuildFile; fileRef = D5C67F9C1BB3A81700DE5291 /* CFSettingCell.m */; settings = {ASSET_TAGS = (); }; }; 25 | D5C67FB51BB3AFCF00DE5291 /* CFSaveTool.m in Sources */ = {isa = PBXBuildFile; fileRef = D5C67FB41BB3AFCF00DE5291 /* CFSaveTool.m */; settings = {ASSET_TAGS = (); }; }; 26 | D5C67FB81BB3B1AE00DE5291 /* UIColor+Hex.m in Sources */ = {isa = PBXBuildFile; fileRef = D5C67FB71BB3B1AE00DE5291 /* UIColor+Hex.m */; settings = {ASSET_TAGS = (); }; }; 27 | D5C67FBC1BB3BF5000DE5291 /* DemoViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = D5C67FBB1BB3BF5000DE5291 /* DemoViewController.m */; settings = {ASSET_TAGS = (); }; }; 28 | D5C67FC31BB3EDAD00DE5291 /* Item1ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = D5C67FC21BB3EDAD00DE5291 /* Item1ViewController.m */; settings = {ASSET_TAGS = (); }; }; 29 | /* End PBXBuildFile section */ 30 | 31 | /* Begin PBXFileReference section */ 32 | D5C67F481BB3A62C00DE5291 /* TableViewSettingList.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = TableViewSettingList.app; sourceTree = BUILT_PRODUCTS_DIR; }; 33 | D5C67F4C1BB3A62C00DE5291 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; 34 | D5C67F4E1BB3A62C00DE5291 /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; 35 | D5C67F4F1BB3A62C00DE5291 /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; }; 36 | D5C67F571BB3A62C00DE5291 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 37 | D5C67F5C1BB3A62C00DE5291 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 38 | D5C67F831BB3A81700DE5291 /* CFSettingTableViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CFSettingTableViewController.h; sourceTree = ""; }; 39 | D5C67F841BB3A81700DE5291 /* CFSettingTableViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CFSettingTableViewController.m; sourceTree = ""; }; 40 | D5C67F861BB3A81700DE5291 /* CFSettingArrowItem.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CFSettingArrowItem.h; sourceTree = ""; }; 41 | D5C67F871BB3A81700DE5291 /* CFSettingArrowItem.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CFSettingArrowItem.m; sourceTree = ""; }; 42 | D5C67F881BB3A81700DE5291 /* CFSettingGroup.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CFSettingGroup.h; sourceTree = ""; }; 43 | D5C67F891BB3A81700DE5291 /* CFSettingGroup.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CFSettingGroup.m; sourceTree = ""; }; 44 | D5C67F8A1BB3A81700DE5291 /* CFSettingIconArrowItem.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CFSettingIconArrowItem.h; sourceTree = ""; }; 45 | D5C67F8B1BB3A81700DE5291 /* CFSettingIconArrowItem.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CFSettingIconArrowItem.m; sourceTree = ""; }; 46 | D5C67F8C1BB3A81700DE5291 /* CFSettingIconItem.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CFSettingIconItem.h; sourceTree = ""; }; 47 | D5C67F8D1BB3A81700DE5291 /* CFSettingIconItem.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CFSettingIconItem.m; sourceTree = ""; }; 48 | D5C67F8E1BB3A81700DE5291 /* CFSettingItem.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CFSettingItem.h; sourceTree = ""; }; 49 | D5C67F8F1BB3A81700DE5291 /* CFSettingItem.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CFSettingItem.m; sourceTree = ""; }; 50 | D5C67F901BB3A81700DE5291 /* CFSettingLabelArrowItem.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CFSettingLabelArrowItem.h; sourceTree = ""; }; 51 | D5C67F911BB3A81700DE5291 /* CFSettingLabelArrowItem.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CFSettingLabelArrowItem.m; sourceTree = ""; }; 52 | D5C67F921BB3A81700DE5291 /* CFSettingLabelItem.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CFSettingLabelItem.h; sourceTree = ""; }; 53 | D5C67F931BB3A81700DE5291 /* CFSettingLabelItem.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CFSettingLabelItem.m; sourceTree = ""; }; 54 | D5C67F941BB3A81700DE5291 /* CFSettingSwitchItem.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CFSettingSwitchItem.h; sourceTree = ""; }; 55 | D5C67F951BB3A81700DE5291 /* CFSettingSwitchItem.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CFSettingSwitchItem.m; sourceTree = ""; }; 56 | D5C67F971BB3A81700DE5291 /* CFIconArrowView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CFIconArrowView.h; sourceTree = ""; }; 57 | D5C67F981BB3A81700DE5291 /* CFIconArrowView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CFIconArrowView.m; sourceTree = ""; }; 58 | D5C67F991BB3A81700DE5291 /* CFLabelArrowView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CFLabelArrowView.h; sourceTree = ""; }; 59 | D5C67F9A1BB3A81700DE5291 /* CFLabelArrowView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CFLabelArrowView.m; sourceTree = ""; }; 60 | D5C67F9B1BB3A81700DE5291 /* CFSettingCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CFSettingCell.h; sourceTree = ""; }; 61 | D5C67F9C1BB3A81700DE5291 /* CFSettingCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CFSettingCell.m; sourceTree = ""; }; 62 | D5C67FAF1BB3ACD000DE5291 /* Const.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Const.h; sourceTree = ""; }; 63 | D5C67FB31BB3AFCF00DE5291 /* CFSaveTool.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CFSaveTool.h; sourceTree = ""; }; 64 | D5C67FB41BB3AFCF00DE5291 /* CFSaveTool.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CFSaveTool.m; sourceTree = ""; }; 65 | D5C67FB61BB3B1AE00DE5291 /* UIColor+Hex.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UIColor+Hex.h"; sourceTree = ""; }; 66 | D5C67FB71BB3B1AE00DE5291 /* UIColor+Hex.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UIColor+Hex.m"; sourceTree = ""; }; 67 | D5C67FBA1BB3BF5000DE5291 /* DemoViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DemoViewController.h; sourceTree = ""; }; 68 | D5C67FBB1BB3BF5000DE5291 /* DemoViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = DemoViewController.m; sourceTree = ""; }; 69 | D5C67FBD1BB3C19F00DE5291 /* TableViewSettingList.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TableViewSettingList.h; sourceTree = ""; }; 70 | D5C67FC11BB3EDAD00DE5291 /* Item1ViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Item1ViewController.h; sourceTree = ""; }; 71 | D5C67FC21BB3EDAD00DE5291 /* Item1ViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = Item1ViewController.m; sourceTree = ""; }; 72 | /* End PBXFileReference section */ 73 | 74 | /* Begin PBXFrameworksBuildPhase section */ 75 | D5C67F451BB3A62C00DE5291 /* Frameworks */ = { 76 | isa = PBXFrameworksBuildPhase; 77 | buildActionMask = 2147483647; 78 | files = ( 79 | ); 80 | runOnlyForDeploymentPostprocessing = 0; 81 | }; 82 | /* End PBXFrameworksBuildPhase section */ 83 | 84 | /* Begin PBXGroup section */ 85 | D5C67F3F1BB3A62C00DE5291 = { 86 | isa = PBXGroup; 87 | children = ( 88 | D5C67F4A1BB3A62C00DE5291 /* TableViewSettingList */, 89 | D5C67F491BB3A62C00DE5291 /* Products */, 90 | ); 91 | sourceTree = ""; 92 | }; 93 | D5C67F491BB3A62C00DE5291 /* Products */ = { 94 | isa = PBXGroup; 95 | children = ( 96 | D5C67F481BB3A62C00DE5291 /* TableViewSettingList.app */, 97 | ); 98 | name = Products; 99 | sourceTree = ""; 100 | }; 101 | D5C67F4A1BB3A62C00DE5291 /* TableViewSettingList */ = { 102 | isa = PBXGroup; 103 | children = ( 104 | D5C67F811BB3A81700DE5291 /* TableViewSettingList */, 105 | D5C67FB91BB3BF5000DE5291 /* TableViewSettingListDemo */, 106 | D5C67F4B1BB3A62C00DE5291 /* Supporting Files */, 107 | ); 108 | path = TableViewSettingList; 109 | sourceTree = ""; 110 | }; 111 | D5C67F4B1BB3A62C00DE5291 /* Supporting Files */ = { 112 | isa = PBXGroup; 113 | children = ( 114 | D5C67F4E1BB3A62C00DE5291 /* AppDelegate.h */, 115 | D5C67F4F1BB3A62C00DE5291 /* AppDelegate.m */, 116 | D5C67F571BB3A62C00DE5291 /* Assets.xcassets */, 117 | D5C67F5C1BB3A62C00DE5291 /* Info.plist */, 118 | D5C67F4C1BB3A62C00DE5291 /* main.m */, 119 | ); 120 | name = "Supporting Files"; 121 | sourceTree = ""; 122 | }; 123 | D5C67F811BB3A81700DE5291 /* TableViewSettingList */ = { 124 | isa = PBXGroup; 125 | children = ( 126 | D5C67FBD1BB3C19F00DE5291 /* TableViewSettingList.h */, 127 | D5C67FAD1BB3AAB000DE5291 /* Tool */, 128 | D5C67F821BB3A81700DE5291 /* Controller */, 129 | D5C67F851BB3A81700DE5291 /* Model */, 130 | D5C67F961BB3A81700DE5291 /* View */, 131 | ); 132 | path = TableViewSettingList; 133 | sourceTree = ""; 134 | }; 135 | D5C67F821BB3A81700DE5291 /* Controller */ = { 136 | isa = PBXGroup; 137 | children = ( 138 | D5C67F831BB3A81700DE5291 /* CFSettingTableViewController.h */, 139 | D5C67F841BB3A81700DE5291 /* CFSettingTableViewController.m */, 140 | ); 141 | path = Controller; 142 | sourceTree = ""; 143 | }; 144 | D5C67F851BB3A81700DE5291 /* Model */ = { 145 | isa = PBXGroup; 146 | children = ( 147 | D5C67F861BB3A81700DE5291 /* CFSettingArrowItem.h */, 148 | D5C67F871BB3A81700DE5291 /* CFSettingArrowItem.m */, 149 | D5C67F881BB3A81700DE5291 /* CFSettingGroup.h */, 150 | D5C67F891BB3A81700DE5291 /* CFSettingGroup.m */, 151 | D5C67F8A1BB3A81700DE5291 /* CFSettingIconArrowItem.h */, 152 | D5C67F8B1BB3A81700DE5291 /* CFSettingIconArrowItem.m */, 153 | D5C67F8C1BB3A81700DE5291 /* CFSettingIconItem.h */, 154 | D5C67F8D1BB3A81700DE5291 /* CFSettingIconItem.m */, 155 | D5C67F8E1BB3A81700DE5291 /* CFSettingItem.h */, 156 | D5C67F8F1BB3A81700DE5291 /* CFSettingItem.m */, 157 | D5C67F901BB3A81700DE5291 /* CFSettingLabelArrowItem.h */, 158 | D5C67F911BB3A81700DE5291 /* CFSettingLabelArrowItem.m */, 159 | D5C67F921BB3A81700DE5291 /* CFSettingLabelItem.h */, 160 | D5C67F931BB3A81700DE5291 /* CFSettingLabelItem.m */, 161 | D5C67F941BB3A81700DE5291 /* CFSettingSwitchItem.h */, 162 | D5C67F951BB3A81700DE5291 /* CFSettingSwitchItem.m */, 163 | ); 164 | path = Model; 165 | sourceTree = ""; 166 | }; 167 | D5C67F961BB3A81700DE5291 /* View */ = { 168 | isa = PBXGroup; 169 | children = ( 170 | D5C67F971BB3A81700DE5291 /* CFIconArrowView.h */, 171 | D5C67F981BB3A81700DE5291 /* CFIconArrowView.m */, 172 | D5C67F991BB3A81700DE5291 /* CFLabelArrowView.h */, 173 | D5C67F9A1BB3A81700DE5291 /* CFLabelArrowView.m */, 174 | D5C67F9B1BB3A81700DE5291 /* CFSettingCell.h */, 175 | D5C67F9C1BB3A81700DE5291 /* CFSettingCell.m */, 176 | ); 177 | path = View; 178 | sourceTree = ""; 179 | }; 180 | D5C67FAD1BB3AAB000DE5291 /* Tool */ = { 181 | isa = PBXGroup; 182 | children = ( 183 | D5C67FB61BB3B1AE00DE5291 /* UIColor+Hex.h */, 184 | D5C67FB71BB3B1AE00DE5291 /* UIColor+Hex.m */, 185 | D5C67FAF1BB3ACD000DE5291 /* Const.h */, 186 | D5C67FB31BB3AFCF00DE5291 /* CFSaveTool.h */, 187 | D5C67FB41BB3AFCF00DE5291 /* CFSaveTool.m */, 188 | ); 189 | path = Tool; 190 | sourceTree = ""; 191 | }; 192 | D5C67FB91BB3BF5000DE5291 /* TableViewSettingListDemo */ = { 193 | isa = PBXGroup; 194 | children = ( 195 | D5C67FBA1BB3BF5000DE5291 /* DemoViewController.h */, 196 | D5C67FBB1BB3BF5000DE5291 /* DemoViewController.m */, 197 | D5C67FC11BB3EDAD00DE5291 /* Item1ViewController.h */, 198 | D5C67FC21BB3EDAD00DE5291 /* Item1ViewController.m */, 199 | ); 200 | name = TableViewSettingListDemo; 201 | path = TableViewSettingList/TableViewSettingListDemo; 202 | sourceTree = SOURCE_ROOT; 203 | }; 204 | /* End PBXGroup section */ 205 | 206 | /* Begin PBXNativeTarget section */ 207 | D5C67F471BB3A62C00DE5291 /* TableViewSettingList */ = { 208 | isa = PBXNativeTarget; 209 | buildConfigurationList = D5C67F751BB3A62C00DE5291 /* Build configuration list for PBXNativeTarget "TableViewSettingList" */; 210 | buildPhases = ( 211 | D5C67F441BB3A62C00DE5291 /* Sources */, 212 | D5C67F451BB3A62C00DE5291 /* Frameworks */, 213 | D5C67F461BB3A62C00DE5291 /* Resources */, 214 | ); 215 | buildRules = ( 216 | ); 217 | dependencies = ( 218 | ); 219 | name = TableViewSettingList; 220 | productName = TableViewSettingList; 221 | productReference = D5C67F481BB3A62C00DE5291 /* TableViewSettingList.app */; 222 | productType = "com.apple.product-type.application"; 223 | }; 224 | /* End PBXNativeTarget section */ 225 | 226 | /* Begin PBXProject section */ 227 | D5C67F401BB3A62C00DE5291 /* Project object */ = { 228 | isa = PBXProject; 229 | attributes = { 230 | LastUpgradeCheck = 0700; 231 | ORGANIZATIONNAME = wangchangfei; 232 | TargetAttributes = { 233 | D5C67F471BB3A62C00DE5291 = { 234 | CreatedOnToolsVersion = 7.0; 235 | }; 236 | }; 237 | }; 238 | buildConfigurationList = D5C67F431BB3A62C00DE5291 /* Build configuration list for PBXProject "TableViewSettingList" */; 239 | compatibilityVersion = "Xcode 3.2"; 240 | developmentRegion = English; 241 | hasScannedForEncodings = 0; 242 | knownRegions = ( 243 | en, 244 | Base, 245 | ); 246 | mainGroup = D5C67F3F1BB3A62C00DE5291; 247 | productRefGroup = D5C67F491BB3A62C00DE5291 /* Products */; 248 | projectDirPath = ""; 249 | projectRoot = ""; 250 | targets = ( 251 | D5C67F471BB3A62C00DE5291 /* TableViewSettingList */, 252 | ); 253 | }; 254 | /* End PBXProject section */ 255 | 256 | /* Begin PBXResourcesBuildPhase section */ 257 | D5C67F461BB3A62C00DE5291 /* Resources */ = { 258 | isa = PBXResourcesBuildPhase; 259 | buildActionMask = 2147483647; 260 | files = ( 261 | D5C67F581BB3A62C00DE5291 /* Assets.xcassets in Resources */, 262 | ); 263 | runOnlyForDeploymentPostprocessing = 0; 264 | }; 265 | /* End PBXResourcesBuildPhase section */ 266 | 267 | /* Begin PBXSourcesBuildPhase section */ 268 | D5C67F441BB3A62C00DE5291 /* Sources */ = { 269 | isa = PBXSourcesBuildPhase; 270 | buildActionMask = 2147483647; 271 | files = ( 272 | D5C67FA21BB3A81700DE5291 /* CFSettingItem.m in Sources */, 273 | D5C67FB81BB3B1AE00DE5291 /* UIColor+Hex.m in Sources */, 274 | D5C67FA41BB3A81700DE5291 /* CFSettingLabelItem.m in Sources */, 275 | D5C67FBC1BB3BF5000DE5291 /* DemoViewController.m in Sources */, 276 | D5C67FA51BB3A81700DE5291 /* CFSettingSwitchItem.m in Sources */, 277 | D5C67FC31BB3EDAD00DE5291 /* Item1ViewController.m in Sources */, 278 | D5C67FA01BB3A81700DE5291 /* CFSettingIconArrowItem.m in Sources */, 279 | D5C67FA81BB3A81700DE5291 /* CFSettingCell.m in Sources */, 280 | D5C67FA31BB3A81700DE5291 /* CFSettingLabelArrowItem.m in Sources */, 281 | D5C67F9F1BB3A81700DE5291 /* CFSettingGroup.m in Sources */, 282 | D5C67FA11BB3A81700DE5291 /* CFSettingIconItem.m in Sources */, 283 | D5C67FA71BB3A81700DE5291 /* CFLabelArrowView.m in Sources */, 284 | D5C67F501BB3A62C00DE5291 /* AppDelegate.m in Sources */, 285 | D5C67F9E1BB3A81700DE5291 /* CFSettingArrowItem.m in Sources */, 286 | D5C67FA61BB3A81700DE5291 /* CFIconArrowView.m in Sources */, 287 | D5C67FB51BB3AFCF00DE5291 /* CFSaveTool.m in Sources */, 288 | D5C67F4D1BB3A62C00DE5291 /* main.m in Sources */, 289 | D5C67F9D1BB3A81700DE5291 /* CFSettingTableViewController.m in Sources */, 290 | ); 291 | runOnlyForDeploymentPostprocessing = 0; 292 | }; 293 | /* End PBXSourcesBuildPhase section */ 294 | 295 | /* Begin XCBuildConfiguration section */ 296 | D5C67F731BB3A62C00DE5291 /* Debug */ = { 297 | isa = XCBuildConfiguration; 298 | buildSettings = { 299 | ALWAYS_SEARCH_USER_PATHS = NO; 300 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 301 | CLANG_CXX_LIBRARY = "libc++"; 302 | CLANG_ENABLE_MODULES = YES; 303 | CLANG_ENABLE_OBJC_ARC = YES; 304 | CLANG_WARN_BOOL_CONVERSION = YES; 305 | CLANG_WARN_CONSTANT_CONVERSION = YES; 306 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 307 | CLANG_WARN_EMPTY_BODY = YES; 308 | CLANG_WARN_ENUM_CONVERSION = YES; 309 | CLANG_WARN_INT_CONVERSION = YES; 310 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 311 | CLANG_WARN_UNREACHABLE_CODE = YES; 312 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 313 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 314 | COPY_PHASE_STRIP = NO; 315 | DEBUG_INFORMATION_FORMAT = dwarf; 316 | ENABLE_STRICT_OBJC_MSGSEND = YES; 317 | ENABLE_TESTABILITY = YES; 318 | GCC_C_LANGUAGE_STANDARD = gnu99; 319 | GCC_DYNAMIC_NO_PIC = NO; 320 | GCC_NO_COMMON_BLOCKS = YES; 321 | GCC_OPTIMIZATION_LEVEL = 0; 322 | GCC_PREPROCESSOR_DEFINITIONS = ( 323 | "DEBUG=1", 324 | "$(inherited)", 325 | ); 326 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 327 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 328 | GCC_WARN_UNDECLARED_SELECTOR = YES; 329 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 330 | GCC_WARN_UNUSED_FUNCTION = YES; 331 | GCC_WARN_UNUSED_VARIABLE = YES; 332 | IPHONEOS_DEPLOYMENT_TARGET = 9.0; 333 | MTL_ENABLE_DEBUG_INFO = YES; 334 | ONLY_ACTIVE_ARCH = YES; 335 | SDKROOT = iphoneos; 336 | }; 337 | name = Debug; 338 | }; 339 | D5C67F741BB3A62C00DE5291 /* Release */ = { 340 | isa = XCBuildConfiguration; 341 | buildSettings = { 342 | ALWAYS_SEARCH_USER_PATHS = NO; 343 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 344 | CLANG_CXX_LIBRARY = "libc++"; 345 | CLANG_ENABLE_MODULES = YES; 346 | CLANG_ENABLE_OBJC_ARC = YES; 347 | CLANG_WARN_BOOL_CONVERSION = YES; 348 | CLANG_WARN_CONSTANT_CONVERSION = YES; 349 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 350 | CLANG_WARN_EMPTY_BODY = YES; 351 | CLANG_WARN_ENUM_CONVERSION = YES; 352 | CLANG_WARN_INT_CONVERSION = YES; 353 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 354 | CLANG_WARN_UNREACHABLE_CODE = YES; 355 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 356 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 357 | COPY_PHASE_STRIP = NO; 358 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 359 | ENABLE_NS_ASSERTIONS = NO; 360 | ENABLE_STRICT_OBJC_MSGSEND = YES; 361 | GCC_C_LANGUAGE_STANDARD = gnu99; 362 | GCC_NO_COMMON_BLOCKS = YES; 363 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 364 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 365 | GCC_WARN_UNDECLARED_SELECTOR = YES; 366 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 367 | GCC_WARN_UNUSED_FUNCTION = YES; 368 | GCC_WARN_UNUSED_VARIABLE = YES; 369 | IPHONEOS_DEPLOYMENT_TARGET = 9.0; 370 | MTL_ENABLE_DEBUG_INFO = NO; 371 | SDKROOT = iphoneos; 372 | VALIDATE_PRODUCT = YES; 373 | }; 374 | name = Release; 375 | }; 376 | D5C67F761BB3A62C00DE5291 /* Debug */ = { 377 | isa = XCBuildConfiguration; 378 | buildSettings = { 379 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 380 | INFOPLIST_FILE = TableViewSettingList/Info.plist; 381 | IPHONEOS_DEPLOYMENT_TARGET = 7.0; 382 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 383 | PRODUCT_BUNDLE_IDENTIFIER = com.cf.TableViewSettingList; 384 | PRODUCT_NAME = "$(TARGET_NAME)"; 385 | }; 386 | name = Debug; 387 | }; 388 | D5C67F771BB3A62C00DE5291 /* Release */ = { 389 | isa = XCBuildConfiguration; 390 | buildSettings = { 391 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 392 | INFOPLIST_FILE = TableViewSettingList/Info.plist; 393 | IPHONEOS_DEPLOYMENT_TARGET = 7.0; 394 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 395 | PRODUCT_BUNDLE_IDENTIFIER = com.cf.TableViewSettingList; 396 | PRODUCT_NAME = "$(TARGET_NAME)"; 397 | }; 398 | name = Release; 399 | }; 400 | /* End XCBuildConfiguration section */ 401 | 402 | /* Begin XCConfigurationList section */ 403 | D5C67F431BB3A62C00DE5291 /* Build configuration list for PBXProject "TableViewSettingList" */ = { 404 | isa = XCConfigurationList; 405 | buildConfigurations = ( 406 | D5C67F731BB3A62C00DE5291 /* Debug */, 407 | D5C67F741BB3A62C00DE5291 /* Release */, 408 | ); 409 | defaultConfigurationIsVisible = 0; 410 | defaultConfigurationName = Release; 411 | }; 412 | D5C67F751BB3A62C00DE5291 /* Build configuration list for PBXNativeTarget "TableViewSettingList" */ = { 413 | isa = XCConfigurationList; 414 | buildConfigurations = ( 415 | D5C67F761BB3A62C00DE5291 /* Debug */, 416 | D5C67F771BB3A62C00DE5291 /* Release */, 417 | ); 418 | defaultConfigurationIsVisible = 0; 419 | defaultConfigurationName = Release; 420 | }; 421 | /* End XCConfigurationList section */ 422 | }; 423 | rootObject = D5C67F401BB3A62C00DE5291 /* Project object */; 424 | } 425 | -------------------------------------------------------------------------------- /TableViewSettingList.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /TableViewSettingList.xcodeproj/project.xcworkspace/xcuserdata/wangchangfei.xcuserdatad/UserInterfaceState.xcuserstate: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wangchangfei/TableViewSettingList/7bba19220d9e603b8f069fac03c30d16ac42b64e/TableViewSettingList.xcodeproj/project.xcworkspace/xcuserdata/wangchangfei.xcuserdatad/UserInterfaceState.xcuserstate -------------------------------------------------------------------------------- /TableViewSettingList.xcodeproj/xcuserdata/wangchangfei.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | -------------------------------------------------------------------------------- /TableViewSettingList.xcodeproj/xcuserdata/wangchangfei.xcuserdatad/xcschemes/TableViewSettingList.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 | -------------------------------------------------------------------------------- /TableViewSettingList.xcodeproj/xcuserdata/wangchangfei.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | TableViewSettingList.xcscheme 8 | 9 | orderHint 10 | 0 11 | 12 | 13 | SuppressBuildableAutocreation 14 | 15 | D5C67F471BB3A62C00DE5291 16 | 17 | primary 18 | 19 | 20 | D5C67F601BB3A62C00DE5291 21 | 22 | primary 23 | 24 | 25 | D5C67F6B1BB3A62C00DE5291 26 | 27 | primary 28 | 29 | 30 | 31 | 32 | 33 | -------------------------------------------------------------------------------- /TableViewSettingList/AppDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.h 3 | // TableViewSettingList 4 | // 5 | // Created by wangchangfei on 15/9/24. 6 | // Copyright © 2015年 wangchangfei. 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 | -------------------------------------------------------------------------------- /TableViewSettingList/AppDelegate.m: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.m 3 | // TableViewSettingList 4 | // 5 | // Created by wangchangfei on 15/9/24. 6 | // Copyright © 2015年 wangchangfei. All rights reserved. 7 | // 8 | 9 | #import "AppDelegate.h" 10 | #import "DemoViewController.h" 11 | 12 | @interface AppDelegate () 13 | 14 | @end 15 | 16 | @implementation AppDelegate 17 | 18 | 19 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { 20 | 21 | // 创建窗口 22 | self.window = [[UIWindow alloc] init]; 23 | self.window.frame = [UIScreen mainScreen].bounds; 24 | 25 | // 设置根控制器 26 | DemoViewController *vc = [[DemoViewController alloc]init]; 27 | UINavigationController *nav = [[UINavigationController alloc] initWithRootViewController:vc]; 28 | 29 | self.window.rootViewController = nav; 30 | 31 | // 显示窗口 32 | [self.window makeKeyAndVisible]; 33 | 34 | return YES; 35 | } 36 | 37 | - (void)applicationWillResignActive:(UIApplication *)application { 38 | // 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. 39 | // 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. 40 | } 41 | 42 | - (void)applicationDidEnterBackground:(UIApplication *)application { 43 | // 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. 44 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. 45 | } 46 | 47 | - (void)applicationWillEnterForeground:(UIApplication *)application { 48 | // 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. 49 | } 50 | 51 | - (void)applicationDidBecomeActive:(UIApplication *)application { 52 | // 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. 53 | } 54 | 55 | - (void)applicationWillTerminate:(UIApplication *)application { 56 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. 57 | } 58 | 59 | @end 60 | -------------------------------------------------------------------------------- /TableViewSettingList/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 | } -------------------------------------------------------------------------------- /TableViewSettingList/Assets.xcassets/CellArrow.imageset/CellArrow@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wangchangfei/TableViewSettingList/7bba19220d9e603b8f069fac03c30d16ac42b64e/TableViewSettingList/Assets.xcassets/CellArrow.imageset/CellArrow@2x.png -------------------------------------------------------------------------------- /TableViewSettingList/Assets.xcassets/CellArrow.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x" 6 | }, 7 | { 8 | "idiom" : "universal", 9 | "filename" : "CellArrow@2x.png", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /TableViewSettingList/Assets.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "version" : 1, 4 | "author" : "xcode" 5 | } 6 | } -------------------------------------------------------------------------------- /TableViewSettingList/Assets.xcassets/icon/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "version" : 1, 4 | "author" : "xcode" 5 | } 6 | } -------------------------------------------------------------------------------- /TableViewSettingList/Assets.xcassets/icon/DeviceRankNoLikeIcon.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x" 6 | }, 7 | { 8 | "idiom" : "universal", 9 | "filename" : "DeviceRankNoLikeIcon@2x.png", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /TableViewSettingList/Assets.xcassets/icon/DeviceRankNoLikeIcon.imageset/DeviceRankNoLikeIcon@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wangchangfei/TableViewSettingList/7bba19220d9e603b8f069fac03c30d16ac42b64e/TableViewSettingList/Assets.xcassets/icon/DeviceRankNoLikeIcon.imageset/DeviceRankNoLikeIcon@2x.png -------------------------------------------------------------------------------- /TableViewSettingList/Assets.xcassets/icon/FootStep.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x" 6 | }, 7 | { 8 | "idiom" : "universal", 9 | "filename" : "FootStep@2x.png", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /TableViewSettingList/Assets.xcassets/icon/FootStep.imageset/FootStep@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wangchangfei/TableViewSettingList/7bba19220d9e603b8f069fac03c30d16ac42b64e/TableViewSettingList/Assets.xcassets/icon/FootStep.imageset/FootStep@2x.png -------------------------------------------------------------------------------- /TableViewSettingList/Assets.xcassets/icon/icon1.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x" 6 | }, 7 | { 8 | "idiom" : "universal", 9 | "filename" : "icon1@2x.png", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "filename" : "icon1@3x.png", 15 | "scale" : "3x" 16 | } 17 | ], 18 | "info" : { 19 | "version" : 1, 20 | "author" : "xcode" 21 | } 22 | } -------------------------------------------------------------------------------- /TableViewSettingList/Assets.xcassets/icon/icon1.imageset/icon1@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wangchangfei/TableViewSettingList/7bba19220d9e603b8f069fac03c30d16ac42b64e/TableViewSettingList/Assets.xcassets/icon/icon1.imageset/icon1@2x.png -------------------------------------------------------------------------------- /TableViewSettingList/Assets.xcassets/icon/icon1.imageset/icon1@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wangchangfei/TableViewSettingList/7bba19220d9e603b8f069fac03c30d16ac42b64e/TableViewSettingList/Assets.xcassets/icon/icon1.imageset/icon1@3x.png -------------------------------------------------------------------------------- /TableViewSettingList/Assets.xcassets/icon/icon2.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x" 6 | }, 7 | { 8 | "idiom" : "universal", 9 | "filename" : "icon2@2x.png", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "filename" : "icon2@3x.png", 15 | "scale" : "3x" 16 | } 17 | ], 18 | "info" : { 19 | "version" : 1, 20 | "author" : "xcode" 21 | } 22 | } -------------------------------------------------------------------------------- /TableViewSettingList/Assets.xcassets/icon/icon2.imageset/icon2@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wangchangfei/TableViewSettingList/7bba19220d9e603b8f069fac03c30d16ac42b64e/TableViewSettingList/Assets.xcassets/icon/icon2.imageset/icon2@2x.png -------------------------------------------------------------------------------- /TableViewSettingList/Assets.xcassets/icon/icon2.imageset/icon2@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wangchangfei/TableViewSettingList/7bba19220d9e603b8f069fac03c30d16ac42b64e/TableViewSettingList/Assets.xcassets/icon/icon2.imageset/icon2@3x.png -------------------------------------------------------------------------------- /TableViewSettingList/Assets.xcassets/icon/icon3.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x" 6 | }, 7 | { 8 | "idiom" : "universal", 9 | "filename" : "icon3@2x.png", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "filename" : "icon3@3x.png", 15 | "scale" : "3x" 16 | } 17 | ], 18 | "info" : { 19 | "version" : 1, 20 | "author" : "xcode" 21 | } 22 | } -------------------------------------------------------------------------------- /TableViewSettingList/Assets.xcassets/icon/icon3.imageset/icon3@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wangchangfei/TableViewSettingList/7bba19220d9e603b8f069fac03c30d16ac42b64e/TableViewSettingList/Assets.xcassets/icon/icon3.imageset/icon3@2x.png -------------------------------------------------------------------------------- /TableViewSettingList/Assets.xcassets/icon/icon3.imageset/icon3@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wangchangfei/TableViewSettingList/7bba19220d9e603b8f069fac03c30d16ac42b64e/TableViewSettingList/Assets.xcassets/icon/icon3.imageset/icon3@3x.png -------------------------------------------------------------------------------- /TableViewSettingList/Assets.xcassets/icon/icon4.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x" 6 | }, 7 | { 8 | "idiom" : "universal", 9 | "filename" : "icon4@2x.png", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "filename" : "icon4@3x.png", 15 | "scale" : "3x" 16 | } 17 | ], 18 | "info" : { 19 | "version" : 1, 20 | "author" : "xcode" 21 | } 22 | } -------------------------------------------------------------------------------- /TableViewSettingList/Assets.xcassets/icon/icon4.imageset/icon4@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wangchangfei/TableViewSettingList/7bba19220d9e603b8f069fac03c30d16ac42b64e/TableViewSettingList/Assets.xcassets/icon/icon4.imageset/icon4@2x.png -------------------------------------------------------------------------------- /TableViewSettingList/Assets.xcassets/icon/icon4.imageset/icon4@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wangchangfei/TableViewSettingList/7bba19220d9e603b8f069fac03c30d16ac42b64e/TableViewSettingList/Assets.xcassets/icon/icon4.imageset/icon4@3x.png -------------------------------------------------------------------------------- /TableViewSettingList/Assets.xcassets/icon/icon_header.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x" 6 | }, 7 | { 8 | "idiom" : "universal", 9 | "filename" : "icon_header@2x.png", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /TableViewSettingList/Assets.xcassets/icon/icon_header.imageset/icon_header@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wangchangfei/TableViewSettingList/7bba19220d9e603b8f069fac03c30d16ac42b64e/TableViewSettingList/Assets.xcassets/icon/icon_header.imageset/icon_header@2x.png -------------------------------------------------------------------------------- /TableViewSettingList/Assets.xcassets/icon/icon_touxiang.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x" 6 | }, 7 | { 8 | "idiom" : "universal", 9 | "filename" : "icon_touxiang@2x.png", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /TableViewSettingList/Assets.xcassets/icon/icon_touxiang.imageset/icon_touxiang@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wangchangfei/TableViewSettingList/7bba19220d9e603b8f069fac03c30d16ac42b64e/TableViewSettingList/Assets.xcassets/icon/icon_touxiang.imageset/icon_touxiang@2x.png -------------------------------------------------------------------------------- /TableViewSettingList/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.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1.0.0 23 | LSRequiresIPhoneOS 24 | 25 | UILaunchStoryboardName 26 | LaunchScreen 27 | UIRequiredDeviceCapabilities 28 | 29 | armv7 30 | 31 | UISupportedInterfaceOrientations 32 | 33 | UIInterfaceOrientationPortrait 34 | 35 | 36 | 37 | -------------------------------------------------------------------------------- /TableViewSettingList/TableViewSettingList/Controller/CFSettingTableViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // CFSettingTableViewController.h 3 | // TableViewSettingList 4 | // 5 | // Created by wangchangfei on 15/9/24. 6 | // Copyright (c) 2015年 wangchangfei. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface CFSettingTableViewController : UITableViewController 12 | 13 | /** 数据源 */ 14 | @property (nonatomic, strong) NSMutableArray *dataList; 15 | 16 | /** cell中显示的箭头名称 */ 17 | @property(nonatomic,copy)NSString* icon_arrow; 18 | 19 | /** cell背景颜色 */ 20 | @property (nonatomic, strong) UIColor *backgroundColor_Normal; 21 | 22 | /** cell选中背景颜色 */ 23 | @property (nonatomic, strong) UIColor *backgroundColor_Selected; 24 | 25 | /** cell右边Label字体 */ 26 | @property (nonatomic, strong) UIFont *rightLabelFont; 27 | 28 | /** cell右边Label字体颜色 */ 29 | @property (nonatomic, strong) UIColor *rightLabelFontColor; 30 | 31 | @end 32 | -------------------------------------------------------------------------------- /TableViewSettingList/TableViewSettingList/Controller/CFSettingTableViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // CFSettingTableViewController.m 3 | // TableViewSettingList 4 | // 5 | // Created by wangchangfei on 15/9/24. 6 | // Copyright (c) 2015年 wangchangfei. All rights reserved. 7 | // 8 | 9 | #import "CFSettingTableViewController.h" 10 | 11 | #import "CFSettingCell.h" 12 | #import "CFSettingItem.h" 13 | #import "CFSettingArrowItem.h" 14 | #import "CFSettingSwitchItem.h" 15 | #import "CFSettingLabelArrowItem.h" 16 | #import "CFSettingIconArrowItem.h" 17 | #import "CFSettingGroup.h" 18 | #import "Const.h" 19 | 20 | 21 | const CGFloat sectionHeight = 10; 22 | 23 | @interface CFSettingTableViewController () 24 | 25 | @end 26 | 27 | @implementation CFSettingTableViewController 28 | 29 | - (NSMutableArray *)dataList { 30 | if (_dataList == nil) { 31 | _dataList = [NSMutableArray array]; 32 | } 33 | 34 | return _dataList; 35 | } 36 | 37 | // 初始化方法 38 | - (instancetype)init { 39 | return [super initWithStyle:UITableViewStyleGrouped]; 40 | } 41 | 42 | - (void)viewDidLoad { 43 | [super viewDidLoad]; 44 | 45 | // 设置tableView的背景颜色 46 | self.tableView.backgroundView = nil; 47 | self.tableView.backgroundColor = CFViewBackgroundColor; 48 | 49 | // 适配iOS7的组间距 50 | if (iOS7) { 51 | self.tableView.contentInset = UIEdgeInsetsMake(0, 0, 0, 0); 52 | } 53 | } 54 | 55 | #pragma mark - Table view data source 56 | - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView { 57 | return self.dataList.count; 58 | } 59 | 60 | - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { 61 | CFSettingGroup *group = self.dataList[section]; 62 | 63 | return group.items.count; 64 | } 65 | 66 | - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { 67 | // 创建cell 68 | CFSettingCell *cell = [[CFSettingCell class] cellWithTableView:tableView]; 69 | 70 | // 设置参数 71 | cell.backgroundColor_Normal = self.backgroundColor_Normal; 72 | cell.backgroundColor_Selected = self.backgroundColor_Selected; 73 | cell.iconArrow = self.icon_arrow; 74 | cell.rightLabelFont = self.rightLabelFont; 75 | cell.rightLabelFontColor = self.rightLabelFontColor; 76 | 77 | // 取出模型 78 | CFSettingGroup *group = self.dataList[indexPath.section]; 79 | CFSettingItem *item = group.items[indexPath.row]; 80 | 81 | // 传递模型 82 | cell.item = item; 83 | cell.indexPath = indexPath; 84 | return cell; 85 | } 86 | 87 | #pragma mark - UITableViewDelegate 88 | - (CGFloat) tableView:(UITableView *)tableView heightForRowAtIndexPath :(NSIndexPath *)indexPath { 89 | CFSettingGroup *group = self.dataList[indexPath.section]; 90 | CFSettingItem *item = group.items[indexPath.row]; 91 | return item.cellHeight > 0 ? item.cellHeight : 44; 92 | } 93 | 94 | - (CGFloat) tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section { 95 | CFSettingGroup *group = self.dataList[section]; 96 | if(group.headerHeight > 0){ 97 | return group.headerHeight; 98 | } 99 | else { 100 | if (section == 0) { 101 | return sectionHeight * 2; 102 | } else { 103 | return sectionHeight; 104 | } 105 | } 106 | } 107 | 108 | - (CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section { 109 | CFSettingGroup *group = self.dataList[section]; 110 | if(group.footerHeight > 0){ 111 | return group.footerHeight; 112 | } 113 | else { 114 | return sectionHeight; 115 | } 116 | } 117 | 118 | - (NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section { 119 | CFSettingGroup *group = self.dataList[section]; 120 | return group.header; 121 | } 122 | 123 | - (NSString *)tableView:(UITableView *)tableView titleForFooterInSection:(NSInteger)section { 124 | CFSettingGroup *group = self.dataList[section]; 125 | return group.footer; 126 | } 127 | 128 | - (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section { 129 | CFSettingGroup *group = self.dataList[section]; 130 | return group.headerView; 131 | } 132 | 133 | - (UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section { 134 | CFSettingGroup *group = self.dataList[section]; 135 | return group.footerrView; 136 | } 137 | 138 | /** 139 | * 点击某一行cell 140 | */ 141 | - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { 142 | // 取消选中 143 | [tableView deselectRowAtIndexPath:indexPath animated:YES]; 144 | 145 | // 取出模型 146 | CFSettingGroup *group = self.dataList[indexPath.section]; 147 | CFSettingItem *item = group.items[indexPath.row]; 148 | 149 | // 执行操作 150 | if (item.opration) { 151 | item.opration(); 152 | return; 153 | } 154 | 155 | if ([item isKindOfClass:[CFSettingArrowItem class]]) { // 需要跳转控制器 156 | CFSettingArrowItem *arrowItem = (CFSettingArrowItem *)item; 157 | 158 | // 创建跳转的控制器 159 | if (arrowItem.destVcClass) { 160 | UIViewController *vc = [[arrowItem.destVcClass alloc] init]; 161 | vc.title = item.title; 162 | [self.navigationController pushViewController:vc animated:YES]; 163 | } 164 | } 165 | else if ([item isKindOfClass:[CFSettingLabelArrowItem class]]) { // 需要跳转控制器 166 | CFSettingLabelArrowItem *arrowItem = (CFSettingLabelArrowItem *)item; 167 | 168 | // 创建跳转的控制器 169 | if (arrowItem.destVcClass) { 170 | UIViewController *vc = [[arrowItem.destVcClass alloc] init]; 171 | vc.title = item.title; 172 | [self.navigationController pushViewController:vc animated:YES]; 173 | } 174 | } 175 | else if ([item isKindOfClass:[CFSettingIconArrowItem class]]) { // 需要跳转控制器 176 | CFSettingIconArrowItem *iconArrowItem = (CFSettingIconArrowItem *)item; 177 | 178 | // 创建跳转的控制器 179 | if (iconArrowItem.destVcClass) { 180 | UIViewController *vc = [[iconArrowItem.destVcClass alloc] init]; 181 | vc.title = item.title; 182 | [self.navigationController pushViewController:vc animated:YES]; 183 | } 184 | } 185 | } 186 | 187 | 188 | @end -------------------------------------------------------------------------------- /TableViewSettingList/TableViewSettingList/Model/CFSettingArrowItem.h: -------------------------------------------------------------------------------- 1 | // 2 | // CFSettingArrowItem.h 3 | // TableViewSettingList 4 | // 5 | // Created by wangchangfei on 15/9/24. 6 | // Copyright (c) 2015年 wangchangfei. All rights reserved. 7 | // cell右边是箭头 8 | 9 | #import "CFSettingItem.h" 10 | 11 | @interface CFSettingArrowItem : CFSettingItem 12 | 13 | /** 跳转的控制器的类名 */ 14 | @property(nonatomic, assign) Class destVcClass; 15 | 16 | + (instancetype)itemWithIcon:(NSString *)icon title:(NSString *)title destVcClass:(Class)destVcClass; 17 | 18 | @end 19 | -------------------------------------------------------------------------------- /TableViewSettingList/TableViewSettingList/Model/CFSettingArrowItem.m: -------------------------------------------------------------------------------- 1 | // 2 | // CFSettingArrowItem.m 3 | // TableViewSettingList 4 | // 5 | // Created by wangchangfei on 15/9/24. 6 | // Copyright (c) 2015年 wangchangfei. All rights reserved. 7 | // 8 | 9 | #import "CFSettingArrowItem.h" 10 | 11 | @implementation CFSettingArrowItem 12 | 13 | + (instancetype)itemWithIcon:(NSString *)icon title:(NSString *)title destVcClass:(Class)destVcClass { 14 | CFSettingArrowItem *item = [super itemWithIcon:icon title:title]; 15 | item.destVcClass = destVcClass; 16 | return item; 17 | } 18 | 19 | @end 20 | -------------------------------------------------------------------------------- /TableViewSettingList/TableViewSettingList/Model/CFSettingGroup.h: -------------------------------------------------------------------------------- 1 | // 2 | // CFSettingGroup.h 3 | // TableViewSettingList 4 | // 5 | // Created by wangchangfei on 15/9/24. 6 | // Copyright (c) 2015年 wangchangfei. All rights reserved. 7 | // 8 | 9 | #import 10 | #import 11 | 12 | @interface CFSettingGroup : NSObject 13 | 14 | /** TableView每组的数据 */ 15 | @property(nonatomic, strong) NSArray *items; 16 | 17 | /** TableView头部高度 */ 18 | @property(nonatomic, assign) CGFloat headerHeight; 19 | 20 | /** TableView头部文本 */ 21 | @property(nonatomic, copy) NSString *header; 22 | 23 | /** TableView底部高度 */ 24 | @property(nonatomic, assign) CGFloat footerHeight; 25 | 26 | /** TableView底部文本 */ 27 | @property(nonatomic, copy) NSString *footer; 28 | 29 | /** TableView头部视图 */ 30 | @property(nonatomic, strong) UIView *headerView; 31 | 32 | /** TableView底部视图 */ 33 | @property(nonatomic, strong) UIView *footerrView; 34 | 35 | @end 36 | -------------------------------------------------------------------------------- /TableViewSettingList/TableViewSettingList/Model/CFSettingGroup.m: -------------------------------------------------------------------------------- 1 | // 2 | // CFSettingGroup.m 3 | // TableViewSettingList 4 | // 5 | // Created by wangchangfei on 15/9/24. 6 | // Copyright (c) 2015年 wangchangfei. All rights reserved. 7 | // 8 | 9 | #import "CFSettingGroup.h" 10 | 11 | @implementation CFSettingGroup 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /TableViewSettingList/TableViewSettingList/Model/CFSettingIconArrowItem.h: -------------------------------------------------------------------------------- 1 | // 2 | // CFSettingIconArrowItem.h 3 | // TableViewSettingList 4 | // 5 | // Created by wangchangfei on 15/9/24. 6 | // Copyright (c) 2015年 wangchangfei. All rights reserved. 7 | // cell右边是图标和箭头 8 | 9 | #import "CFSettingItem.h" 10 | 11 | @interface CFSettingIconArrowItem : CFSettingItem 12 | 13 | /** Cell右边图片名称 */ 14 | @property(nonatomic, copy) NSString *icon_right; 15 | 16 | /** 跳转的控制器的类名 */ 17 | @property(nonatomic, assign) Class destVcClass; 18 | 19 | + (instancetype)itemWithIcon:(NSString *)icon title:(NSString *)title destVcClass:(Class)destVcClass; 20 | @end 21 | -------------------------------------------------------------------------------- /TableViewSettingList/TableViewSettingList/Model/CFSettingIconArrowItem.m: -------------------------------------------------------------------------------- 1 | // 2 | // CFSettingIconArrowItem.m 3 | // TableViewSettingList 4 | // 5 | // Created by wangchangfei on 15/9/24. 6 | // Copyright (c) 2015年 wangchangfei. All rights reserved. 7 | // 8 | 9 | #import "CFSettingIconArrowItem.h" 10 | 11 | @implementation CFSettingIconArrowItem 12 | + (instancetype)itemWithIcon:(NSString *)icon title:(NSString *)title destVcClass:(Class)destVcClass { 13 | CFSettingIconArrowItem *item = [super itemWithIcon:icon title:title]; 14 | item.destVcClass = destVcClass; 15 | return item; 16 | } 17 | @end 18 | -------------------------------------------------------------------------------- /TableViewSettingList/TableViewSettingList/Model/CFSettingIconItem.h: -------------------------------------------------------------------------------- 1 | // 2 | // CFSettingIconItem.h 3 | // TableViewSettingList 4 | // 5 | // Created by wangchangfei on 15/8/20. 6 | // Copyright (c) 2015年 wangchangfei. All rights reserved. 7 | // cell右边是图标 8 | 9 | #import "CFSettingItem.h" 10 | 11 | @interface CFSettingIconItem : CFSettingItem 12 | 13 | /** 右边图片名称 */ 14 | @property(nonatomic, copy) NSString *icon_right; 15 | @end 16 | -------------------------------------------------------------------------------- /TableViewSettingList/TableViewSettingList/Model/CFSettingIconItem.m: -------------------------------------------------------------------------------- 1 | // 2 | // CFSettingIconItem.m 3 | // TableViewSettingList 4 | // 5 | // Created by wangchangfei on 15/8/20. 6 | // Copyright (c) 2015年 wangchangfei. All rights reserved. 7 | // 8 | 9 | #import "CFSettingIconItem.h" 10 | 11 | @implementation CFSettingIconItem 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /TableViewSettingList/TableViewSettingList/Model/CFSettingItem.h: -------------------------------------------------------------------------------- 1 | // 2 | // CFSettingItem.h 3 | // TableViewSettingList 4 | // 5 | // Created by wangchangfei on 15/9/24. 6 | // Copyright (c) 2015年 wangchangfei. All rights reserved. 7 | // 8 | 9 | #import 10 | #import 11 | 12 | typedef void (^CFSettingItemOpration)(); 13 | 14 | @interface CFSettingItem : NSObject 15 | 16 | /** cell高度 */ 17 | @property (nonatomic, assign) CGFloat cellHeight; 18 | 19 | /** cell文本 */ 20 | @property(nonatomic, copy) NSString *title; 21 | 22 | /** cell图标 */ 23 | @property(nonatomic, copy) NSString *icon; 24 | 25 | /** cell子文本 */ 26 | @property(nonatomic, copy) NSString *subTitle; 27 | 28 | @property(nonatomic, assign) UITableViewCellSelectionStyle cellSelectionStyle; 29 | 30 | /** 使用block保存一段功能,在恰当的时候调用 */ 31 | @property(nonatomic, copy) CFSettingItemOpration opration; 32 | 33 | + (instancetype)itemWithIcon:(NSString *)icon title:(NSString *)title; 34 | 35 | @end 36 | -------------------------------------------------------------------------------- /TableViewSettingList/TableViewSettingList/Model/CFSettingItem.m: -------------------------------------------------------------------------------- 1 | // 2 | // CFSettingItem.m 3 | // TableViewSettingList 4 | // 5 | // Created by wangchangfei on 15/9/24. 6 | // Copyright (c) 2015年 wangchangfei. All rights reserved. 7 | // 8 | 9 | #import "CFSettingItem.h" 10 | 11 | @implementation CFSettingItem 12 | 13 | + (instancetype)itemWithIcon:(NSString *)icon title:(NSString *)title 14 | { 15 | CFSettingItem *item = [[self alloc] init]; 16 | 17 | item.icon = icon; 18 | item.title = title; 19 | 20 | return item; 21 | } 22 | 23 | @end 24 | -------------------------------------------------------------------------------- /TableViewSettingList/TableViewSettingList/Model/CFSettingLabelArrowItem.h: -------------------------------------------------------------------------------- 1 | // 2 | // CFSettingLabelArrowItem.h 3 | // TableViewSettingList 4 | // 5 | // Created by wangchangfei on 15/6/23. 6 | // Copyright (c) 2015年 wangchangfei. All rights reserved. 7 | // cell右边是文本和箭头 8 | 9 | #import "CFSettingItem.h" 10 | 11 | @interface CFSettingLabelArrowItem : CFSettingItem 12 | 13 | /** 右边label显示什么内容 */ 14 | @property(nonatomic, copy) NSString *text_right; 15 | 16 | /** 跳转的控制器的类名*/ 17 | @property(nonatomic, assign) Class destVcClass; 18 | 19 | + (instancetype)itemWithIcon:(NSString *)icon title:(NSString *)title destVcClass:(Class)destVcClass; 20 | @end 21 | -------------------------------------------------------------------------------- /TableViewSettingList/TableViewSettingList/Model/CFSettingLabelArrowItem.m: -------------------------------------------------------------------------------- 1 | // 2 | // CFSettingLabelArrowItem.m 3 | // TableViewSettingList 4 | // 5 | // Created by wangchangfei on 15/6/23. 6 | // Copyright (c) 2015年 wangchangfei. All rights reserved. 7 | // 8 | 9 | #import "CFSettingLabelArrowItem.h" 10 | #import "CFSaveTool.h" 11 | 12 | @implementation CFSettingLabelArrowItem 13 | 14 | -(void)setText_right:(NSString *)text_right{ 15 | _text_right = text_right; 16 | } 17 | 18 | - (void)setTitle:(NSString *)title { 19 | [super setTitle:title]; 20 | } 21 | 22 | + (instancetype)itemWithIcon:(NSString *)icon title:(NSString *)title destVcClass:(Class)destVcClass { 23 | CFSettingLabelArrowItem *item = [super itemWithIcon:icon title:title]; 24 | item.destVcClass = destVcClass; 25 | 26 | return item; 27 | } 28 | @end 29 | -------------------------------------------------------------------------------- /TableViewSettingList/TableViewSettingList/Model/CFSettingLabelItem.h: -------------------------------------------------------------------------------- 1 | // 2 | // CFSettingLabelItem.h 3 | // TableViewSettingList 4 | // 5 | // Created by wangchangfei on 15/9/24. 6 | // Copyright (c) 2015年 wangchangfei. All rights reserved. 7 | // cell右边是文本 8 | 9 | #import "CFSettingItem.h" 10 | 11 | @interface CFSettingLabelItem : CFSettingItem 12 | 13 | /** 右边label显示什么内容 */ 14 | @property (nonatomic, copy) NSString *text_right; 15 | 16 | @end 17 | -------------------------------------------------------------------------------- /TableViewSettingList/TableViewSettingList/Model/CFSettingLabelItem.m: -------------------------------------------------------------------------------- 1 | // 2 | // CFSettingLabelItem.m 3 | // TableViewSettingList 4 | // 5 | // Created by wangchangfei on 15/9/24. 6 | // Copyright (c) 2015年 wangchangfei. All rights reserved. 7 | // 8 | 9 | #import "CFSettingLabelItem.h" 10 | 11 | #import "CFSaveTool.h" 12 | 13 | @implementation CFSettingLabelItem 14 | 15 | -(void)setText_right:(NSString *)text_right{ 16 | _text_right = text_right; 17 | } 18 | 19 | - (void)setTitle:(NSString *)title { 20 | [super setTitle:title]; 21 | } 22 | 23 | @end 24 | -------------------------------------------------------------------------------- /TableViewSettingList/TableViewSettingList/Model/CFSettingSwitchItem.h: -------------------------------------------------------------------------------- 1 | // 2 | // CFSettingSwitchItem.h 3 | // TableViewSettingList 4 | // 5 | // Created by wangchangfei on 15/9/24. 6 | // Copyright (c) 2015年 wangchangfei. All rights reserved. 7 | // cell右边是Switch 8 | 9 | #import "CFSettingItem.h" 10 | 11 | 12 | typedef void (^CFSwitchValueChangedOpration)(BOOL); 13 | 14 | @interface CFSettingSwitchItem : CFSettingItem 15 | 16 | /** 使用block保存一段功能,在恰当的时候调用 */ 17 | @property(nonatomic, copy) CFSwitchValueChangedOpration opration_switch; 18 | 19 | /** 默认打开开关 */ 20 | @property (nonatomic, assign) BOOL defaultOn; 21 | 22 | /** 根据CFSettingSwitchItem 设置的title获取 UISwitch的开关状态 */ 23 | + (BOOL) isONSwitchByTitle:(NSString *)title; 24 | 25 | @end 26 | -------------------------------------------------------------------------------- /TableViewSettingList/TableViewSettingList/Model/CFSettingSwitchItem.m: -------------------------------------------------------------------------------- 1 | // 2 | // CFSettingSwitchItem.m 3 | // TableViewSettingList 4 | // 5 | // Created by wangchangfei on 15/9/24. 6 | // Copyright (c) 2015年 wangchangfei. All rights reserved. 7 | // 8 | 9 | #import "CFSettingSwitchItem.h" 10 | #import "CFSaveTool.h" 11 | 12 | @implementation CFSettingSwitchItem 13 | 14 | /** 根据CFSettingSwitchItem 设置的title获取 UISwitch的开关状态 */ 15 | +(BOOL)isONSwitchByTitle:(NSString *)title{ 16 | return [CFSaveTool isTurnOnSwitchByTitle:title]; 17 | } 18 | @end 19 | -------------------------------------------------------------------------------- /TableViewSettingList/TableViewSettingList/TableViewSettingList.h: -------------------------------------------------------------------------------- 1 | // 2 | // TableViewSettingList.h 3 | // TableViewSettingList 4 | // 5 | // Created by wangchangfei on 15/9/24. 6 | // Copyright © 2015年 wangchangfei. All rights reserved. 7 | // 8 | 9 | #ifndef TableViewSettingList_h 10 | #define TableViewSettingList_h 11 | 12 | #import "CFSettingTableViewController.h" 13 | #import "CFSettingItem.h" 14 | #import "CFSettingGroup.h" 15 | #import "CFSettingArrowItem.h" 16 | #import "CFSettingIconArrowItem.h" 17 | #import "CFSettingIconItem.h" 18 | #import "CFSettingLabelArrowItem.h" 19 | #import "CFSettingLabelItem.h" 20 | #import "CFSettingSwitchItem.h" 21 | #import "Const.h" 22 | 23 | #endif /* TableViewSettingList_h */ 24 | -------------------------------------------------------------------------------- /TableViewSettingList/TableViewSettingList/Tool/CFSaveTool.h: -------------------------------------------------------------------------------- 1 | // 2 | // CFSaveTool.h 3 | // TableViewSettingList 4 | // 5 | // Created by wangchangfei on 15/9/24. 6 | // Copyright © 2015年 wangchangfei. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface CFSaveTool : NSObject 12 | 13 | /** 设置 */ 14 | + (void)setBool:(BOOL)value forKey:(NSString *)defaultName; 15 | 16 | /** 取出设置结果 */ 17 | + (BOOL)boolForKey:(NSString *)defaultName; 18 | 19 | /** 是否打开了 */ 20 | + (BOOL)isTurnOnSwitchByTitle:(NSString *)key; 21 | 22 | /** 是否设置过 */ 23 | + (BOOL)isContainsKey:(NSString *)key; 24 | @end 25 | -------------------------------------------------------------------------------- /TableViewSettingList/TableViewSettingList/Tool/CFSaveTool.m: -------------------------------------------------------------------------------- 1 | // 2 | // CFSaveTool.m 3 | // TableViewSettingList 4 | // 5 | // Created by wangchangfei on 15/9/24. 6 | // Copyright © 2015年 wangchangfei. All rights reserved. 7 | // 8 | 9 | #import "CFSaveTool.h" 10 | 11 | @implementation CFSaveTool 12 | 13 | + (void)setBool:(BOOL)value forKey:(NSString *)defaultName { 14 | [[NSUserDefaults standardUserDefaults] setBool:value forKey:defaultName]; 15 | [[NSUserDefaults standardUserDefaults] synchronize]; 16 | } 17 | 18 | + (BOOL)boolForKey:(NSString *)defaultName { 19 | return [[NSUserDefaults standardUserDefaults] boolForKey:defaultName]; 20 | } 21 | 22 | /** 是否打开了 */ 23 | + (BOOL)isTurnOnSwitchByTitle:(NSString *)key { 24 | BOOL voice = NO; 25 | NSUserDefaults *defs = [NSUserDefaults standardUserDefaults]; 26 | NSDictionary *dic = [defs dictionaryRepresentation]; 27 | if ([dic.allKeys containsObject:key]) { 28 | voice = [defs boolForKey:key]; 29 | } else { 30 | voice = NO; 31 | } 32 | return voice; 33 | } 34 | 35 | /** 是否设置过 */ 36 | + (BOOL)isContainsKey:(NSString *)key { 37 | NSUserDefaults *defs = [NSUserDefaults standardUserDefaults]; 38 | NSDictionary *dic = [defs dictionaryRepresentation]; 39 | if ([dic.allKeys containsObject:key]) { 40 | return YES; 41 | } else { 42 | return NO; 43 | } 44 | 45 | } 46 | 47 | @end 48 | -------------------------------------------------------------------------------- /TableViewSettingList/TableViewSettingList/Tool/Const.h: -------------------------------------------------------------------------------- 1 | // 2 | // Const.h 3 | // TableViewSettingList 4 | // 5 | // Created by wangchangfei on 15/9/24. 6 | // Copyright © 2015年 wangchangfei. All rights reserved. 7 | // 8 | 9 | #ifndef Const_h 10 | #define Const_h 11 | 12 | #ifdef DEBUG // 处于开发阶段 13 | #define CFLog(...) NSLog(__VA_ARGS__) 14 | #else // 处于发布阶段 15 | #define CFLog(...) 16 | #endif 17 | #import "UIColor+Hex.h" 18 | 19 | // RGBA颜色 20 | #define CFColorRGBA(r, g, b, a) [UIColor colorWithRed:(r)/255.0 green:(g)/255.0 blue:(b)/255.0 alpha:a] 21 | #define CFColor(r, g, b) CFColorRGBA(r, g, b, 1.0) 22 | 23 | // view背景颜色 24 | #define CFViewBackgroundColor CFColor(244, 243, 241) 25 | 26 | // Cell上右边Label文字颜色 27 | #define CFRightLabelTextColor [UIColor colorWithHexString:@"#a2a2a3"] 28 | 29 | // Cell上文字颜色 30 | #define CFCellTextColor [UIColor colorWithHexString:@"#5e5e5e"] 31 | 32 | // iOS7以上 33 | #define iOS7 ([[UIDevice currentDevice].systemVersion floatValue] >= 7.0) 34 | 35 | //cell的高亮颜色 36 | #define CFCellBackgroundColor_Highlighted CFColor(237, 233, 218) 37 | 38 | 39 | #endif 40 | -------------------------------------------------------------------------------- /TableViewSettingList/TableViewSettingList/Tool/UIColor+Hex.h: -------------------------------------------------------------------------------- 1 | // 2 | // UIColor+Hex.h 3 | // color 4 | // 5 | // Created by Andrew Sliwinski on 9/15/12. 6 | // Copyright (c) 2012 Andrew Sliwinski. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface UIColor (Hex) 12 | 13 | + (UIColor *)colorWithHex:(UInt32)hex andAlpha:(CGFloat)alpha; 14 | 15 | + (UIColor *)colorWithHex:(UInt32)hex; 16 | + (UIColor *)colorWithHexString:(id)input; 17 | 18 | - (UInt32)hexValue; 19 | 20 | @end 21 | -------------------------------------------------------------------------------- /TableViewSettingList/TableViewSettingList/Tool/UIColor+Hex.m: -------------------------------------------------------------------------------- 1 | // 2 | // UIColor+Hex.m 3 | // color 4 | // 5 | // Created by Andrew Sliwinski on 9/15/12. 6 | // Copyright (c) 2012 Andrew Sliwinski. All rights reserved. 7 | // 8 | 9 | #import "UIColor+Hex.h" 10 | 11 | @implementation UIColor (Hex) 12 | 13 | /** 14 | * Creates a new UIColor instance using a hex input and alpha value. 15 | * 16 | * @param {UInt32} Hex 17 | * @param {CGFloat} Alpha 18 | * 19 | * @return {UIColor} 20 | */ 21 | + (UIColor *)colorWithHex:(UInt32)hex andAlpha:(CGFloat)alpha 22 | { 23 | int r = (hex >> 16) & 0xFF; 24 | int g = (hex >> 8) & 0xFF; 25 | int b = (hex) & 0xFF; 26 | 27 | return [UIColor colorWithRed:r / 255.0f 28 | green:g / 255.0f 29 | blue:b / 255.0f 30 | alpha:alpha]; 31 | } 32 | 33 | /** 34 | * Creates a new UIColor instance using a hex input. 35 | * 36 | * @param {UInt32} Hex 37 | * 38 | * @return {UIColor} 39 | */ 40 | + (UIColor *)colorWithHex:(UInt32)hex 41 | { 42 | return [self colorWithHex:hex andAlpha:1.0]; 43 | } 44 | 45 | /** 46 | * Creates a new UIColor instance using a hex string input. 47 | * 48 | * @param {NSString} Hex string (ie: @"ff", @"#fff", @"ff0000", or @"ff00ffcc") 49 | * 50 | * @return {UIColor} 51 | */ 52 | + (UIColor *)colorWithHexString:(id)hexString 53 | { 54 | if (![hexString isKindOfClass:[NSString class]] || [hexString length] == 0) { 55 | return [UIColor colorWithRed:0.0f green:0.0f blue:0.0f alpha:1.0f]; 56 | } 57 | 58 | const char *s = [hexString cStringUsingEncoding:NSASCIIStringEncoding]; 59 | if (*s == '#') { 60 | ++s; 61 | } 62 | unsigned long long value = strtoll(s, nil, 16); 63 | int r, g, b, a; 64 | switch (strlen(s)) { 65 | case 2: 66 | // xx 67 | r = g = b = (int)value; 68 | a = 255; 69 | break; 70 | case 3: 71 | // RGB 72 | r = ((value & 0xf00) >> 8); 73 | g = ((value & 0x0f0) >> 4); 74 | b = ((value & 0x00f) >> 0); 75 | r = r * 16 + r; 76 | g = g * 16 + g; 77 | b = b * 16 + b; 78 | a = 255; 79 | break; 80 | case 6: 81 | // RRGGBB 82 | r = (value & 0xff0000) >> 16; 83 | g = (value & 0x00ff00) >> 8; 84 | b = (value & 0x0000ff) >> 0; 85 | a = 255; 86 | break; 87 | default: 88 | // RRGGBBAA 89 | r = (value & 0xff000000) >> 24; 90 | g = (value & 0x00ff0000) >> 16; 91 | b = (value & 0x0000ff00) >> 8; 92 | a = (value & 0x000000ff) >> 0; 93 | break; 94 | } 95 | return [UIColor colorWithRed:r/255.0f green:g/255.0f blue:b/255.0f alpha:a/255.0f]; 96 | } 97 | 98 | /** 99 | * Returns the hex value of the receiver. Alpha value is not included. 100 | * 101 | * @return {UInt32} 102 | */ 103 | - (UInt32)hexValue { 104 | CGFloat r,g,b,a; 105 | [self getRed:&r green:&g blue:&b alpha:&a]; 106 | 107 | UInt32 ri = r*255.0; 108 | UInt32 gi = g*255.0; 109 | UInt32 bi = b*255.0; 110 | 111 | return (ri<<16) + (gi<<8) + bi; 112 | } 113 | 114 | @end 115 | -------------------------------------------------------------------------------- /TableViewSettingList/TableViewSettingList/View/CFIconArrowView.h: -------------------------------------------------------------------------------- 1 | // 2 | // CFIconArrowView.h 3 | // TableViewSettingList 4 | // 5 | // Created by wangchangfei on 15/9/24. 6 | // Copyright (c) 2015年 wangchangfei. All rights reserved. 7 | // Cell右边的图片和箭头 8 | 9 | #import 10 | 11 | @interface CFIconArrowView : UIView 12 | 13 | /** cell右边的图片 */ 14 | @property(nonatomic,copy)NSString* icon_right; 15 | 16 | 17 | /** cell箭头名称 */ 18 | @property(nonatomic,copy)NSString* iconArrow; 19 | @end 20 | -------------------------------------------------------------------------------- /TableViewSettingList/TableViewSettingList/View/CFIconArrowView.m: -------------------------------------------------------------------------------- 1 | // 2 | // CFIconArrowView.m 3 | // TableViewSettingList 4 | // 5 | // Created by wangchangfei on 15/9/24. 6 | // Copyright (c) 2015年 wangchangfei. All rights reserved. 7 | // 8 | 9 | #import "CFIconArrowView.h" 10 | 11 | @interface CFIconArrowView () 12 | 13 | @property(nonatomic, weak) UIButton *btn_Icon; 14 | 15 | @property(nonatomic, weak) UIImageView *imgView; 16 | 17 | @end 18 | 19 | @implementation CFIconArrowView 20 | 21 | - (instancetype)initWithFrame:(CGRect)frame { 22 | if (self = [super initWithFrame:frame]) { 23 | 24 | UIButton *btn_Icon = [[UIButton alloc] init]; 25 | btn_Icon.userInteractionEnabled = NO; 26 | btn_Icon.contentHorizontalAlignment = UIControlContentHorizontalAlignmentRight; 27 | self.btn_Icon = btn_Icon; 28 | 29 | [self addSubview:btn_Icon]; 30 | 31 | UIImageView *imgView = [[UIImageView alloc] init]; 32 | imgView.userInteractionEnabled = NO; 33 | self.imgView = imgView; 34 | [self addSubview:imgView]; 35 | } 36 | return self; 37 | } 38 | 39 | - (void)layoutSubviews { 40 | [super layoutSubviews]; 41 | 42 | CGFloat imgW = self.imgView.image.size.width; 43 | CGFloat imgH = self.imgView.image.size.height; 44 | self.btn_Icon.frame = CGRectMake(0, 0, self.frame.size.width - imgW * 1.5, self.frame.size.height); 45 | self.imgView.frame = CGRectMake(self.frame.size.width - imgW,(self.frame.size.height - imgH) / 2, imgW, imgH); 46 | } 47 | 48 | - (void)setIconArrow:(NSString *)iconArrow{ 49 | _iconArrow = iconArrow; 50 | if(self.iconArrow.length > 0){ 51 | self.imgView.image = [UIImage imageNamed:self.iconArrow]; 52 | } 53 | } 54 | 55 | -(void)setIcon_right:(NSString *)icon_right{ 56 | _icon_right = icon_right; 57 | 58 | [self.btn_Icon setImage:[UIImage imageNamed:icon_right] forState:UIControlStateNormal]; 59 | 60 | } 61 | 62 | 63 | @end 64 | -------------------------------------------------------------------------------- /TableViewSettingList/TableViewSettingList/View/CFLabelArrowView.h: -------------------------------------------------------------------------------- 1 | // 2 | // CFLabelArrowView.h 3 | // TableViewSettingList 4 | // 5 | // Created by wangchangfei on 15/6/23. 6 | // Copyright (c) 2015年 wangchangfei. All rights reserved. 7 | // Cell右边的文本和箭头 8 | 9 | #import 10 | 11 | @interface CFLabelArrowView : UIView 12 | 13 | /** 文本内容 */ 14 | @property(nonatomic,copy)NSString* text; 15 | 16 | /** cell箭头名称 */ 17 | @property(nonatomic,copy)NSString* iconArrow; 18 | 19 | /** cell右边Label字体 */ 20 | @property (nonatomic, strong) UIFont *rightLabelFont; 21 | 22 | /** cell右边Label字体颜色 */ 23 | @property (nonatomic, strong) UIColor *rightLabelFontColor; 24 | 25 | @end 26 | -------------------------------------------------------------------------------- /TableViewSettingList/TableViewSettingList/View/CFLabelArrowView.m: -------------------------------------------------------------------------------- 1 | // 2 | // CFLabelArrowView.m 3 | // TableViewSettingList 4 | // 5 | // Created by wangchangfei on 15/9/24. 6 | // Copyright (c) 2015年 wangchangfei. All rights reserved. 7 | // 8 | 9 | #import "CFLabelArrowView.h" 10 | #import "Const.h" 11 | 12 | @interface CFLabelArrowView () 13 | 14 | @property(nonatomic, weak) UILabel *lbMsg; 15 | @property(nonatomic, weak) UIImageView *imgView; 16 | 17 | @end 18 | 19 | @implementation CFLabelArrowView 20 | - (instancetype)initWithFrame:(CGRect)frame { 21 | if (self = [super initWithFrame:frame]) { 22 | 23 | UILabel *lbMsg = [[UILabel alloc] init]; 24 | self.lbMsg = lbMsg; 25 | [self addSubview:lbMsg]; 26 | 27 | UIImageView *imgView = [[UIImageView alloc] init]; 28 | imgView.userInteractionEnabled = NO; 29 | self.imgView = imgView; 30 | [self addSubview:imgView]; 31 | } 32 | return self; 33 | } 34 | 35 | 36 | - (void)layoutSubviews { 37 | [super layoutSubviews]; 38 | 39 | CGFloat imgW = self.imgView.image.size.width; 40 | CGFloat imgH = self.imgView.image.size.height; 41 | self.lbMsg.frame = CGRectMake(0, 0, self.frame.size.width - imgW * 1.5, self.frame.size.height); 42 | self.imgView.frame = CGRectMake(self.frame.size.width - imgW, (self.frame.size.height - imgH) / 2, imgW, imgH); 43 | } 44 | 45 | - (void)setIconArrow:(NSString *)iconArrow{ 46 | _iconArrow = iconArrow; 47 | if(self.iconArrow.length > 0){ 48 | self.imgView.image = [UIImage imageNamed:self.iconArrow]; 49 | } 50 | } 51 | 52 | - (void)setText:(NSString *)text { 53 | _text = text; 54 | self.lbMsg.text = text; 55 | self.lbMsg.textColor = CFRightLabelTextColor; 56 | self.lbMsg.font = [UIFont systemFontOfSize:15]; 57 | self.lbMsg.textAlignment = NSTextAlignmentRight; 58 | } 59 | 60 | 61 | -(void)setRightLabelFont:(UIFont *)rightLabelFont{ 62 | _rightLabelFont = rightLabelFont; 63 | self.lbMsg.font = rightLabelFont; 64 | } 65 | 66 | -(void)setRightLabelFontColor:(UIColor *)rightLabelFontColor{ 67 | _rightLabelFontColor = rightLabelFontColor; 68 | self.lbMsg.textColor = rightLabelFontColor; 69 | } 70 | 71 | 72 | @end 73 | -------------------------------------------------------------------------------- /TableViewSettingList/TableViewSettingList/View/CFSettingCell.h: -------------------------------------------------------------------------------- 1 | // 2 | // CFSettingCell.h 3 | // TableViewSettingList 4 | // 5 | // Created by wangchangfei on 15/9/24. 6 | // Copyright (c) 2015年 wangchangfei. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @class CFSettingItem; 12 | 13 | @interface CFSettingCell : UITableViewCell 14 | 15 | /** 模型 */ 16 | @property (nonatomic, strong) CFSettingItem *item; 17 | 18 | @property (nonatomic, strong) NSIndexPath *indexPath; 19 | 20 | /** cell背景颜色 */ 21 | @property (nonatomic, strong) UIColor *backgroundColor_Normal; 22 | 23 | /** cell选中背景颜色 */ 24 | @property (nonatomic, strong) UIColor *backgroundColor_Selected; 25 | 26 | /** cell箭头名称 */ 27 | @property(nonatomic,copy)NSString* iconArrow; 28 | 29 | /** cell右边Label字体 */ 30 | @property (nonatomic, strong) UIFont *rightLabelFont; 31 | 32 | /** cell右边Label字体颜色 */ 33 | @property (nonatomic, strong) UIColor *rightLabelFontColor; 34 | 35 | 36 | 37 | + (instancetype)cellWithTableView:(UITableView *)tableView; 38 | 39 | @end 40 | -------------------------------------------------------------------------------- /TableViewSettingList/TableViewSettingList/View/CFSettingCell.m: -------------------------------------------------------------------------------- 1 | // 2 | // CFSettingCell.m 3 | // TableViewSettingList 4 | // 5 | // Created by wangchangfei on 15/9/24. 6 | // Copyright (c) 2015年 wangchangfei. All rights reserved. 7 | // 8 | 9 | #import "CFSettingCell.h" 10 | 11 | #import "CFSettingItem.h" 12 | #import "CFSettingArrowItem.h" 13 | #import "CFSettingSwitchItem.h" 14 | #import "CFSettingLabelItem.h" 15 | #import "CFSettingLabelArrowItem.h" 16 | #import "CFSettingIconItem.h" 17 | #import "CFLabelArrowView.h" 18 | #import "CFSettingIconArrowItem.h" 19 | #import "CFIconArrowView.h" 20 | #import "Const.h" 21 | #import "CFSaveTool.h" 22 | 23 | @interface CFSettingCell () 24 | 25 | @property(nonatomic, strong) UIImageView *imgView; 26 | @property(nonatomic, strong) UISwitch *switchView; 27 | @property(nonatomic, strong) UILabel *labelView; 28 | @property(nonatomic, strong) CFLabelArrowView *labelarrowView; 29 | @property(nonatomic, strong) CFIconArrowView *iconArrowView; 30 | @property(nonatomic, strong) UIButton *headView; 31 | 32 | @property(nonatomic, weak) UIView *divider; 33 | 34 | @end 35 | 36 | @implementation CFSettingCell 37 | 38 | - (UIView *)divider { 39 | if (_divider == nil) { 40 | if (!iOS7) { // 不是ios7才需要创建分割线 41 | UIView *divider = [[UIView alloc] init]; 42 | divider.backgroundColor = [UIColor blackColor]; 43 | divider.alpha = 0.2; 44 | 45 | [self.contentView addSubview:divider]; 46 | _divider = divider; 47 | } 48 | } 49 | 50 | return _divider; 51 | } 52 | 53 | - (UILabel *)labelView { 54 | if (_labelView == nil) { 55 | _labelView = [[UILabel alloc] init]; 56 | _labelView.bounds = CGRectMake(0, 0, self.frame.size.width * 0.55, self.frame.size.height); 57 | } 58 | return _labelView; 59 | } 60 | 61 | - (UIImageView *)imgView { 62 | if (_imgView == nil) { 63 | if(self.iconArrow.length > 0){ 64 | _imgView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:self.iconArrow]]; 65 | } 66 | else{ 67 | return nil; 68 | } 69 | } 70 | return _imgView; 71 | } 72 | 73 | - (UIButton *)headView { 74 | if (_headView == nil) { 75 | _headView = [[UIButton alloc] init]; 76 | _headView.userInteractionEnabled = NO; 77 | _headView.frame = CGRectMake(0, 0, 80, 80); 78 | } 79 | return _headView; 80 | } 81 | 82 | - (CFLabelArrowView *)labelarrowView { 83 | if (_labelarrowView == nil) { 84 | _labelarrowView = [[CFLabelArrowView alloc] init]; 85 | _labelarrowView.iconArrow = self.iconArrow; 86 | _labelarrowView.bounds = CGRectMake(0, 0, self.frame.size.width * 0.55, self.frame.size.height); 87 | } 88 | return _labelarrowView; 89 | } 90 | 91 | - (CFIconArrowView *)iconArrowView { 92 | if (_iconArrowView == nil) { 93 | _iconArrowView = [[CFIconArrowView alloc] init]; 94 | _iconArrowView.iconArrow = self.iconArrow; 95 | _iconArrowView.bounds = CGRectMake(0, 0, self.frame.size.width * 0.55, self.frame.size.height); 96 | } 97 | return _iconArrowView; 98 | } 99 | 100 | - (UISwitch *)switchView { 101 | if (_switchView == nil) { 102 | _switchView = [[UISwitch alloc] init]; 103 | } 104 | return _switchView; 105 | } 106 | 107 | - (void)setItem:(CFSettingItem *)item { 108 | _item = item; 109 | 110 | // 设置cell的子控件的数据 111 | [self setUpData]; 112 | 113 | // 设置右边视图 114 | [self setUpAccessoryView]; 115 | } 116 | 117 | /** 118 | * 设置cell的子控件的数据 119 | */ 120 | - (void)setUpData { 121 | if (_item.icon.length) { 122 | self.imageView.image = [UIImage imageNamed:_item.icon]; 123 | } else { 124 | self.imageView.image = nil; 125 | } 126 | self.textLabel.text = _item.title; 127 | 128 | self.detailTextLabel.text = _item.subTitle; 129 | } 130 | 131 | /** 132 | * 设置右边视图 133 | */ 134 | - (void)setUpAccessoryView { 135 | if ([_item isKindOfClass:[CFSettingArrowItem class]]) { // Cell右边箭头 136 | self.accessoryView = self.imgView; 137 | self.selectionStyle = UITableViewCellSelectionStyleDefault; 138 | } else if ([_item isKindOfClass:[CFSettingSwitchItem class]]) { // Cell右边Switch 139 | self.accessoryView = self.switchView; 140 | CFSettingSwitchItem *switchItem = (CFSettingSwitchItem *)_item; 141 | if([CFSaveTool isContainsKey:_item.title]){ 142 | self.switchView.on = [CFSaveTool isTurnOnSwitchByTitle:_item.title]; 143 | } 144 | else{ 145 | [CFSaveTool setBool:switchItem.defaultOn forKey:_item.title]; 146 | self.switchView.on = switchItem.defaultOn; 147 | } 148 | [self.switchView addTarget:self action:@selector(switchValueChanged:) forControlEvents:UIControlEventValueChanged]; 149 | self.selectionStyle = UITableViewCellSelectionStyleNone; 150 | } else if ([_item isKindOfClass:[CFSettingLabelItem class]]) { // Cell右边Label 151 | self.accessoryView = self.labelView; 152 | CFSettingLabelItem *labelItem = (CFSettingLabelItem *)_item; 153 | self.labelView.text = labelItem.text_right; 154 | self.labelView.textColor = CFRightLabelTextColor; 155 | self.labelView.font = [UIFont systemFontOfSize:15]; 156 | self.labelView.textAlignment = NSTextAlignmentRight; 157 | self.selectionStyle = UITableViewCellSelectionStyleNone; 158 | } else if ([_item isKindOfClass: [CFSettingLabelArrowItem class]]) { // Cell右边Label和Arrow 159 | self.accessoryView = self.labelarrowView; 160 | CFSettingLabelArrowItem *labelarrowItem = (CFSettingLabelArrowItem *)_item; 161 | self.labelarrowView.text = labelarrowItem.text_right; 162 | self.selectionStyle = UITableViewCellSelectionStyleDefault; 163 | } else if ([_item isKindOfClass:[CFSettingIconItem class]]) { //Cell右边是图片 164 | self.accessoryView = self.headView; 165 | CFSettingIconItem *iconItem = (CFSettingIconItem *)_item; 166 | [self.headView setImage:[UIImage imageNamed:iconItem.icon_right] forState:UIControlStateNormal]; 167 | self.selectionStyle = iconItem.cellSelectionStyle; 168 | } else if ([_item isKindOfClass: [CFSettingIconArrowItem class]]) { //Cell右边有图片和箭头 169 | self.accessoryView = self.iconArrowView; 170 | CFSettingIconArrowItem *iconArrowItem = (CFSettingIconArrowItem *)_item; 171 | self.iconArrowView.icon_right = iconArrowItem.icon_right; 172 | self.selectionStyle = iconArrowItem.cellSelectionStyle; 173 | } else { 174 | self.accessoryView = nil; 175 | self.selectionStyle = UITableViewCellSelectionStyleDefault; 176 | } 177 | } 178 | 179 | -(void)switchValueChanged:(UISwitch *)switchControl{ 180 | CFLog(@"switchValueChanged %d",switchControl.isOn); 181 | [CFSaveTool setBool:switchControl.isOn forKey:_item.title]; 182 | if ([_item isKindOfClass:[CFSettingSwitchItem class]]) { // Cell右边Switch 183 | CFSettingSwitchItem *switchItem = (CFSettingSwitchItem *)_item; 184 | if(switchItem.opration_switch){ 185 | switchItem.opration_switch(switchControl.isOn); 186 | } 187 | } 188 | } 189 | 190 | /** 191 | * 快速创建cell 192 | */ 193 | + (instancetype)cellWithTableView:(UITableView *)tableView{ 194 | static NSString *ID = @"CFSettingCell"; 195 | CFSettingCell *cell = [tableView dequeueReusableCellWithIdentifier:ID]; 196 | 197 | if (cell == nil) { 198 | cell = [[CFSettingCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:ID]; 199 | cell.textLabel.textColor = CFCellTextColor; 200 | cell.textLabel.font = [UIFont boldSystemFontOfSize:17]; 201 | } 202 | 203 | return cell; 204 | } 205 | 206 | /** 207 | * 判断分割线是否需要显示 208 | */ 209 | - (void)setIndexPath:(NSIndexPath *)indexPath { 210 | _indexPath = indexPath; 211 | 212 | self.divider.hidden = indexPath.row == 0; 213 | } 214 | 215 | - (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier { 216 | if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) { 217 | // 清空子视图的背景 218 | [self setSubViews]; 219 | } 220 | 221 | return self; 222 | } 223 | 224 | /** 225 | * 清空子控件的背景颜色 226 | */ 227 | - (void)setSubViews { 228 | self.textLabel.backgroundColor = [UIColor clearColor]; 229 | self.detailTextLabel.backgroundColor = [UIColor clearColor]; 230 | } 231 | 232 | /** 233 | * 适配ios6的cell 234 | */ 235 | - (void)setFrame:(CGRect)frame { 236 | if (!iOS7) { 237 | frame.size.width += 20; 238 | frame.origin.x -= 10; 239 | } 240 | 241 | [super setFrame:frame]; 242 | } 243 | 244 | /** 245 | * cell箭头 246 | */ 247 | -(void)setIconArrow:(NSString *)iconArrow{ 248 | _iconArrow = iconArrow; 249 | } 250 | 251 | /** 252 | * cell右边Label字体 253 | */ 254 | -(void)setRightLabelFont:(UIFont *)rightLabelFont{ 255 | _rightLabelFont = rightLabelFont; 256 | self.labelView.font = rightLabelFont; 257 | self.labelarrowView.rightLabelFont = rightLabelFont; 258 | } 259 | 260 | /** 261 | * cell右边Label字体颜色 262 | */ 263 | -(void)setRightLabelFontColor:(UIColor *)rightLabelFontColor{ 264 | _rightLabelFontColor = rightLabelFontColor; 265 | self.labelView.textColor = rightLabelFontColor; 266 | self.labelarrowView.rightLabelFontColor = rightLabelFontColor; 267 | } 268 | 269 | /** 270 | * 设置背景颜色 271 | */ 272 | -(void)setBackgroundColor_Normal:(UIColor *)backgroundColor_Normal{ 273 | _backgroundColor_Normal = backgroundColor_Normal; 274 | 275 | UIView *bg = [[UIView alloc] init]; 276 | bg.backgroundColor = backgroundColor_Normal; 277 | self.backgroundView = bg; 278 | } 279 | 280 | /** 281 | * 设置选中的背景颜色 282 | */ 283 | -(void)setBackgroundColor_Selected:(UIColor *)backgroundColor_Selected{ 284 | _backgroundColor_Selected = backgroundColor_Selected; 285 | 286 | UIView *selectedBg = [[UIView alloc] init]; 287 | selectedBg.backgroundColor = backgroundColor_Selected; 288 | self.selectedBackgroundView = selectedBg; 289 | } 290 | 291 | /** 292 | * 设置分割线的frame 293 | */ 294 | - (void)layoutSubviews { 295 | [super layoutSubviews]; 296 | 297 | CGFloat dividerX = self.textLabel.frame.origin.x; 298 | CGFloat dividerY = 0; 299 | CGFloat dividerH = 1; 300 | CGFloat dividerW = self.frame.size.width; 301 | 302 | self.divider.frame = CGRectMake(dividerX, dividerY, dividerW, dividerH); 303 | } 304 | 305 | @end 306 | -------------------------------------------------------------------------------- /TableViewSettingList/TableViewSettingListDemo/DemoViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // DemoViewController.h 3 | // TableViewSettingList 4 | // 5 | // Created by wangchangfei on 15/9/24. 6 | // Copyright © 2015年 wangchangfei. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | #import "TableViewSettingList.h" 12 | 13 | @interface DemoViewController : CFSettingTableViewController 14 | 15 | @end 16 | -------------------------------------------------------------------------------- /TableViewSettingList/TableViewSettingListDemo/DemoViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // DemoViewController.m 3 | // TableViewSettingList 4 | // 5 | // Created by wangchangfei on 15/9/24. 6 | // Copyright © 2015年 wangchangfei. All rights reserved. 7 | // 8 | 9 | #import "DemoViewController.h" 10 | 11 | #import "Item1ViewController.h" 12 | 13 | @interface DemoViewController () 14 | 15 | @end 16 | 17 | @implementation DemoViewController 18 | 19 | - (void)viewDidLoad { 20 | [super viewDidLoad]; 21 | 22 | self.title = @"发现"; 23 | 24 | // cell箭头名称 25 | self.icon_arrow = @"CellArrow"; 26 | 27 | // //设置相关参数 28 | // //cell背景颜色 29 | // self.backgroundColor_Normal = [UIColor whiteColor]; 30 | // //cell选中背景颜色 31 | // self.backgroundColor_Selected = CFCellBackgroundColor_Highlighted; 32 | // //cell右边Label字体 33 | // self.rightLabelFont = [UIFont systemFontOfSize:15]; 34 | // //cell右边Label文字颜色 35 | // self.rightLabelFontColor = CFRightLabelTextColor; 36 | 37 | 38 | CFSettingArrowItem *item1 =[CFSettingArrowItem itemWithIcon:@"icon1" title:@"朋友圈" destVcClass:[Item1ViewController class]]; 39 | CFSettingGroup *group1 = [[CFSettingGroup alloc] init]; 40 | group1.items = @[ item1]; 41 | 42 | 43 | CFSettingArrowItem *item2 =[CFSettingArrowItem itemWithIcon:@"icon2" title:@"扫一扫" destVcClass:[Item1ViewController class]]; 44 | 45 | CFSettingArrowItem *item3 =[CFSettingArrowItem itemWithIcon:@"icon3" title:@"摇一摇"]; 46 | __weak typeof(self) weakSelf = self; 47 | item3.opration = ^{ 48 | Item1ViewController *vc = [[Item1ViewController alloc]init]; 49 | [weakSelf.navigationController pushViewController:vc animated:YES]; 50 | }; 51 | 52 | CFSettingGroup *group2 = [[CFSettingGroup alloc] init]; 53 | group2.items = @[ item2,item3 ]; 54 | 55 | 56 | CFSettingIconArrowItem *item4 =[CFSettingIconArrowItem itemWithIcon:@"icon4" title:@"附近的人" destVcClass:[Item1ViewController class]]; 57 | item4.icon_right = @"FootStep"; 58 | CFSettingGroup *group3 = [[CFSettingGroup alloc] init]; 59 | group3.items = @[ item4]; 60 | 61 | group3.header = @"头部文本"; 62 | group3.footer = @"底部文本"; 63 | group3.headerHeight = 30; 64 | group3.footerHeight = 30; 65 | 66 | 67 | CFSettingLabelArrowItem *item5 =[CFSettingLabelArrowItem itemWithIcon:@"icon2" title:@"扫一扫" destVcClass:[Item1ViewController class]]; 68 | item5.text_right = @"扫一扫扫一扫"; 69 | 70 | CFSettingLabelItem *item6 =[CFSettingLabelItem itemWithIcon:@"icon3" title:@"摇一摇"]; 71 | item6.text_right = @"摇一摇摇一摇"; 72 | CFSettingGroup *group4 = [[CFSettingGroup alloc] init]; 73 | group4.items = @[ item5,item6 ]; 74 | 75 | 76 | CFSettingSwitchItem *item7 =[CFSettingSwitchItem itemWithIcon:@"icon3" title:@"账号保护"]; 77 | // 用户第一次设置前 默认打开开关 78 | item7.defaultOn = YES; 79 | // 开关状态改变时执行的操作 80 | item7.opration_switch = ^(BOOL isON){ 81 | CFLog(@"UISwitch状态改变 %d",isON); 82 | }; 83 | 84 | BOOL isON = [CFSettingSwitchItem isONSwitchByTitle:item7.title]; 85 | CFLog(@"是否打开了开关 %d",isON); 86 | 87 | CFSettingGroup *group5 = [[CFSettingGroup alloc] init]; 88 | group5.items = @[ item7 ]; 89 | 90 | 91 | CFSettingIconItem *item8 =[CFSettingIconItem itemWithIcon:@"icon3" title:@"右边头像"]; 92 | item8.cellHeight = 60; 93 | item8.icon_right =@"icon_touxiang"; 94 | CFSettingGroup *group6 = [[CFSettingGroup alloc] init]; 95 | group6.items = @[ item8 ]; 96 | 97 | [self.dataList addObject:group1]; 98 | [self.dataList addObject:group2]; 99 | [self.dataList addObject:group3]; 100 | [self.dataList addObject:group4]; 101 | [self.dataList addObject:group5]; 102 | [self.dataList addObject:group6]; 103 | 104 | 105 | } 106 | 107 | @end 108 | -------------------------------------------------------------------------------- /TableViewSettingList/TableViewSettingListDemo/Item1ViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // Item1ViewController.h 3 | // TableViewSettingList 4 | // 5 | // Created by wangchangfei on 15/9/24. 6 | // Copyright © 2015年 wangchangfei. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "TableViewSettingList.h" 11 | 12 | @interface Item1ViewController : CFSettingTableViewController 13 | 14 | @end 15 | -------------------------------------------------------------------------------- /TableViewSettingList/TableViewSettingListDemo/Item1ViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // Item1ViewController.m 3 | // TableViewSettingList 4 | // 5 | // Created by wangchangfei on 15/9/24. 6 | // Copyright © 2015年 wangchangfei. All rights reserved. 7 | // 8 | 9 | #import "Item1ViewController.h" 10 | 11 | @interface Item1ViewController () 12 | 13 | @end 14 | 15 | @implementation Item1ViewController 16 | 17 | - (void)viewDidLoad { 18 | [super viewDidLoad]; 19 | 20 | // cell箭头名称 21 | self.icon_arrow = @"CellArrow"; 22 | 23 | // //设置相关参数 24 | // //cell背景颜色 25 | // self.backgroundColor_Normal = [UIColor whiteColor]; 26 | // //cell选中背景颜色 27 | // self.backgroundColor_Selected = CFCellBackgroundColor_Highlighted; 28 | // //cell右边Label字体 29 | // self.rightLabelFont = [UIFont systemFontOfSize:15]; 30 | // //cell右边Label文字颜色 31 | // self.rightLabelFontColor = CFRightLabelTextColor; 32 | 33 | 34 | CFSettingArrowItem *item1 =[CFSettingArrowItem itemWithIcon:@"icon1" title:@"朋友圈" destVcClass:[Item1ViewController class]]; 35 | CFSettingGroup *group1 = [[CFSettingGroup alloc] init]; 36 | group1.items = @[ item1]; 37 | 38 | UIImageView *view = [[UIImageView alloc]init]; 39 | view.frame = CGRectMake(0, 0, self.view.frame.size.width, 200); 40 | view.image = [UIImage imageNamed:@"icon_header"]; 41 | group1.headerHeight = 200; 42 | group1.headerView = view; 43 | 44 | 45 | CFSettingArrowItem *item2 =[CFSettingArrowItem itemWithIcon:@"icon2" title:@"扫一扫" destVcClass:[Item1ViewController class]]; 46 | CFSettingArrowItem *item3 =[CFSettingArrowItem itemWithIcon:@"icon3" title:@"摇一摇" destVcClass:[Item1ViewController class]]; 47 | CFSettingGroup *group2 = [[CFSettingGroup alloc] init]; 48 | group2.items = @[ item2,item3 ]; 49 | 50 | 51 | CFSettingIconArrowItem *item4 =[CFSettingIconArrowItem itemWithIcon:@"icon4" title:@"附近的人" destVcClass:[Item1ViewController class]]; 52 | item4.icon_right = @"FootStep"; 53 | CFSettingGroup *group3 = [[CFSettingGroup alloc] init]; 54 | group3.items = @[ item4]; 55 | 56 | group3.header = @"头部文本"; 57 | group3.footer = @"底部文本"; 58 | group3.headerHeight = 30; 59 | group3.footerHeight = 30; 60 | 61 | 62 | CFSettingLabelArrowItem *item5 =[CFSettingLabelArrowItem itemWithIcon:@"icon2" title:@"扫一扫" destVcClass:[Item1ViewController class]]; 63 | item5.text_right = @"扫一扫扫一扫"; 64 | 65 | CFSettingLabelItem *item6 =[CFSettingLabelItem itemWithIcon:@"icon3" title:@"摇一摇"]; 66 | item6.text_right = @"摇一摇摇一摇"; 67 | CFSettingGroup *group4 = [[CFSettingGroup alloc] init]; 68 | group4.items = @[ item5,item6 ]; 69 | 70 | 71 | CFSettingSwitchItem *item7 =[CFSettingSwitchItem itemWithIcon:@"icon3" title:@"账号保护"]; 72 | // 用户第一次设置前 默认打开开关 73 | item7.defaultOn = YES; 74 | // 开关状态改变时执行的操作 75 | item7.opration_switch = ^(BOOL isON){ 76 | CFLog(@"UISwitch状态改变 %d",isON); 77 | }; 78 | 79 | // 根据CFSettingSwitchItem的title获取开关状态 80 | BOOL isON = [CFSettingSwitchItem isONSwitchByTitle:item7.title]; 81 | CFLog(@"是否打开了开关 %d",isON); 82 | 83 | CFSettingGroup *group5 = [[CFSettingGroup alloc] init]; 84 | group5.items = @[ item7 ]; 85 | 86 | 87 | CFSettingIconItem *item8 =[CFSettingIconItem itemWithIcon:@"icon3" title:@"右边头像"]; 88 | item8.cellHeight = 60; 89 | item8.icon_right =@"icon_touxiang"; 90 | CFSettingGroup *group6 = [[CFSettingGroup alloc] init]; 91 | group6.items = @[ item8 ]; 92 | 93 | [self.dataList addObject:group1]; 94 | [self.dataList addObject:group2]; 95 | [self.dataList addObject:group3]; 96 | [self.dataList addObject:group4]; 97 | [self.dataList addObject:group5]; 98 | [self.dataList addObject:group6]; 99 | 100 | } 101 | @end 102 | -------------------------------------------------------------------------------- /TableViewSettingList/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // TableViewSettingList 4 | // 5 | // Created by wangchangfei on 15/9/24. 6 | // Copyright © 2015年 wangchangfei. 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 | --------------------------------------------------------------------------------