├── .swift-version ├── LICENSE ├── README.md ├── SJStaticTableView.podspec ├── SJStaticTableViewComponent ├── Factory.h ├── Factory.m ├── Resources │ └── arrow@2x.png ├── SJConst.h ├── SJStaticTableView.h ├── SJStaticTableView.m ├── SJStaticTableViewCell+AccessoryDisclosureIndicator.h ├── SJStaticTableViewCell+AccessoryDisclosureIndicator.m ├── SJStaticTableViewCell+AccessoryNone.h ├── SJStaticTableViewCell+AccessoryNone.m ├── SJStaticTableViewCell+AccessorySwitch.h ├── SJStaticTableViewCell+AccessorySwitch.m ├── SJStaticTableViewCell+Logout.h ├── SJStaticTableViewCell+Logout.m ├── SJStaticTableViewCell+MeAvatar.h ├── SJStaticTableViewCell+MeAvatar.m ├── SJStaticTableViewCell.h ├── SJStaticTableViewCell.m ├── SJStaticTableViewController.h ├── SJStaticTableViewController.m ├── SJStaticTableViewDataSource.h ├── SJStaticTableViewDataSource.m ├── SJStaticTableViewHeader.h ├── SJStaticTableviewCellViewModel.h ├── SJStaticTableviewCellViewModel.m ├── SJStaticTableviewSectionViewModel.h └── SJStaticTableviewSectionViewModel.m └── SJStaticTableViewDemo ├── SJStaticTableViewDemo.xcodeproj ├── project.pbxproj ├── project.xcworkspace │ ├── contents.xcworkspacedata │ └── xcuserdata │ │ └── SunShijie.xcuserdatad │ │ └── UserInterfaceState.xcuserstate └── xcuserdata │ └── SunShijie.xcuserdatad │ ├── xcdebugger │ └── Breakpoints_v2.xcbkptlist │ └── xcschemes │ ├── SJStaticTableViewDemo.xcscheme │ └── xcschememanagement.plist ├── SJStaticTableViewDemo ├── AppDelegate.h ├── AppDelegate.m ├── Base.lproj │ ├── LaunchScreen.storyboard │ └── Main.storyboard ├── BaseController │ ├── SJNavigationController.h │ ├── SJNavigationController.m │ ├── SJTabBarController.h │ └── SJTabBarController.m ├── Discover.xcassets │ ├── Contents.json │ ├── CreditCard_ShoppingBag.imageset │ │ ├── Contents.json │ │ └── CreditCard_ShoppingBag@2x.png │ ├── MoreGame.imageset │ │ ├── Contents.json │ │ ├── MoreGame.png │ │ ├── MoreGame@2x.png │ │ └── MoreGame@3x.png │ ├── Shake_icon_people.imageset │ │ ├── Contents.json │ │ └── Shake_icon_people@2x.png │ ├── Shake_icon_peopleHL.imageset │ │ ├── Contents.json │ │ └── Shake_icon_peopleHL@2x.png │ ├── doudizhu.imageset │ │ ├── Contents.json │ │ └── doudizhu@2x.png │ ├── ff_IconBottle.imageset │ │ ├── Contents.json │ │ ├── ff_IconBottle.png │ │ ├── ff_IconBottle@2x.png │ │ └── ff_IconBottle@3x.png │ ├── ff_IconLocationService.imageset │ │ ├── Contents.json │ │ ├── ff_IconLocationService.png │ │ ├── ff_IconLocationService@2x.png │ │ └── ff_IconLocationService@3x.png │ ├── ff_IconQRCode.imageset │ │ ├── Contents.json │ │ ├── ff_IconQRCode.png │ │ ├── ff_IconQRCode@2x.png │ │ └── ff_IconQRCode@3x.png │ ├── ff_IconShake.imageset │ │ ├── Contents.json │ │ ├── ff_IconShake.png │ │ ├── ff_IconShake@2x.png │ │ └── ff_IconShake@3x.png │ ├── ff_IconShowAlbum.imageset │ │ ├── Contents.json │ │ ├── ff_IconShowAlbum.png │ │ ├── ff_IconShowAlbum@2x.png │ │ └── ff_IconShowAlbum@3x.png │ └── game_1.imageset │ │ ├── Contents.json │ │ └── game_1@2x.png ├── Emoji.xcassets │ ├── Contents.json │ ├── emoji_1.imageset │ │ ├── Contents.json │ │ └── emoji_1@2x.png │ ├── emoji_2.imageset │ │ ├── Contents.json │ │ └── emoji_2@2x.png │ ├── emoji_3.imageset │ │ ├── Contents.json │ │ └── emoji_3@2x.png │ ├── emoji_4.imageset │ │ ├── Contents.json │ │ └── emoji_4@2x.png │ ├── emoji_5.imageset │ │ ├── Contents.json │ │ └── emoji_5@2x.png │ └── emoji_6.imageset │ │ ├── Contents.json │ │ └── emoji_6@2x.png ├── Images.xcassets │ ├── AppIcon.appiconset │ │ ├── Contents.json │ │ ├── Icon-60@2x.png │ │ ├── Icon-60@3x.png │ │ ├── Icon-72.png │ │ ├── Icon-72@2x.png │ │ ├── Icon-76.png │ │ ├── Icon-76@2x.png │ │ ├── Icon-Small-1.png │ │ ├── Icon-Small-50.png │ │ ├── Icon-Small-50@2x.png │ │ ├── Icon-Small@2x-1.png │ │ ├── Icon-Small@2x.png │ │ ├── Icon-Small@3x.png │ │ ├── Icon-Spotlight-40.png │ │ ├── Icon-Spotlight-40@2x-1.png │ │ ├── Icon-Spotlight-40@2x.png │ │ ├── Icon-Spotlight-40@3x.png │ │ ├── Icon.png │ │ └── Icon@2x.png │ ├── Contents.json │ ├── launch.imageset │ │ ├── Contents.json │ │ └── launch@2x.png │ ├── tabbar_contacts.imageset │ │ ├── Contents.json │ │ ├── tabbar_contacts@2x.png │ │ └── tabbar_contacts@3x.png │ ├── tabbar_contactsHL.imageset │ │ ├── Contents.json │ │ ├── tabbar_contactsHL@2x.png │ │ └── tabbar_contactsHL@3x.png │ ├── tabbar_discover.imageset │ │ ├── Contents.json │ │ ├── tabbar_discover@2x.png │ │ └── tabbar_discover@3x.png │ ├── tabbar_discoverHL.imageset │ │ ├── Contents.json │ │ ├── tabbar_discoverHL@2x.png │ │ └── tabbar_discoverHL@3x.png │ ├── tabbar_mainframe.imageset │ │ ├── Contents.json │ │ ├── tabbar_mainframe@2x.png │ │ └── tabbar_mainframe@3x.png │ ├── tabbar_mainframeHL.imageset │ │ ├── Contents.json │ │ ├── tabbar_mainframeHL@2x.png │ │ └── tabbar_mainframeHL@3x.png │ ├── tabbar_me.imageset │ │ ├── Contents.json │ │ ├── tabbar_me@2x.png │ │ └── tabbar_me@3x.png │ └── tabbar_meHL.imageset │ │ ├── Contents.json │ │ ├── tabbar_meHL@2x.png │ │ └── tabbar_meHL@3x.png ├── Info.plist ├── MBProgressHUD │ ├── MBProgressHUD.h │ └── MBProgressHUD.m ├── Me.xcassets │ ├── Contents.json │ ├── MoreMyAlbum.imageset │ │ ├── Contents.json │ │ ├── MoreMyAlbum.png │ │ ├── MoreMyAlbum@2x.png │ │ └── MoreMyAlbum@3x.png │ ├── MoreMyBankCard.imageset │ │ ├── Contents.json │ │ ├── MoreMyBankCard.png │ │ ├── MoreMyBankCard@2x.png │ │ └── MoreMyBankCard@3x.png │ ├── MoreMyFavorites.imageset │ │ ├── Contents.json │ │ ├── MoreMyFavorites.png │ │ ├── MoreMyFavorites@2x.png │ │ └── MoreMyFavorites@3x.png │ ├── MoreSetting.imageset │ │ ├── Contents.json │ │ ├── MoreSetting@2x.png │ │ └── MoreSetting@3x.png │ ├── MyCardPackageIcon.imageset │ │ ├── Contents.json │ │ └── MyCardPackageIcon@2x.png │ ├── ProfileLockOn.imageset │ │ ├── Contents.json │ │ ├── ProfileLockOn@2x.png │ │ └── ProfileLockOn@3x.png │ ├── avatar.imageset │ │ ├── Contents.json │ │ └── avatar@2x.png │ ├── emoticon.imageset │ │ ├── Contents.json │ │ └── emoticon@2x.png │ ├── qrcode.imageset │ │ ├── Contents.json │ │ └── qrcode@2x.png │ └── wzry.imageset │ │ ├── Contents.json │ │ └── wzry@2x.png ├── SJStaticTableViewComponent │ ├── Factory.h │ ├── Factory.m │ ├── Resources │ │ └── arrow@2x.png │ ├── SJConst.h │ ├── SJStaticTableView.h │ ├── SJStaticTableView.m │ ├── SJStaticTableViewCell+AccessoryDisclosureIndicator.h │ ├── SJStaticTableViewCell+AccessoryDisclosureIndicator.m │ ├── SJStaticTableViewCell+AccessoryNone.h │ ├── SJStaticTableViewCell+AccessoryNone.m │ ├── SJStaticTableViewCell+AccessorySwitch.h │ ├── SJStaticTableViewCell+AccessorySwitch.m │ ├── SJStaticTableViewCell+Logout.h │ ├── SJStaticTableViewCell+Logout.m │ ├── SJStaticTableViewCell+MeAvatar.h │ ├── SJStaticTableViewCell+MeAvatar.m │ ├── SJStaticTableViewCell.h │ ├── SJStaticTableViewCell.m │ ├── SJStaticTableViewController.h │ ├── SJStaticTableViewController.m │ ├── SJStaticTableViewDataSource.h │ ├── SJStaticTableViewDataSource.m │ ├── SJStaticTableViewHeader.h │ ├── SJStaticTableviewCellViewModel.h │ ├── SJStaticTableviewCellViewModel.m │ ├── SJStaticTableviewSectionViewModel.h │ └── SJStaticTableviewSectionViewModel.m ├── ViewController.h ├── ViewController.m ├── ViewController │ ├── SJCustomCellsOneSectionViewController.h │ ├── SJCustomCellsOneSectionViewController.m │ ├── SJCustomCellsViewController.h │ ├── SJCustomCellsViewController.m │ ├── SJDiscoverViewController.h │ ├── SJDiscoverViewController.m │ ├── SJEmoticonViewController.h │ ├── SJEmoticonViewController.m │ ├── SJInfoViewController.h │ ├── SJInfoViewController.m │ ├── SJMeViewController.h │ ├── SJMeViewController.m │ ├── SJSettingViewController.h │ └── SJSettingViewController.m └── main.m ├── SJStaticTableViewDemoTests ├── Info.plist └── SJStaticTableViewDemoTests.m └── SJStaticTableViewDemoUITests ├── Info.plist └── SJStaticTableViewDemoUITests.m /.swift-version: -------------------------------------------------------------------------------- 1 | 3.0 2 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2017 J_Knight 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /SJStaticTableView.podspec: -------------------------------------------------------------------------------- 1 | 2 | 3 | Pod::Spec.new do |s| 4 | 5 | s.name = "SJStaticTableView" 6 | s.version = "1.2.0" 7 | s.summary = "SJStaticTableView can be used to establish ViewControllers which contain static tableview such as setting page and userinfo page." 8 | s.homepage = "https://github.com/knightsj/SJStaticTableView" 9 | s.license = "MIT" 10 | s.author = { "Sun Shijie" => "ssjlife0111@163.com" } 11 | s.source = { :git => "https://github.com/knightsj/SJStaticTableView.git", :tag => "#{s.version}" } 12 | s.platform = :ios, '6.0' 13 | s.requires_arc = true 14 | s.source_files = 'SJStaticTableViewComponent/**/*.{h,m}' 15 | s.resource = 'SJStaticTableViewComponent/Resources/arrow@2x.png' 16 | end 17 | -------------------------------------------------------------------------------- /SJStaticTableViewComponent/Factory.h: -------------------------------------------------------------------------------- 1 | // 2 | // Factory.h 3 | // SSJStaticTableViewDemo 4 | // 5 | // Created by Sun Shijie on 2017/3/15. 6 | // Copyright © 2017年 Shijie. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface Factory : NSObject 12 | 13 | //我页面 14 | + (NSArray *)mePageData; 15 | 16 | //设置页面 17 | + (NSArray *)settingPageData; 18 | 19 | //个人信息页 20 | + (NSArray *)infoPageData; 21 | 22 | //发现页 23 | + (NSArray *)momentsPageData; 24 | 25 | //定制cell页 - 分组 26 | + (NSArray *)customCellsPageData; 27 | 28 | //定制cell页 - 同组 29 | + (NSArray *)customCellsOneSectionPageData; 30 | 31 | //表情页 32 | + (NSArray *)emoticonPage; 33 | 34 | @end 35 | -------------------------------------------------------------------------------- /SJStaticTableViewComponent/Resources/arrow@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/knightsj/SJStaticTableView/6fb11c1f13569763a722c7d839bdfc3935735c9c/SJStaticTableViewComponent/Resources/arrow@2x.png -------------------------------------------------------------------------------- /SJStaticTableViewComponent/SJConst.h: -------------------------------------------------------------------------------- 1 | // 2 | // SJConst.h 3 | // SSJStaticTableViewDemo 4 | // 5 | // Created by Sun Shijie on 2017/3/18. 6 | // Copyright © 2017年 Shijie. All rights reserved. 7 | // 8 | 9 | #ifndef SJConst_h 10 | #define SJConst_h 11 | 12 | //distance 13 | #define SJScreenWidth [UIScreen mainScreen].bounds.size.width 14 | #define SJScreenHeight [UIScreen mainScreen].bounds.size.height 15 | 16 | #define SJTopGap 8 //same as bottom gap 17 | #define SJLeftGap 12 //same as right gap 18 | #define SJLeftMiddleGap 10 //in left part: the gap between image and label 19 | #define SJRightMiddleGap 6 //in right part: the gap between image and label 20 | #define SJImgWidth 30 21 | #define SJTitleWidthLimit 180 22 | 23 | 24 | //image 25 | #define SJIndicatorArrow @"arrow" 26 | 27 | 28 | //font 29 | #define SJLeftTitleTextFont [UIFont systemFontOfSize:15] 30 | #define SJLogoutButtonFont [UIFont systemFontOfSize:16] 31 | #define SJIndicatorLeftTitleTextFont [UIFont systemFontOfSize:13] 32 | 33 | //color 34 | #define SJColorWithRGB(R,G,B,A) [UIColor colorWithRed:R/255.0 green:G/255.0 blue:B/255.0 alpha:A] 35 | #define SJLeftTitleTextColor [UIColor blackColor] 36 | #define SJIndicatorLeftTitleTextColor SJColorWithRGB(136,136,136,1) 37 | 38 | 39 | #endif /* SJConst_h */ 40 | -------------------------------------------------------------------------------- /SJStaticTableViewComponent/SJStaticTableView.h: -------------------------------------------------------------------------------- 1 | // 2 | // SJStaticTableView.h 3 | // SSJStaticTableViewDemo 4 | // 5 | // Created by Sun Shijie on 2017/3/15. 6 | // Copyright © 2017年 Shijie. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "SJStaticTableViewDataSource.h" 11 | 12 | 13 | 14 | @protocol SJStaticTableViewDelegate 15 | 16 | @optional 17 | 18 | - (void)didSelectViewModel: (SJStaticTableviewCellViewModel *)viewModel atIndexPath:(NSIndexPath *)indexPath; 19 | 20 | @end 21 | 22 | 23 | 24 | 25 | 26 | @interface SJStaticTableView : UITableView 27 | 28 | @property (nonatomic, weak) id sjDelegate; 29 | @property (nonatomic, weak) id sjDataSource; 30 | 31 | @end 32 | -------------------------------------------------------------------------------- /SJStaticTableViewComponent/SJStaticTableView.m: -------------------------------------------------------------------------------- 1 | // 2 | // SJStaticTableView.m 3 | // SSJStaticTableViewDemo 4 | // 5 | // Created by Sun Shijie on 2017/3/15. 6 | // Copyright © 2017年 Shijie. All rights reserved. 7 | // 8 | 9 | #import "SJStaticTableView.h" 10 | #import "SJStaticTableviewCellViewModel.h" 11 | #import "SJStaticTableviewSectionViewModel.h" 12 | #import "SJStaticTableViewCell.h" 13 | 14 | @implementation SJStaticTableView 15 | 16 | - (instancetype)initWithFrame:(CGRect)frame style:(UITableViewStyle)style { 17 | self = [super initWithFrame:frame style:style]; 18 | if (self) { 19 | self.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight; 20 | self.showsVerticalScrollIndicator = NO; 21 | self.showsHorizontalScrollIndicator = NO; 22 | self.backgroundColor = SJColorWithRGB(240, 239, 245, 1); 23 | self.tableFooterView = [[UIView alloc]initWithFrame:CGRectZero]; 24 | self.delegate = self; 25 | } 26 | return self; 27 | } 28 | 29 | - (void)setSjDataSource:(id)sjDataSource 30 | { 31 | if (_sjDataSource != sjDataSource) { 32 | _sjDataSource = sjDataSource; 33 | self.dataSource = _sjDataSource; 34 | } 35 | } 36 | 37 | #pragma mark - Tableview Delegate 38 | 39 | - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath 40 | { 41 | SJStaticTableviewCellViewModel *cellViewModel = [self.sjDataSource tableView:tableView cellViewModelAtIndexPath:indexPath]; 42 | return cellViewModel.cellHeight; 43 | } 44 | 45 | 46 | - (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section 47 | { 48 | SJStaticTableviewSectionViewModel *sectionViewModel = [self.sjDataSource tableView:tableView sectionViewModelInSection:section]; 49 | return sectionViewModel.sectionHeaderHeight; 50 | } 51 | 52 | - (CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section 53 | { 54 | SJStaticTableviewSectionViewModel *sectionViewModel = [self.sjDataSource tableView:tableView sectionViewModelInSection:section]; 55 | return sectionViewModel.sectionFooterHeight; 56 | } 57 | 58 | 59 | - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath 60 | { 61 | [tableView deselectRowAtIndexPath:indexPath animated:YES]; 62 | if ((self.sjDelegate) && [self.sjDelegate respondsToSelector:@selector(didSelectViewModel:atIndexPath:)]) { 63 | 64 | SJStaticTableviewCellViewModel *cellViewModel = [self.sjDataSource tableView:tableView cellViewModelAtIndexPath:indexPath]; 65 | [self.sjDelegate didSelectViewModel:cellViewModel atIndexPath:indexPath]; 66 | 67 | }else if((self.sjDelegate)&& [self.sjDelegate respondsToSelector:@selector(tableView:didSelectRowAtIndexPath:)]){ 68 | 69 | [self.sjDelegate tableView:tableView didSelectRowAtIndexPath:indexPath]; 70 | 71 | } 72 | } 73 | 74 | 75 | @end 76 | -------------------------------------------------------------------------------- /SJStaticTableViewComponent/SJStaticTableViewCell+AccessoryDisclosureIndicator.h: -------------------------------------------------------------------------------- 1 | // 2 | // SJStaticTableViewCell+AccessoryDisclosureIndicator.h 3 | // SSJStaticTableViewDemo 4 | // 5 | // Created by Sun Shijie on 2017/3/15. 6 | // Copyright © 2017年 Shijie. All rights reserved. 7 | // 8 | 9 | #import "SJStaticTableViewCell.h" 10 | 11 | @interface SJStaticTableViewCell (AccessoryDisclosureIndicator) 12 | 13 | - (void)configureAccessoryDisclosureIndicatorCellWithViewModel:(SJStaticTableviewCellViewModel *)viewModel; 14 | 15 | @end 16 | -------------------------------------------------------------------------------- /SJStaticTableViewComponent/SJStaticTableViewCell+AccessoryDisclosureIndicator.m: -------------------------------------------------------------------------------- 1 | // 2 | // SJStaticTableViewCell+AccessoryDisclosureIndicator.m 3 | // SSJStaticTableViewDemo 4 | // 5 | // Created by Sun Shijie on 2017/3/15. 6 | // Copyright © 2017年 Shijie. All rights reserved. 7 | // 8 | 9 | #import "SJStaticTableViewCell+AccessoryDisclosureIndicator.h" 10 | 11 | @implementation SJStaticTableViewCell (AccessoryDisclosureIndicator) 12 | 13 | - (void)configureAccessoryDisclosureIndicatorCellWithViewModel:(SJStaticTableviewCellViewModel *)viewModel 14 | { 15 | //左侧控件的配置 16 | [self layoutLeftPartSubViewsWithViewModel:viewModel]; 17 | 18 | //右侧存在箭头 19 | [self.contentView addSubview:self.indicatorArrow]; 20 | 21 | //右侧存在箭头+文字 22 | if ( (viewModel.indicatorLeftTitle) && (viewModel.indicatorLeftLabelSize.width != 0)) { 23 | [self.contentView addSubview:self.indicatorLeftLabel]; 24 | [self configureIndicatorLeftLabel]; 25 | } 26 | 27 | //右侧存在箭头+图片 28 | if ((self.viewModel.indicatorLeftImage) && (viewModel.indicatorLeftImageSize.height != 0)){ 29 | [self.contentView addSubview:self.indicatorLeftImageView]; 30 | [self configureIndicatorLeftImage]; 31 | } 32 | } 33 | 34 | //将右侧label的配置从懒加载里抽出来 35 | - (void)configureIndicatorLeftLabel 36 | { 37 | 38 | self.indicatorLeftLabel.font = self.viewModel.indicatorLeftLabelTextFont; 39 | self.indicatorLeftLabel.textColor = self.viewModel.indicatorLeftLabelTextColor; 40 | self.indicatorLeftLabel.text = self.viewModel.indicatorLeftTitle; 41 | 42 | if (!self.viewModel.hasIndicatorImageAndLabel) { 43 | //只存在右侧Label 44 | self.indicatorLeftLabel.frame = CGRectMake(self.indicatorArrow.frame.origin.x - SJLeftGap - self.viewModel.indicatorLeftLabelSize.width , (self.viewModel.cellHeight - self.viewModel.indicatorLeftLabelSize.height)/2, self.viewModel.indicatorLeftLabelSize.width, self.viewModel.indicatorLeftLabelSize.height); 45 | }else{ 46 | //右侧Label和image同时存在 47 | if (self.viewModel.isImageFirst) { 48 | 49 | self.indicatorLeftLabel.frame = CGRectMake(SJScreenWidth - SJLeftGap - self.indicatorArrow.bounds.size.width - self.viewModel.indicatorLeftImageAndLabelGap - self.viewModel.indicatorLeftImageSize.width - SJLeftGap - self.viewModel.indicatorLeftLabelSize.width, (self.viewModel.cellHeight - self.viewModel.indicatorLeftLabelSize.height)/2, self.viewModel.indicatorLeftLabelSize.width, self.viewModel.indicatorLeftLabelSize.height); 50 | 51 | }else{ 52 | 53 | self.indicatorLeftLabel.frame = CGRectMake(SJScreenWidth - SJLeftGap - self.indicatorArrow.bounds.size.width - SJLeftGap - self.viewModel.indicatorLeftLabelSize.width, (self.viewModel.cellHeight - self.viewModel.indicatorLeftLabelSize.height)/2, self.viewModel.indicatorLeftLabelSize.width, self.viewModel.indicatorLeftLabelSize.height); 54 | } 55 | } 56 | } 57 | 58 | //将右侧image的配置从懒加载里抽出来 59 | - (void)configureIndicatorLeftImage 60 | { 61 | self.indicatorLeftImageView.image = self.viewModel.indicatorLeftImage; 62 | 63 | if (!self.viewModel.hasIndicatorImageAndLabel) { 64 | //只存在右侧image 65 | self.indicatorLeftImageView.frame = CGRectMake(self.indicatorArrow.frame.origin.x - SJLeftGap - self.viewModel.indicatorLeftImageSize.width, (self.viewModel.cellHeight - self.viewModel.indicatorLeftImageSize.height)/2, self.viewModel.indicatorLeftImageSize.width , self.viewModel.indicatorLeftImageSize.height); 66 | }else{ 67 | //右侧Label和image同时存在 68 | if (self.viewModel.isImageFirst) { 69 | 70 | self.indicatorLeftImageView.frame = CGRectMake(SJScreenWidth - SJLeftGap - self.indicatorArrow.bounds.size.width - SJLeftGap - self.viewModel.indicatorLeftImageSize.width, (self.viewModel.cellHeight - self.viewModel.indicatorLeftImageSize.height)/2, self.viewModel.indicatorLeftImageSize.width, self.viewModel.indicatorLeftImageSize.height); 71 | 72 | }else{ 73 | 74 | self.indicatorLeftImageView.frame = CGRectMake(SJScreenWidth - SJLeftGap - self.indicatorArrow.bounds.size.width - self.viewModel.indicatorLeftImageAndLabelGap - self.viewModel.indicatorLeftLabelSize.width - SJLeftGap - self.viewModel.indicatorLeftImageSize.width, (self.viewModel.cellHeight - self.viewModel.indicatorLeftImageSize.height)/2, self.viewModel.indicatorLeftImageSize.width,self.viewModel.indicatorLeftImageSize.height); 75 | } 76 | 77 | } 78 | } 79 | 80 | @end 81 | -------------------------------------------------------------------------------- /SJStaticTableViewComponent/SJStaticTableViewCell+AccessoryNone.h: -------------------------------------------------------------------------------- 1 | // 2 | // SJStaticTableViewCell+AccessoryNone.h 3 | // SSJStaticTableViewDemo 4 | // 5 | // Created by Sun Shijie on 2017/3/17. 6 | // Copyright © 2017年 Shijie. All rights reserved. 7 | // 8 | 9 | #import "SJStaticTableViewCell.h" 10 | 11 | @interface SJStaticTableViewCell (AccessoryNone) 12 | 13 | - (void)configureAccessoryNoneCellWithViewModel:(SJStaticTableviewCellViewModel *)viewModel; 14 | 15 | @end 16 | -------------------------------------------------------------------------------- /SJStaticTableViewComponent/SJStaticTableViewCell+AccessoryNone.m: -------------------------------------------------------------------------------- 1 | // 2 | // SJStaticTableViewCell+AccessoryNone.m 3 | // SSJStaticTableViewDemo 4 | // 5 | // Created by Sun Shijie on 2017/3/17. 6 | // Copyright © 2017年 Shijie. All rights reserved. 7 | // 8 | 9 | #import "SJStaticTableViewCell+AccessoryNone.h" 10 | 11 | @implementation SJStaticTableViewCell (AccessoryNone) 12 | 13 | - (void)configureAccessoryNoneCellWithViewModel:(SJStaticTableviewCellViewModel *)viewModel 14 | { 15 | [self layoutLeftPartSubViewsWithViewModel:viewModel]; 16 | } 17 | @end 18 | -------------------------------------------------------------------------------- /SJStaticTableViewComponent/SJStaticTableViewCell+AccessorySwitch.h: -------------------------------------------------------------------------------- 1 | // 2 | // SJStaticTableViewCell+AccessorySwitch.h 3 | // SSJStaticTableViewDemo 4 | // 5 | // Created by Sun Shijie on 2017/3/17. 6 | // Copyright © 2017年 Shijie. All rights reserved. 7 | // 8 | 9 | #import "SJStaticTableViewCell.h" 10 | 11 | @interface SJStaticTableViewCell (AccessorySwitch) 12 | 13 | - (void)configureAccessorySwitchCellWithViewModel:(SJStaticTableviewCellViewModel *)viewModel; 14 | 15 | @end 16 | -------------------------------------------------------------------------------- /SJStaticTableViewComponent/SJStaticTableViewCell+AccessorySwitch.m: -------------------------------------------------------------------------------- 1 | // 2 | // SJStaticTableViewCell+AccessorySwitch.m 3 | // SSJStaticTableViewDemo 4 | // 5 | // Created by Sun Shijie on 2017/3/17. 6 | // Copyright © 2017年 Shijie. All rights reserved. 7 | // 8 | 9 | #import "SJStaticTableViewCell+AccessorySwitch.h" 10 | 11 | @implementation SJStaticTableViewCell (AccessorySwitch) 12 | 13 | - (void)configureAccessorySwitchCellWithViewModel:(SJStaticTableviewCellViewModel *)viewModel 14 | { 15 | [self layoutLeftPartSubViewsWithViewModel:viewModel]; 16 | [self.contentView addSubview:self.indicatorSwitch]; 17 | } 18 | 19 | @end 20 | -------------------------------------------------------------------------------- /SJStaticTableViewComponent/SJStaticTableViewCell+Logout.h: -------------------------------------------------------------------------------- 1 | // 2 | // SJStaticTableViewCell+Logout.h 3 | // SSJStaticTableViewDemo 4 | // 5 | // Created by Sun Shijie on 2017/3/16. 6 | // Copyright © 2017年 Shijie. All rights reserved. 7 | // 8 | 9 | #import "SJStaticTableViewCell.h" 10 | 11 | @interface SJStaticTableViewCell (Logout) 12 | 13 | - (void)configureLogoutTableViewCellWithViewModel:(SJStaticTableviewCellViewModel *)viewModel; 14 | 15 | @end 16 | -------------------------------------------------------------------------------- /SJStaticTableViewComponent/SJStaticTableViewCell+Logout.m: -------------------------------------------------------------------------------- 1 | // 2 | // SJStaticTableViewCell+Logout.m 3 | // SSJStaticTableViewDemo 4 | // 5 | // Created by Sun Shijie on 2017/3/16. 6 | // Copyright © 2017年 Shijie. All rights reserved. 7 | // 8 | 9 | #import "SJStaticTableViewCell+Logout.h" 10 | 11 | @implementation SJStaticTableViewCell (Logout) 12 | 13 | - (void)configureLogoutTableViewCellWithViewModel:(SJStaticTableviewCellViewModel *)viewModel 14 | { 15 | self.viewModel = viewModel; 16 | [self.contentView addSubview:self.logoutLabel]; 17 | } 18 | @end 19 | -------------------------------------------------------------------------------- /SJStaticTableViewComponent/SJStaticTableViewCell+MeAvatar.h: -------------------------------------------------------------------------------- 1 | // 2 | // SJStaticTableViewCell+MeAvatar.h 3 | // SSJStaticTableViewDemo 4 | // 5 | // Created by Sun Shijie on 2017/3/15. 6 | // Copyright © 2017年 Shijie. All rights reserved. 7 | // 8 | 9 | #import "SJStaticTableViewCell.h" 10 | 11 | @interface SJStaticTableViewCell (MeAvatar) 12 | 13 | - (void)configureMeAvatarTableViewCellWithViewModel:(SJStaticTableviewCellViewModel *)viewModel; 14 | 15 | @end 16 | -------------------------------------------------------------------------------- /SJStaticTableViewComponent/SJStaticTableViewCell+MeAvatar.m: -------------------------------------------------------------------------------- 1 | // 2 | // SJStaticTableViewCell+MeAvatar.m 3 | // SSJStaticTableViewDemo 4 | // 5 | // Created by Sun Shijie on 2017/3/15. 6 | // Copyright © 2017年 Shijie. All rights reserved. 7 | // 8 | 9 | #import "SJStaticTableViewCell+MeAvatar.h" 10 | 11 | @implementation SJStaticTableViewCell (MeAvatar) 12 | 13 | - (void)configureMeAvatarTableViewCellWithViewModel:(SJStaticTableviewCellViewModel *)viewModel{ 14 | 15 | self.viewModel = viewModel; 16 | 17 | [self.contentView addSubview:self.avatarImageView]; 18 | [self.contentView addSubview:self.userNameLabel]; 19 | [self.contentView addSubview:self.userIdLabel]; 20 | [self.contentView addSubview:self.avatarIndicatorImageView]; 21 | [self.contentView addSubview:self.codeImageView]; 22 | 23 | } 24 | 25 | 26 | 27 | @end 28 | -------------------------------------------------------------------------------- /SJStaticTableViewComponent/SJStaticTableViewCell.h: -------------------------------------------------------------------------------- 1 | // 2 | // SJStaticTableViewCell.h 3 | // SSJStaticTableViewDemo 4 | // 5 | // Created by Sun Shijie on 2017/3/15. 6 | // Copyright © 2017年 Shijie. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "SJStaticTableviewCellViewModel.h" 11 | 12 | //所有cell都是这个类的分类 13 | 14 | @interface SJStaticTableViewCell : UITableViewCell 15 | 16 | @property (nonatomic, strong) SJStaticTableviewCellViewModel *viewModel; 17 | 18 | // =============== 系统风格cell的所有控件 =============== // 19 | 20 | //左半部分 21 | @property (nonatomic, strong) UIImageView *leftImageView; //左侧的ImageView 22 | @property (nonatomic, strong) UILabel *leftTitleLabel; //左侧的Label 23 | 24 | //右半部分 25 | @property (nonatomic, strong) UIImageView *indicatorArrow; //右侧的箭头 26 | @property (nonatomic, strong) UIImageView *indicatorLeftImageView; //右侧的箭头的左边的imageview 27 | @property (nonatomic, strong) UILabel *indicatorLeftLabel; //右侧的箭头的左边的Label 28 | @property (nonatomic, strong) UISwitch *indicatorSwitch; //右侧的箭头的左边的开关 29 | @property (nonatomic, strong) UILabel *logoutLabel; //退出登录的label 30 | 31 | // =============== 用户自定义的cell里面的控件 =============== // 32 | 33 | //MeViewController里面的头像cell 34 | @property (nonatomic, strong) UIImageView *avatarImageView; 35 | @property (nonatomic, strong) UIImageView *codeImageView; 36 | @property (nonatomic, strong) UIImageView *avatarIndicatorImageView; 37 | @property (nonatomic, strong) UILabel *userNameLabel; 38 | @property (nonatomic, strong) UILabel *userIdLabel; 39 | 40 | 41 | //统一的,布局cell左侧部分的内容(标题 / 图片 + 标题),所有系统风格的cell都要调用这个方法 42 | - (void)layoutLeftPartSubViewsWithViewModel:(SJStaticTableviewCellViewModel *)viewModel; 43 | 44 | 45 | @end 46 | -------------------------------------------------------------------------------- /SJStaticTableViewComponent/SJStaticTableViewCell.m: -------------------------------------------------------------------------------- 1 | // 2 | // SJStaticTableViewCell.m 3 | // SSJStaticTableViewDemo 4 | // 5 | // Created by Sun Shijie on 2017/3/15. 6 | // Copyright © 2017年 Shijie. All rights reserved. 7 | // 8 | 9 | #import "SJStaticTableViewCell.h" 10 | 11 | @implementation SJStaticTableViewCell 12 | 13 | 14 | - (void)layoutLeftPartSubViewsWithViewModel:(SJStaticTableviewCellViewModel *)viewModel 15 | { 16 | self.viewModel = viewModel; 17 | 18 | //存在最左边的图片 19 | if (self.viewModel.leftImage) { 20 | 21 | [self.contentView addSubview:self.leftImageView]; 22 | 23 | self.leftImageView.image = self.viewModel.leftImage; 24 | self.leftImageView.frame = CGRectMake(SJLeftGap, (self.viewModel.cellHeight - self.viewModel.leftImageSize.height)/2, self.viewModel.leftImageSize.width , self.viewModel.leftImageSize.height); 25 | } 26 | 27 | 28 | //存在标题文字 29 | if (self.viewModel.leftTitle.length) { 30 | 31 | [self.contentView addSubview:self.leftTitleLabel]; 32 | 33 | self.leftTitleLabel.font = self.viewModel.leftLabelTextFont; 34 | self.leftTitleLabel.textColor = self.viewModel.leftLabelTextColor; 35 | self.leftTitleLabel.text = self.viewModel.leftTitle; 36 | 37 | CGFloat x = 0; 38 | if (_leftImageView) { 39 | x = CGRectGetMaxX(self.leftImageView.frame) + self.viewModel.leftImageAndLabelGap; 40 | }else{ 41 | x = SJLeftGap; 42 | } 43 | 44 | self.leftTitleLabel.frame = CGRectMake( x, (self.viewModel.cellHeight - self.viewModel.leftTitleLabelSize.height)/2, self.viewModel.leftTitleLabelSize.width, self.viewModel.leftTitleLabelSize.height); 45 | } 46 | 47 | } 48 | 49 | 50 | 51 | #pragma mark- switch block 52 | - (void)switchTouched:(UISwitch *)indicatorSwitch 53 | { 54 | if (self.viewModel.switchValueDidChangeBlock){ 55 | self.viewModel.switchValueDidChangeBlock(indicatorSwitch.isOn); 56 | } 57 | } 58 | 59 | 60 | #pragma mark- system-like cell 61 | #pragma mark basic views 62 | - (UIImageView *)leftImageView 63 | { 64 | if (!_leftImageView) { 65 | _leftImageView = [[UIImageView alloc] init]; 66 | } 67 | return _leftImageView; 68 | } 69 | 70 | - (UILabel *)leftTitleLabel 71 | { 72 | if (!_leftTitleLabel) { 73 | _leftTitleLabel= [[UILabel alloc] init]; 74 | } 75 | return _leftTitleLabel; 76 | } 77 | 78 | 79 | - (UISwitch *)indicatorSwitch 80 | { 81 | if (!_indicatorSwitch) { 82 | _indicatorSwitch = [[UISwitch alloc] init]; 83 | _indicatorSwitch.frame = CGRectMake(SJScreenWidth - SJLeftGap - _indicatorSwitch.bounds.size.width, (_viewModel.cellHeight - _indicatorSwitch.bounds.size.height)/2, _indicatorSwitch.bounds.size.width, _indicatorSwitch.bounds.size.height); 84 | [_indicatorSwitch addTarget:self action:@selector(switchTouched:) forControlEvents:UIControlEventValueChanged]; 85 | 86 | } 87 | return _indicatorSwitch; 88 | } 89 | 90 | - (UIImageView *)indicatorArrow 91 | { 92 | if (!_indicatorArrow) { 93 | _indicatorArrow = [[UIImageView alloc] initWithImage:[UIImage imageNamed:SJIndicatorArrow]]; 94 | _indicatorArrow.frame = CGRectMake(SJScreenWidth - SJLeftGap - _indicatorArrow.bounds.size.width, (_viewModel.cellHeight - _indicatorArrow.bounds.size.height)/2, _indicatorArrow.bounds.size.width, _indicatorArrow.bounds.size.height); 95 | } 96 | return _indicatorArrow; 97 | } 98 | 99 | - (UILabel *)indicatorLeftLabel 100 | { 101 | if (!_indicatorLeftLabel) { 102 | _indicatorLeftLabel= [[UILabel alloc] init]; 103 | } 104 | return _indicatorLeftLabel; 105 | } 106 | 107 | - (UIImageView *)indicatorLeftImageView 108 | { 109 | if (!_indicatorLeftImageView) { 110 | _indicatorLeftImageView = [[UIImageView alloc] init]; 111 | } 112 | return _indicatorLeftImageView; 113 | } 114 | 115 | 116 | 117 | #pragma mark logout cell 118 | - (UILabel *)logoutLabel 119 | { 120 | if (!_logoutLabel) { 121 | _logoutLabel = [[UILabel alloc] init]; 122 | _logoutLabel.frame = CGRectMake(0, 0, SJScreenWidth, _viewModel.cellHeight); 123 | _logoutLabel.text = @"退出登录"; 124 | _logoutLabel.textAlignment = NSTextAlignmentCenter; 125 | _logoutLabel.textColor = [UIColor blackColor]; 126 | _logoutLabel.font = SJLogoutButtonFont; 127 | } 128 | return _logoutLabel; 129 | } 130 | 131 | 132 | #pragma mark- custom cell 133 | #pragma mark MeController Avatar Cell 134 | - (UIImageView *)avatarImageView 135 | { 136 | if (!_avatarImageView) { 137 | _avatarImageView = [[UIImageView alloc] initWithImage:self.viewModel.avatarImage]; 138 | _avatarImageView.frame = CGRectMake(SJLeftGap, SJLeftGap, self.viewModel.cellHeight - 2*SJLeftGap, self.viewModel.cellHeight - 2*SJLeftGap); 139 | 140 | } 141 | return _avatarImageView; 142 | } 143 | 144 | - (UILabel *)userNameLabel 145 | { 146 | if (!_userNameLabel) { 147 | _userNameLabel = [[UILabel alloc] init]; 148 | _userNameLabel.text = self.viewModel.userName; 149 | _userNameLabel.font = SJLeftTitleTextFont; 150 | _userNameLabel.textColor = [UIColor blackColor]; 151 | _userNameLabel.frame = CGRectMake(CGRectGetMaxX(_avatarImageView.frame) + SJLeftGap, self.avatarImageView.frame.origin.y + SJLeftGap/2, 150, 20); 152 | 153 | } 154 | return _userNameLabel; 155 | } 156 | 157 | 158 | - (UILabel *)userIdLabel 159 | { 160 | if (!_userIdLabel) { 161 | _userIdLabel = [[UILabel alloc] init]; 162 | _userIdLabel.text = self.viewModel.userID; 163 | _userIdLabel.font = [UIFont systemFontOfSize:12]; 164 | _userIdLabel.textColor = [UIColor blackColor]; 165 | _userIdLabel.frame = CGRectMake(CGRectGetMaxX(_avatarImageView.frame) + SJLeftGap, CGRectGetMaxY(self.userNameLabel.frame) + 4, 150, 20); 166 | } 167 | return _userIdLabel; 168 | } 169 | 170 | - (UIImageView *)avatarIndicatorImageView 171 | { 172 | if (!_avatarIndicatorImageView) { 173 | _avatarIndicatorImageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"arrow"]]; 174 | _avatarIndicatorImageView.frame = CGRectMake(SJScreenWidth - SJLeftGap - _avatarIndicatorImageView.bounds.size.width, (_viewModel.cellHeight - _avatarIndicatorImageView.bounds.size.height)/2, _avatarIndicatorImageView.bounds.size.width, _avatarIndicatorImageView.bounds.size.height); 175 | } 176 | 177 | return _avatarIndicatorImageView; 178 | } 179 | 180 | - (UIImageView *)codeImageView 181 | { 182 | if (!_codeImageView) { 183 | _codeImageView = [[UIImageView alloc] initWithImage:self.viewModel.codeImage]; 184 | _codeImageView.frame = CGRectMake(SJScreenWidth - SJLeftGap - _avatarIndicatorImageView.bounds.size.width - SJLeftGap - 20, (self.viewModel.cellHeight - 20)/2, 20, 20); 185 | } 186 | return _codeImageView; 187 | } 188 | 189 | 190 | 191 | @end 192 | -------------------------------------------------------------------------------- /SJStaticTableViewComponent/SJStaticTableViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // SJStaticTableViewController.h 3 | // SSJStaticTableViewDemo 4 | // 5 | // Created by Sun Shijie on 2017/3/15. 6 | // Copyright © 2017年 Shijie. All rights reserved. 7 | // 8 | 9 | 10 | #import "SJStaticTableViewHeader.h" 11 | #import "Factory.h"//假数据 12 | 13 | 14 | @protocol SJStaticTableViewControllerDelegate 15 | 16 | @required 17 | - (void)createDataSource; 18 | @end 19 | 20 | typedef enum : NSUInteger { 21 | 22 | SJDefaultDataTypeExist, //可以生成默认数据源(1. 完全不依赖网络请求,有现成的数据 2. 先生成默认数据源,然后通过网络请求来刷新表格) 23 | SJDefaultDataTypeNone, //无法生成默认数据源,完全依赖网络请求,拿到数据后,生成表格 24 | 25 | }SJDefaultDataType; 26 | 27 | 28 | @interface SJStaticTableViewController : UIViewController 29 | 30 | @property (nonatomic, readwrite, strong) SJStaticTableView *tableView; 31 | @property (nonatomic, readwrite, strong) SJStaticTableViewDataSource *dataSource; 32 | @property (nonatomic, readonly, assign) SJDefaultDataType defualtDataType; 33 | 34 | - (instancetype)initWithDefaultDataType:(SJDefaultDataType)defualtDataType; 35 | - (void)configureTableView; 36 | 37 | @end 38 | -------------------------------------------------------------------------------- /SJStaticTableViewComponent/SJStaticTableViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // SJStaticTableViewController.m 3 | // SSJStaticTableViewDemo 4 | // 5 | // Created by Sun Shijie on 2017/3/15. 6 | // Copyright © 2017年 Shijie. All rights reserved. 7 | // 8 | 9 | #import "SJStaticTableViewController.h" 10 | #import "SJStaticTableViewDataSource.h" 11 | 12 | @interface SJStaticTableViewController() 13 | 14 | @property (nonatomic, readwrite, assign) SJDefaultDataType defualtDataType; 15 | 16 | @end 17 | 18 | 19 | @implementation SJStaticTableViewController 20 | 21 | #pragma mark- init 22 | 23 | - (instancetype)initWithDefaultDataType:(SJDefaultDataType)defualtDataType 24 | { 25 | self = [super init]; 26 | if (self) { 27 | self.defualtDataType = defualtDataType; 28 | } 29 | return self; 30 | } 31 | 32 | - (instancetype)init 33 | { 34 | self = [self initWithDefaultDataType:SJDefaultDataTypeExist]; 35 | return self; 36 | } 37 | 38 | #pragma mark- life circle 39 | - (void)viewDidLoad { 40 | 41 | [super viewDidLoad]; 42 | [self configureNav]; 43 | 44 | //在能够提供给tableivew全部,或者部分数据源的情况下,可以先构造出tableview; 45 | //否则,需要在网络请求结束后,手动调用configureTableView方法 46 | if (self.defualtDataType == SJDefaultDataTypeExist) { 47 | [self configureTableView]; 48 | } 49 | 50 | } 51 | 52 | #pragma mark- configure subviews 53 | - (void)configureNav 54 | { 55 | self.automaticallyAdjustsScrollViewInsets = NO; 56 | //修改导航条背景色 57 | self.navigationController.navigationBar.barTintColor = SJColorWithRGB(18, 18, 18, 1.0); 58 | 59 | //修改导航条标题颜色 60 | [self.navigationController.navigationBar setTitleTextAttributes:[NSDictionary dictionaryWithObjectsAndKeys:[UIColor whiteColor],NSForegroundColorAttributeName,nil]]; 61 | 62 | //修改导航条添加的按钮 63 | self.navigationController.navigationBar.tintColor = [UIColor whiteColor]; 64 | } 65 | 66 | - (void)configureTableView 67 | { 68 | [self createDataSource]; 69 | [self createTableView]; 70 | } 71 | 72 | 73 | - (void)createDataSource 74 | { 75 | //交给子类实现 76 | 77 | } 78 | 79 | - (void)createTableView { 80 | 81 | if (!self.tableView) { 82 | self.tableView = [[SJStaticTableView alloc] initWithFrame:CGRectMake(0, 0, SJScreenWidth, SJScreenHeight) style:UITableViewStyleGrouped]; 83 | self.tableView.contentInset = UIEdgeInsetsMake(44,0,0,0); 84 | self.tableView.sjDelegate = self; 85 | self.tableView.sjDataSource = self.dataSource; 86 | [self.view addSubview:self.tableView]; 87 | } 88 | } 89 | 90 | 91 | 92 | @end 93 | -------------------------------------------------------------------------------- /SJStaticTableViewComponent/SJStaticTableViewDataSource.h: -------------------------------------------------------------------------------- 1 | // 2 | // SJStaticTableViewDataSource.h 3 | // SSJStaticTableViewDemo 4 | // 5 | // Created by Sun Shijie on 2017/3/15. 6 | // Copyright © 2017年 Shijie. All rights reserved. 7 | // 8 | 9 | #import 10 | #import 11 | 12 | 13 | @class SJStaticTableViewCell; 14 | @class SJStaticTableviewCellViewModel; 15 | @class SJStaticTableviewSectionViewModel; 16 | 17 | @protocol SJStaticTableViewDataSource 18 | 19 | @optional 20 | 21 | - (SJStaticTableviewSectionViewModel *)tableView:(UITableView *)tableView sectionViewModelInSection:(NSInteger )section; 22 | - (SJStaticTableviewCellViewModel *)tableView:(UITableView *)tableview cellViewModelAtIndexPath:(NSIndexPath *)indexPath; 23 | 24 | @end 25 | 26 | 27 | typedef void(^SJStaticCellConfigureBlock)(SJStaticTableViewCell *cell, SJStaticTableviewCellViewModel * viewModel); 28 | 29 | 30 | @interface SJStaticTableViewDataSource : NSObject 31 | 32 | @property (nonatomic, strong) NSArray *viewModelsArray; 33 | 34 | - (instancetype)initWithViewModelsArray:(NSArray *)viewModelsArray configureBlock:(SJStaticCellConfigureBlock)block; 35 | 36 | @end 37 | -------------------------------------------------------------------------------- /SJStaticTableViewComponent/SJStaticTableViewDataSource.m: -------------------------------------------------------------------------------- 1 | // 2 | // SJStaticTableViewDataSource.m 3 | // SSJStaticTableViewDemo 4 | // 5 | // Created by Sun Shijie on 2017/3/15. 6 | // Copyright © 2017年 Shijie. All rights reserved. 7 | // 8 | 9 | #import "SJStaticTableViewDataSource.h" 10 | #import "SJStaticTableviewCellViewModel.h" 11 | #import "SJStaticTableviewSectionViewModel.h" 12 | #import "SJStaticTableViewCell.h" 13 | 14 | @interface SJStaticTableViewDataSource() 15 | 16 | @property (nonatomic, copy) SJStaticCellConfigureBlock cellConfigureBlock; 17 | 18 | @end 19 | 20 | 21 | @implementation SJStaticTableViewDataSource 22 | 23 | #pragma mark- Public API 24 | 25 | - (instancetype)initWithViewModelsArray:(NSArray *)viewModelsArray configureBlock:(SJStaticCellConfigureBlock)block 26 | { 27 | self = [super init]; 28 | if (self) { 29 | self.viewModelsArray = viewModelsArray; 30 | self.cellConfigureBlock = [block copy]; 31 | } 32 | return self; 33 | } 34 | 35 | #pragma mark- SJStaticTableViewDataSource 36 | - (SJStaticTableviewCellViewModel *)tableView:(UITableView *)tableview cellViewModelAtIndexPath:(NSIndexPath *)indexPath 37 | { 38 | if (self.viewModelsArray.count > indexPath.section) { 39 | SJStaticTableviewSectionViewModel *sectionViewModel = [self.viewModelsArray objectAtIndex:indexPath.section]; 40 | if (sectionViewModel.cellViewModelsArray.count > indexPath.row) { 41 | return [sectionViewModel.cellViewModelsArray objectAtIndex:indexPath.row]; 42 | } 43 | } 44 | return nil; 45 | } 46 | 47 | - (SJStaticTableviewSectionViewModel *)tableView:(UITableView *)tableView sectionViewModelInSection:(NSInteger )section 48 | { 49 | if (self.viewModelsArray.count > section) { 50 | return [self.viewModelsArray objectAtIndex:section]; 51 | } 52 | return nil; 53 | } 54 | 55 | #pragma mark - Tableview Datasource 56 | 57 | - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView 58 | { 59 | return self.viewModelsArray.count; 60 | } 61 | 62 | - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section 63 | { 64 | SJStaticTableviewSectionViewModel *vm = self.viewModelsArray[section]; 65 | return vm.cellViewModelsArray.count; 66 | } 67 | 68 | - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath 69 | { 70 | 71 | SJStaticTableviewSectionViewModel *sectionViewModel = self.viewModelsArray[indexPath.section]; 72 | SJStaticTableviewCellViewModel *cellViewModel = sectionViewModel.cellViewModelsArray[indexPath.row]; 73 | 74 | SJStaticTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:cellViewModel.cellID]; 75 | if (!cell) { 76 | cell = [[SJStaticTableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellViewModel.cellID]; 77 | } 78 | self.cellConfigureBlock(cell,cellViewModel); 79 | 80 | return cell; 81 | 82 | } 83 | 84 | - (NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section{ 85 | SJStaticTableviewSectionViewModel *vm = self.viewModelsArray[section]; 86 | return vm.sectionHeaderTitle; 87 | 88 | } 89 | 90 | - (NSString *)tableView:(UITableView *)tableView titleForFooterInSection:(NSInteger)section 91 | { 92 | SJStaticTableviewSectionViewModel *vm = self.viewModelsArray[section]; 93 | return vm.sectionFooterTitle; 94 | } 95 | 96 | @end 97 | -------------------------------------------------------------------------------- /SJStaticTableViewComponent/SJStaticTableViewHeader.h: -------------------------------------------------------------------------------- 1 | // 2 | // SJStaticTableViewHeader.h 3 | // SSJStaticTableViewDemo 4 | // 5 | // Created by Sun Shijie on 2017/3/19. 6 | // Copyright © 2017年 Shijie. All rights reserved. 7 | // 8 | 9 | #import 10 | #import 11 | 12 | #import "SJConst.h" //基本配置 13 | 14 | #import "SJStaticTableViewController.h" //封装好的根类控制器,持有SJStaticTableView 15 | #import "SJStaticTableView.h" //封装好的表格视图 16 | #import "SJStaticTableViewDataSource.h" //封装好的数据源 17 | 18 | #import "SJStaticTableviewCellViewModel.h" //cell对应的viewModel 19 | #import "SJStaticTableviewSectionViewModel.h" //section对应的viewModel 20 | 21 | #import "SJStaticTableViewCell.h" //所有cell的根类 22 | #import "SJStaticTableViewCell+Logout.h" //退出登录cell 23 | #import "SJStaticTableViewCell+AccessoryNone.h" //右侧没有控件的cell 24 | #import "SJStaticTableViewCell+AccessorySwitch.h" //右侧有开关的cell 25 | #import "SJStaticTableViewCell+AccessoryDisclosureIndicator.h" //右侧有剪头的cell 26 | 27 | 28 | -------------------------------------------------------------------------------- /SJStaticTableViewComponent/SJStaticTableviewCellViewModel.h: -------------------------------------------------------------------------------- 1 | // 2 | // SJStaticTableviewCellViewModel.h 3 | // SSJStaticTableViewDemo 4 | // 5 | // Created by Sun Shijie on 2017/3/14. 6 | // Copyright © 2017年 Shijie. All rights reserved. 7 | // 8 | 9 | #import 10 | #import 11 | #import "SJConst.h" 12 | 13 | typedef NS_ENUM(NSInteger, SJStaticCellType) { 14 | 15 | //系统风格的各种cell类型,已封装好,可以直接用 16 | SJStaticCellTypeSystemLogout, //退出登录cell(已封装好) 17 | SJStaticCellTypeSystemAccessoryNone, //右侧没有任何控件 18 | SJStaticCellTypeSystemAccessorySwitch, //右侧是开关 19 | SJStaticCellTypeSystemAccessoryDisclosureIndicator, //右侧是三角箭头(箭头左侧可以有一个image或者一个label,或者二者都有,根据传入的参数决定) 20 | 21 | //需要用户自己添加的自定义cell类型 22 | SJStaticCellTypeMeAvatar, //个人页“我”cell 23 | 24 | }; 25 | 26 | 27 | typedef void(^SwitchValueChagedBlock)(BOOL isOn); //switch开关切换时调用的block 28 | 29 | 30 | @interface SJStaticTableviewCellViewModel : NSObject 31 | 32 | @property (nonatomic, assign) SJStaticCellType staticCellType; //类型 33 | 34 | 35 | @property (nonatomic, copy) NSString *cellID; //cell reuser identifier 36 | @property (nonatomic, assign) NSInteger identifier; //区别每个cell,用于点击 37 | 38 | // =============== 系统默认cell左侧 =============== // 39 | @property (nonatomic, strong) UIImage *leftImage; //左侧的image,按需传入 40 | @property (nonatomic, assign) CGSize leftImageSize; //左侧image的大小,存在默认设置 41 | 42 | @property (nonatomic, copy) NSString *leftTitle; //cell主标题,按需传入 43 | @property (nonatomic, strong) UIColor *leftLabelTextColor; //当前组cell左侧label里文字的颜色 44 | @property (nonatomic, strong) UIFont *leftLabelTextFont; //当前组cell左侧label里文字的字体 45 | 46 | @property (nonatomic, assign) CGFloat leftImageAndLabelGap; //左侧image和label的距离,存在默认值 47 | 48 | 49 | // =============== 系统默认cell右侧 =============== // 50 | @property (nonatomic, copy) NSString *indicatorLeftTitle; //右侧箭头左侧的文本,按需传入 51 | @property (nonatomic, strong) UIColor *indicatorLeftLabelTextColor; //右侧文字的颜色,存在默认设置,也可以自定义 52 | @property (nonatomic, strong) UIFont *indicatorLeftLabelTextFont; //右侧文字的字体,存在默认设置,也可以自定义 53 | @property (nonatomic, strong) UIImage *indicatorLeftImage; //右侧箭头左侧的image,按需传入 54 | @property (nonatomic, assign) CGSize indicatorLeftImageSize; //右侧尖头左侧image大小,存在默认设置,也可以自定义 55 | 56 | @property (nonatomic, assign, readonly) BOOL hasIndicatorImageAndLabel; //右侧尖头左侧的文本和image是否同时存在,只能通过内部计算 57 | 58 | @property (nonatomic, assign) CGFloat indicatorLeftImageAndLabelGap; //右侧尖头左侧image和label的距离,存在默认值 59 | @property (nonatomic, assign) BOOL isImageFirst; //右侧尖头左侧的文本和image同时存在时,是否是image挨着箭头,默认为YES 60 | @property (nonatomic, copy) SwitchValueChagedBlock switchValueDidChangeBlock; //切换switch开关的时候调用的block 61 | 62 | 63 | // =============== 长宽数据 =============== // 64 | @property (nonatomic, assign) CGFloat cellHeight; //cell高度,默认是44,可以设置 65 | @property (nonatomic, assign) CGSize leftTitleLabelSize; //左侧默认Label的size,传入text以后内部计算 66 | @property (nonatomic, assign) CGSize indicatorLeftLabelSize; //右侧label的size 67 | 68 | 69 | // =============== 自定义cell的数据放在这里 =============== // 70 | @property (nonatomic, strong) UIImage *avatarImage; 71 | @property (nonatomic, strong) UIImage *codeImage; 72 | @property (nonatomic, copy) NSString *userName; 73 | @property (nonatomic, copy) NSString *userID; 74 | 75 | 76 | 77 | @end 78 | -------------------------------------------------------------------------------- /SJStaticTableViewComponent/SJStaticTableviewCellViewModel.m: -------------------------------------------------------------------------------- 1 | // 2 | // SJStaticTableviewCellViewModel.m 3 | // SSJStaticTableViewDemo 4 | // 5 | // Created by Sun Shijie on 2017/3/14. 6 | // Copyright © 2017年 Shijie. All rights reserved. 7 | // 8 | 9 | #import "SJStaticTableviewCellViewModel.h" 10 | 11 | 12 | @interface SJStaticTableviewCellViewModel() 13 | 14 | @property (nonatomic, assign, readwrite) BOOL hasIndicatorImageAndLabel; //右侧尖头左侧的文本和image是否同时存在 15 | @property (nonatomic, assign, readwrite) CGFloat indicatorLeftImgWidth; //右侧图片宽度 16 | @property (nonatomic, assign, readwrite) CGFloat indicatorLeftImgHeight; //右侧图片高度 17 | 18 | @end 19 | 20 | 21 | @implementation SJStaticTableviewCellViewModel 22 | 23 | - (instancetype)init 24 | { 25 | self = [super init]; 26 | if (self) { 27 | _cellHeight = 44; 28 | _cellID = @"defaultCell"; 29 | _staticCellType = SJStaticCellTypeSystemAccessoryDisclosureIndicator;//默认是存在三角箭头的cell 30 | _isImageFirst = YES; 31 | 32 | //都是默认配置 33 | _leftLabelTextFont = SJLeftTitleTextFont; 34 | _leftLabelTextColor = SJLeftTitleTextColor; 35 | _leftImageSize = CGSizeMake(SJImgWidth, SJImgWidth); 36 | _leftImageAndLabelGap = SJLeftMiddleGap; 37 | _indicatorLeftLabelTextFont = SJIndicatorLeftTitleTextFont; 38 | _indicatorLeftLabelTextColor = SJIndicatorLeftTitleTextColor; 39 | _indicatorLeftImageSize = CGSizeMake(SJImgWidth, SJImgWidth); 40 | _indicatorLeftImageAndLabelGap = SJRightMiddleGap; 41 | } 42 | return self; 43 | } 44 | 45 | 46 | - (void)setLeftTitle:(NSString *)leftTitle 47 | { 48 | if (_leftTitle != leftTitle) { 49 | 50 | _leftTitle = leftTitle; 51 | _leftTitleLabelSize = [self sizeForTitle:leftTitle withFont:_leftLabelTextFont]; 52 | 53 | //very long title 54 | if (_leftTitleLabelSize.width > SJTitleWidthLimit) { 55 | CGSize size = _leftTitleLabelSize; 56 | size.width = SJTitleWidthLimit; 57 | _leftTitleLabelSize = size; 58 | } 59 | 60 | } 61 | } 62 | 63 | - (void)setLeftLabelTextFont:(UIFont *)leftLabelTextFont 64 | { 65 | if (_leftLabelTextFont != leftLabelTextFont) { 66 | 67 | if (![self font1:_leftLabelTextFont hasSameFontSizeOfFont2:leftLabelTextFont]) { 68 | //如果新的宽度大于原来的宽度,需要重新设置,否则不需要 69 | _leftLabelTextFont = leftLabelTextFont; 70 | CGSize size = [self sizeForTitle:self.leftTitle withFont:leftLabelTextFont]; 71 | if (size.width > self.leftTitleLabelSize.width) { 72 | self.leftTitleLabelSize = size; 73 | } 74 | } 75 | } 76 | } 77 | 78 | - (void)setIndicatorLeftTitle:(NSString *)indicatorLeftTitle 79 | { 80 | if (_indicatorLeftTitle != indicatorLeftTitle) { 81 | 82 | _indicatorLeftTitle = indicatorLeftTitle; 83 | _indicatorLeftLabelSize = [self sizeForTitle:_indicatorLeftTitle withFont:_indicatorLeftLabelTextFont]; 84 | 85 | //very long title 86 | if (_indicatorLeftLabelSize.width > SJTitleWidthLimit) { 87 | CGSize size = _indicatorLeftLabelSize; 88 | size.width = SJTitleWidthLimit; 89 | _indicatorLeftLabelSize = size; 90 | } 91 | 92 | if (_indicatorLeftImage) { 93 | _hasIndicatorImageAndLabel = YES; 94 | } 95 | } 96 | } 97 | 98 | 99 | - (void)setIndicatorLeftImage:(UIImage *)indicatorLeftImage 100 | { 101 | if (_indicatorLeftImage != indicatorLeftImage) { 102 | 103 | _indicatorLeftImage = indicatorLeftImage; 104 | 105 | CGFloat limitHeight = self.cellHeight - 2*SJTopGap; 106 | CGFloat indicatorLeftImageWidth = 0.0f; 107 | CGFloat indicatorLeftImageHeight = 0.0f; 108 | 109 | if (_indicatorLeftImage.size.height < limitHeight) { 110 | indicatorLeftImageHeight = _indicatorLeftImage.size.height; 111 | indicatorLeftImageWidth = _indicatorLeftImage.size.width; 112 | 113 | }else{ 114 | // image with very large height 115 | indicatorLeftImageHeight = limitHeight; 116 | indicatorLeftImageWidth = (_indicatorLeftImage.size.width / _indicatorLeftImage.size.height) * indicatorLeftImageHeight ; 117 | } 118 | 119 | _indicatorLeftImageSize = CGSizeMake(indicatorLeftImageWidth, indicatorLeftImageHeight); 120 | 121 | if (_indicatorLeftTitle) { 122 | _hasIndicatorImageAndLabel = YES; 123 | } 124 | 125 | } 126 | } 127 | 128 | 129 | - (void)setIndicatorLeftLabelTextFont:(UIFont *)indicatorLeftLabelTextFont 130 | { 131 | if (_indicatorLeftLabelTextFont != indicatorLeftLabelTextFont) { 132 | 133 | if (![self font1:_indicatorLeftLabelTextFont hasSameFontSizeOfFont2:indicatorLeftLabelTextFont]) { 134 | 135 | //如果新的宽度大于原来的宽度,需要重新设置,否则不需要 136 | _indicatorLeftLabelTextFont = indicatorLeftLabelTextFont; 137 | CGSize size = [self sizeForTitle:self.indicatorLeftTitle withFont:indicatorLeftLabelTextFont]; 138 | if (size.width > self.indicatorLeftLabelSize.width) { 139 | self.indicatorLeftLabelSize = size; 140 | } 141 | } 142 | 143 | } 144 | } 145 | 146 | 147 | 148 | - (CGSize)sizeForTitle:(NSString *)title withFont:(UIFont *)font 149 | { 150 | CGRect titleRect = [title boundingRectWithSize:CGSizeMake(FLT_MAX, FLT_MAX) 151 | options:NSStringDrawingUsesLineFragmentOrigin 152 | attributes:@{NSFontAttributeName : font} 153 | context:nil]; 154 | 155 | return CGSizeMake(titleRect.size.width, 156 | titleRect.size.height); 157 | } 158 | 159 | //判断字体大小是否一致 160 | - (BOOL)font1:(UIFont *)font1 hasSameFontSizeOfFont2:(UIFont *)font2 161 | { 162 | BOOL res = NO; 163 | UIFontDescriptor *font1Des = font1.fontDescriptor; 164 | NSNumber *font1Number = [font1Des objectForKey:@"NSFontSizeAttribute"]; 165 | 166 | UIFontDescriptor *font2Des = font2.fontDescriptor; 167 | NSNumber *font2Number = [font2Des objectForKey:@"NSFontSizeAttribute"]; 168 | 169 | if ([font1Number integerValue] == [font2Number integerValue]) { 170 | res = YES; 171 | } 172 | 173 | return res; 174 | } 175 | 176 | @end 177 | 178 | -------------------------------------------------------------------------------- /SJStaticTableViewComponent/SJStaticTableviewSectionViewModel.h: -------------------------------------------------------------------------------- 1 | // 2 | // SJStaticTableviewSectionViewModel.h 3 | // SSJStaticTableViewDemo 4 | // 5 | // Created by Sun Shijie on 2017/3/14. 6 | // Copyright © 2017年 Shijie. All rights reserved. 7 | // 8 | 9 | #import 10 | #import 11 | 12 | @interface SJStaticTableviewSectionViewModel : NSObject 13 | 14 | @property (nonatomic, copy) NSString *sectionHeaderTitle; //该section的标题 15 | @property (nonatomic, copy) NSString *sectionFooterTitle; //该section的标题 16 | @property (nonatomic, strong) NSMutableArray *cellViewModelsArray; //该section的数据源 17 | 18 | @property (nonatomic, assign) CGFloat sectionHeaderHeight; //header的高度 19 | @property (nonatomic, assign) CGFloat sectionFooterHeight; //footer的高度 20 | 21 | @property (nonatomic, assign) CGSize leftImageSize; //当前组cell左侧image的大小 22 | @property (nonatomic, strong) UIColor *leftLabelTextColor; //当前组cell左侧label里文字的颜色 23 | @property (nonatomic, strong) UIFont *leftLabelTextFont; //当前组cell左侧label里文字的字体 24 | @property (nonatomic, assign) CGFloat leftImageAndLabelGap; //当前组左侧image和label的距离,存在默认值 25 | 26 | @property (nonatomic, strong) UIColor *indicatorLeftLabelTextColor; //当前组cell右侧label里文字的颜色 27 | @property (nonatomic, strong) UIFont *indicatorLeftLabelTextFont; //当前组cell右侧label里文字的字体 28 | @property (nonatomic, assign) CGSize indicatorLeftImageSize; //当前组cell右侧image的大小 29 | @property (nonatomic, assign) CGFloat indicatorLeftImageAndLabelGap;//当前组cell右侧image和label的距离,存在默认值 30 | 31 | 32 | - (instancetype)initWithCellViewModelsArray:(NSArray *)cellViewModelsArray; 33 | 34 | @end 35 | -------------------------------------------------------------------------------- /SJStaticTableViewComponent/SJStaticTableviewSectionViewModel.m: -------------------------------------------------------------------------------- 1 | // 2 | // SJStaticTableviewSectionViewModel.m 3 | // SSJStaticTableViewDemo 4 | // 5 | // Created by Sun Shijie on 2017/3/14. 6 | // Copyright © 2017年 Shijie. All rights reserved. 7 | // 8 | 9 | #import "SJStaticTableviewSectionViewModel.h" 10 | #import "SJConst.h" 11 | #import "SJStaticTableviewCellViewModel.h" 12 | 13 | @implementation SJStaticTableviewSectionViewModel 14 | 15 | - (instancetype)initWithCellViewModelsArray:(NSArray *)cellViewModelsArray 16 | { 17 | self = [super init]; 18 | if (self) { 19 | _sectionHeaderHeight = 10; 20 | _sectionFooterHeight = 10; 21 | _leftLabelTextFont = SJLeftTitleTextFont; 22 | _leftLabelTextColor = SJLeftTitleTextColor; 23 | _leftImageSize = CGSizeMake(SJImgWidth, SJImgWidth); 24 | _leftImageAndLabelGap = SJLeftMiddleGap; 25 | _indicatorLeftLabelTextFont = SJIndicatorLeftTitleTextFont; 26 | _indicatorLeftLabelTextColor = SJIndicatorLeftTitleTextColor; 27 | _indicatorLeftImageSize = CGSizeMake(SJImgWidth, SJImgWidth); 28 | _indicatorLeftImageAndLabelGap = SJRightMiddleGap; 29 | _cellViewModelsArray = [cellViewModelsArray mutableCopy]; 30 | } 31 | return self; 32 | } 33 | 34 | - (void)setLeftLabelTextFont:(UIFont *)leftLabelTextFont 35 | { 36 | if (_leftLabelTextFont != leftLabelTextFont) { 37 | 38 | if (![self font1:_leftLabelTextFont hasSameFontSizeOfFont2:leftLabelTextFont]) { 39 | 40 | _leftLabelTextFont = leftLabelTextFont; 41 | 42 | //如果新的宽度大于原来的宽度,需要重新设置,否则不需要 43 | [_cellViewModelsArray enumerateObjectsUsingBlock:^(SJStaticTableviewCellViewModel * viewModel, NSUInteger idx, BOOL * _Nonnull stop) { 44 | viewModel.leftLabelTextFont = _leftLabelTextFont; 45 | CGSize size = [self sizeForTitle:viewModel.leftTitle withFont:_leftLabelTextFont]; 46 | if (size.width > viewModel.leftTitleLabelSize.width) { 47 | viewModel.leftTitleLabelSize = size; 48 | } 49 | }]; 50 | 51 | } 52 | } 53 | } 54 | 55 | - (void)setLeftLabelTextColor:(UIColor *)leftLabelTextColor 56 | { 57 | if (![self color1:_leftLabelTextColor hasTheSameRGBAOfColor2:leftLabelTextColor]) { 58 | _leftLabelTextColor = leftLabelTextColor; 59 | [_cellViewModelsArray makeObjectsPerformSelector:@selector(setLeftLabelTextColor:) withObject:_leftLabelTextColor]; 60 | } 61 | } 62 | 63 | - (void)setLeftImageSize:(CGSize)leftImageSize 64 | { 65 | SJStaticTableviewCellViewModel *viewMoel = _cellViewModelsArray.firstObject; 66 | 67 | CGFloat cellHeight = viewMoel.cellHeight; 68 | if ( (!CGSizeEqualToSize(_leftImageSize, leftImageSize)) && (leftImageSize.height < cellHeight)) { 69 | _leftImageSize = leftImageSize; 70 | [_cellViewModelsArray enumerateObjectsUsingBlock:^(SJStaticTableviewCellViewModel *viewModel, NSUInteger idx, BOOL * _Nonnull stop) 71 | { 72 | viewMoel.leftImageSize = _leftImageSize; 73 | }]; 74 | } 75 | } 76 | 77 | - (void)setLeftImageAndLabelGap:(CGFloat)leftImageAndLabelGap 78 | { 79 | if (_leftImageAndLabelGap != leftImageAndLabelGap) { 80 | _leftImageAndLabelGap = leftImageAndLabelGap; 81 | [_cellViewModelsArray enumerateObjectsUsingBlock:^(SJStaticTableviewCellViewModel * viewModel, NSUInteger idx, BOOL * _Nonnull stop) { 82 | viewModel.leftImageAndLabelGap = _leftImageAndLabelGap; 83 | }]; 84 | } 85 | } 86 | 87 | - (void)setIndicatorLeftLabelTextFont:(UIFont *)indicatorLeftLabelTextFont 88 | { 89 | if (_indicatorLeftLabelTextFont != indicatorLeftLabelTextFont) { 90 | 91 | if (![self font1:_indicatorLeftLabelTextFont hasSameFontSizeOfFont2:indicatorLeftLabelTextFont]) { 92 | _indicatorLeftLabelTextFont = indicatorLeftLabelTextFont; 93 | 94 | //如果新的宽度大于原来的宽度,需要重新设置,否则不需要 95 | [_cellViewModelsArray enumerateObjectsUsingBlock:^(SJStaticTableviewCellViewModel * viewModel, NSUInteger idx, BOOL * _Nonnull stop) { 96 | viewModel.indicatorLeftLabelTextFont = _indicatorLeftLabelTextFont; 97 | CGSize size = [self sizeForTitle:viewModel.indicatorLeftTitle withFont:_indicatorLeftLabelTextFont]; 98 | if (size.width > viewModel.indicatorLeftLabelSize.width) { 99 | viewModel.indicatorLeftLabelSize = size; 100 | } 101 | }]; 102 | } 103 | 104 | } 105 | } 106 | 107 | - (void)setIndicatorLeftLabelTextColor:(UIColor *)indicatorLeftLabelTextColor 108 | { 109 | if (![self color1:_indicatorLeftLabelTextColor hasTheSameRGBAOfColor2:indicatorLeftLabelTextColor]) { 110 | _indicatorLeftLabelTextColor = indicatorLeftLabelTextColor; 111 | [_cellViewModelsArray makeObjectsPerformSelector:@selector(setIndicatorLeftLabelTextColor:) withObject:_indicatorLeftLabelTextColor]; 112 | } 113 | } 114 | 115 | 116 | - (void)setIndicatorLeftImageSize:(CGSize)indicatorLeftImageSize 117 | { 118 | SJStaticTableviewCellViewModel *viewMoel = _cellViewModelsArray.firstObject; 119 | CGFloat cellHeight = viewMoel.cellHeight; 120 | 121 | if ( (!CGSizeEqualToSize(_indicatorLeftImageSize, indicatorLeftImageSize)) && (indicatorLeftImageSize.height < cellHeight)) { 122 | 123 | _indicatorLeftImageSize = indicatorLeftImageSize; 124 | 125 | [_cellViewModelsArray enumerateObjectsUsingBlock:^(SJStaticTableviewCellViewModel *viewModel, NSUInteger idx, BOOL * _Nonnull stop) 126 | { 127 | viewMoel.indicatorLeftImageSize = _indicatorLeftImageSize; 128 | }]; 129 | } 130 | 131 | } 132 | 133 | - (void)setIndicatorLeftImageAndLabelGap:(CGFloat)indicatorLeftImageAndLabelGap 134 | { 135 | if (_indicatorLeftImageAndLabelGap != indicatorLeftImageAndLabelGap) { 136 | _indicatorLeftImageAndLabelGap = indicatorLeftImageAndLabelGap; 137 | [_cellViewModelsArray enumerateObjectsUsingBlock:^(SJStaticTableviewCellViewModel * viewModel, NSUInteger idx, BOOL * _Nonnull stop) { 138 | viewModel.indicatorLeftImageAndLabelGap = _indicatorLeftImageAndLabelGap; 139 | }]; 140 | } 141 | } 142 | 143 | //判断字体大小是否一致 144 | - (BOOL)font1:(UIFont *)font1 hasSameFontSizeOfFont2:(UIFont *)font2 145 | { 146 | BOOL res = NO; 147 | UIFontDescriptor *font1Des = font1.fontDescriptor; 148 | NSNumber *font1Number = [font1Des objectForKey:@"NSFontSizeAttribute"]; 149 | 150 | UIFontDescriptor *font2Des = font2.fontDescriptor; 151 | NSNumber *font2Number = [font2Des objectForKey:@"NSFontSizeAttribute"]; 152 | 153 | if ([font1Number integerValue] == [font2Number integerValue]) { 154 | res = YES; 155 | } 156 | 157 | return res; 158 | } 159 | 160 | //判断颜色是否相等 161 | - (BOOL)color1:(UIColor *)color1 hasTheSameRGBAOfColor2:(UIColor *)color2 162 | { 163 | BOOL res = NO; 164 | 165 | CGFloat red1,red2,green1,green2,blue1,blue2,alpha1,alpha2; 166 | 167 | //取出color1的背景颜色的RGBA值 168 | [color1 getRed:&red1 green:&green1 blue:&blue1 alpha:&alpha1]; 169 | 170 | //取出color2的背景颜色的RGBA值 171 | [color2 getRed:&red2 green:&green2 blue:&blue2 alpha:&alpha2]; 172 | 173 | if ((red1 == red2)&&(green1 == green2)&&(blue1 == blue2)&&(alpha1 == alpha2)) { 174 | res = YES; 175 | } 176 | 177 | return res; 178 | } 179 | 180 | - (CGSize)sizeForTitle:(NSString *)title withFont:(UIFont *)font 181 | { 182 | CGRect titleRect = [title boundingRectWithSize:CGSizeMake(FLT_MAX, FLT_MAX) 183 | options:NSStringDrawingUsesLineFragmentOrigin 184 | attributes:@{NSFontAttributeName : font} 185 | context:nil]; 186 | 187 | return CGSizeMake(titleRect.size.width, 188 | titleRect.size.height); 189 | } 190 | 191 | @end 192 | -------------------------------------------------------------------------------- /SJStaticTableViewDemo/SJStaticTableViewDemo.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /SJStaticTableViewDemo/SJStaticTableViewDemo.xcodeproj/project.xcworkspace/xcuserdata/SunShijie.xcuserdatad/UserInterfaceState.xcuserstate: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/knightsj/SJStaticTableView/6fb11c1f13569763a722c7d839bdfc3935735c9c/SJStaticTableViewDemo/SJStaticTableViewDemo.xcodeproj/project.xcworkspace/xcuserdata/SunShijie.xcuserdatad/UserInterfaceState.xcuserstate -------------------------------------------------------------------------------- /SJStaticTableViewDemo/SJStaticTableViewDemo.xcodeproj/xcuserdata/SunShijie.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 8 | 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /SJStaticTableViewDemo/SJStaticTableViewDemo.xcodeproj/xcuserdata/SunShijie.xcuserdatad/xcschemes/SJStaticTableViewDemo.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 | -------------------------------------------------------------------------------- /SJStaticTableViewDemo/SJStaticTableViewDemo.xcodeproj/xcuserdata/SunShijie.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | SJStaticTableViewDemo.xcscheme 8 | 9 | orderHint 10 | 0 11 | 12 | 13 | SuppressBuildableAutocreation 14 | 15 | CBC2D26E1E7ED0BD002A5357 16 | 17 | primary 18 | 19 | 20 | CBC2D2871E7ED0BD002A5357 21 | 22 | primary 23 | 24 | 25 | CBC2D2921E7ED0BD002A5357 26 | 27 | primary 28 | 29 | 30 | 31 | 32 | 33 | -------------------------------------------------------------------------------- /SJStaticTableViewDemo/SJStaticTableViewDemo/AppDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.h 3 | // SJStaticTableViewDemo 4 | // 5 | // Created by Sun Shijie on 2017/3/19. 6 | // Copyright © 2017年 Shijie. 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 | -------------------------------------------------------------------------------- /SJStaticTableViewDemo/SJStaticTableViewDemo/AppDelegate.m: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.m 3 | // SJStaticTableViewDemo 4 | // 5 | // Created by Sun Shijie on 2017/3/19. 6 | // Copyright © 2017年 Shijie. All rights reserved. 7 | // 8 | 9 | #import "AppDelegate.h" 10 | #import "SJTabBarController.h" 11 | 12 | @interface AppDelegate () 13 | 14 | @end 15 | 16 | @implementation AppDelegate 17 | 18 | 19 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { 20 | self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds]; 21 | self.window.rootViewController = [[SJTabBarController alloc]init]; 22 | self.window.backgroundColor = [UIColor whiteColor]; 23 | [self.window makeKeyWindow]; 24 | return YES; 25 | } 26 | 27 | 28 | - (void)applicationWillResignActive:(UIApplication *)application { 29 | // 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. 30 | // Use this method to pause ongoing tasks, disable timers, and invalidate graphics rendering callbacks. Games should use this method to pause the game. 31 | } 32 | 33 | 34 | - (void)applicationDidEnterBackground:(UIApplication *)application { 35 | // 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. 36 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. 37 | } 38 | 39 | 40 | - (void)applicationWillEnterForeground:(UIApplication *)application { 41 | // Called as part of the transition from the background to the active state; here you can undo many of the changes made on entering the background. 42 | } 43 | 44 | 45 | - (void)applicationDidBecomeActive:(UIApplication *)application { 46 | // 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. 47 | } 48 | 49 | 50 | - (void)applicationWillTerminate:(UIApplication *)application { 51 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. 52 | } 53 | 54 | 55 | @end 56 | -------------------------------------------------------------------------------- /SJStaticTableViewDemo/SJStaticTableViewDemo/Base.lproj/LaunchScreen.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /SJStaticTableViewDemo/SJStaticTableViewDemo/Base.lproj/Main.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /SJStaticTableViewDemo/SJStaticTableViewDemo/BaseController/SJNavigationController.h: -------------------------------------------------------------------------------- 1 | // 2 | // SJNavigationController.h 3 | // SSJStaticTableViewDemo 4 | // 5 | // Created by Sun Shijie on 2017/3/17. 6 | // Copyright © 2017年 Shijie. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface SJNavigationController : UINavigationController 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /SJStaticTableViewDemo/SJStaticTableViewDemo/BaseController/SJNavigationController.m: -------------------------------------------------------------------------------- 1 | // 2 | // SJNavigationController.m 3 | // SSJStaticTableViewDemo 4 | // 5 | // Created by Sun Shijie on 2017/3/17. 6 | // Copyright © 2017年 Shijie. All rights reserved. 7 | // 8 | 9 | #import "SJNavigationController.h" 10 | 11 | @interface SJNavigationController () 12 | 13 | @end 14 | 15 | @implementation SJNavigationController 16 | 17 | - (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldReceiveTouch:(UITouch *)touch 18 | { 19 | return self.childViewControllers.count > 1; 20 | } 21 | 22 | - (void)pushViewController:(UIViewController *)viewController animated:(BOOL)animated 23 | { 24 | if (self.childViewControllers.count > 0) { 25 | 26 | // 非根控制器,隐藏底部的tabbar 27 | viewController.hidesBottomBarWhenPushed = YES; 28 | 29 | } 30 | 31 | [super pushViewController:viewController animated:animated]; 32 | } 33 | 34 | @end 35 | -------------------------------------------------------------------------------- /SJStaticTableViewDemo/SJStaticTableViewDemo/BaseController/SJTabBarController.h: -------------------------------------------------------------------------------- 1 | // 2 | // SJTabBarController.h 3 | // SSJStaticTableViewDemo 4 | // 5 | // Created by Sun Shijie on 2017/3/17. 6 | // Copyright © 2017年 Shijie. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface SJTabBarController : UITabBarController 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /SJStaticTableViewDemo/SJStaticTableViewDemo/BaseController/SJTabBarController.m: -------------------------------------------------------------------------------- 1 | // 2 | // SJTabBarController.m 3 | // SSJStaticTableViewDemo 4 | // 5 | // Created by Sun Shijie on 2017/3/17. 6 | // Copyright © 2017年 Shijie. All rights reserved. 7 | // 8 | 9 | #import "SJTabBarController.h" 10 | #import "SJNavigationController.h" 11 | #import "SJDiscoverViewController.h" 12 | #import "SJMeViewController.h" 13 | #define kThemeColor [UIColor colorWithRed:0 green:(190 / 255.0) blue:(12 / 255.0) alpha:1] 14 | 15 | @interface SJTabBarController () 16 | 17 | @end 18 | 19 | @implementation SJTabBarController 20 | 21 | - (void)viewDidLoad { 22 | [super viewDidLoad]; 23 | // Do any additional setup after loading the view. 24 | self.tabBar.tintColor = kThemeColor; 25 | 26 | NSArray *configureArray = @[ 27 | @{ 28 | @"class":@"SJDiscoverViewController", 29 | @"title":@"发现", 30 | @"image_none_selected":@"tabbar_discover", 31 | @"image_selected":@"tabbar_discoverHL" 32 | }, 33 | 34 | @{ 35 | @"class":@"SJMeViewController", 36 | @"title":@"我", 37 | @"image_none_selected":@"tabbar_me", 38 | @"image_selected":@"tabbar_meHL" 39 | } 40 | ]; 41 | 42 | [configureArray enumerateObjectsUsingBlock:^(NSDictionary* _Nonnull dict, NSUInteger idx, BOOL * _Nonnull stop) { 43 | UIViewController *vc = [NSClassFromString(dict[@"class"]) new]; 44 | SJNavigationController *nav = [[SJNavigationController alloc] initWithRootViewController:vc]; 45 | UITabBarItem *item = nav.tabBarItem; 46 | item.title = dict[@"title"]; 47 | item.image = [UIImage imageNamed:dict[@"image_none_selected"]]; 48 | item.selectedImage = [[UIImage imageNamed:dict[@"image_selected"]] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal]; 49 | [item setTitleTextAttributes:@{NSForegroundColorAttributeName : kThemeColor} forState:UIControlStateSelected]; 50 | [self addChildViewController:nav]; 51 | 52 | }]; 53 | self.selectedIndex = 0; 54 | } 55 | @end 56 | -------------------------------------------------------------------------------- /SJStaticTableViewDemo/SJStaticTableViewDemo/Discover.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "version" : 1, 4 | "author" : "xcode" 5 | } 6 | } -------------------------------------------------------------------------------- /SJStaticTableViewDemo/SJStaticTableViewDemo/Discover.xcassets/CreditCard_ShoppingBag.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x" 6 | }, 7 | { 8 | "idiom" : "universal", 9 | "scale" : "2x", 10 | "filename" : "CreditCard_ShoppingBag@2x.png" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /SJStaticTableViewDemo/SJStaticTableViewDemo/Discover.xcassets/CreditCard_ShoppingBag.imageset/CreditCard_ShoppingBag@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/knightsj/SJStaticTableView/6fb11c1f13569763a722c7d839bdfc3935735c9c/SJStaticTableViewDemo/SJStaticTableViewDemo/Discover.xcassets/CreditCard_ShoppingBag.imageset/CreditCard_ShoppingBag@2x.png -------------------------------------------------------------------------------- /SJStaticTableViewDemo/SJStaticTableViewDemo/Discover.xcassets/MoreGame.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x", 6 | "filename" : "MoreGame.png" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x", 11 | "filename" : "MoreGame@2x.png" 12 | }, 13 | { 14 | "idiom" : "universal", 15 | "scale" : "3x", 16 | "filename" : "MoreGame@3x.png" 17 | } 18 | ], 19 | "info" : { 20 | "version" : 1, 21 | "author" : "xcode" 22 | } 23 | } -------------------------------------------------------------------------------- /SJStaticTableViewDemo/SJStaticTableViewDemo/Discover.xcassets/MoreGame.imageset/MoreGame.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/knightsj/SJStaticTableView/6fb11c1f13569763a722c7d839bdfc3935735c9c/SJStaticTableViewDemo/SJStaticTableViewDemo/Discover.xcassets/MoreGame.imageset/MoreGame.png -------------------------------------------------------------------------------- /SJStaticTableViewDemo/SJStaticTableViewDemo/Discover.xcassets/MoreGame.imageset/MoreGame@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/knightsj/SJStaticTableView/6fb11c1f13569763a722c7d839bdfc3935735c9c/SJStaticTableViewDemo/SJStaticTableViewDemo/Discover.xcassets/MoreGame.imageset/MoreGame@2x.png -------------------------------------------------------------------------------- /SJStaticTableViewDemo/SJStaticTableViewDemo/Discover.xcassets/MoreGame.imageset/MoreGame@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/knightsj/SJStaticTableView/6fb11c1f13569763a722c7d839bdfc3935735c9c/SJStaticTableViewDemo/SJStaticTableViewDemo/Discover.xcassets/MoreGame.imageset/MoreGame@3x.png -------------------------------------------------------------------------------- /SJStaticTableViewDemo/SJStaticTableViewDemo/Discover.xcassets/Shake_icon_people.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x" 6 | }, 7 | { 8 | "idiom" : "universal", 9 | "scale" : "2x", 10 | "filename" : "Shake_icon_people@2x.png" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /SJStaticTableViewDemo/SJStaticTableViewDemo/Discover.xcassets/Shake_icon_people.imageset/Shake_icon_people@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/knightsj/SJStaticTableView/6fb11c1f13569763a722c7d839bdfc3935735c9c/SJStaticTableViewDemo/SJStaticTableViewDemo/Discover.xcassets/Shake_icon_people.imageset/Shake_icon_people@2x.png -------------------------------------------------------------------------------- /SJStaticTableViewDemo/SJStaticTableViewDemo/Discover.xcassets/Shake_icon_peopleHL.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x" 6 | }, 7 | { 8 | "idiom" : "universal", 9 | "scale" : "2x", 10 | "filename" : "Shake_icon_peopleHL@2x.png" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /SJStaticTableViewDemo/SJStaticTableViewDemo/Discover.xcassets/Shake_icon_peopleHL.imageset/Shake_icon_peopleHL@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/knightsj/SJStaticTableView/6fb11c1f13569763a722c7d839bdfc3935735c9c/SJStaticTableViewDemo/SJStaticTableViewDemo/Discover.xcassets/Shake_icon_peopleHL.imageset/Shake_icon_peopleHL@2x.png -------------------------------------------------------------------------------- /SJStaticTableViewDemo/SJStaticTableViewDemo/Discover.xcassets/doudizhu.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x" 6 | }, 7 | { 8 | "idiom" : "universal", 9 | "filename" : "doudizhu@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 | } -------------------------------------------------------------------------------- /SJStaticTableViewDemo/SJStaticTableViewDemo/Discover.xcassets/doudizhu.imageset/doudizhu@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/knightsj/SJStaticTableView/6fb11c1f13569763a722c7d839bdfc3935735c9c/SJStaticTableViewDemo/SJStaticTableViewDemo/Discover.xcassets/doudizhu.imageset/doudizhu@2x.png -------------------------------------------------------------------------------- /SJStaticTableViewDemo/SJStaticTableViewDemo/Discover.xcassets/ff_IconBottle.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x", 6 | "filename" : "ff_IconBottle.png" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x", 11 | "filename" : "ff_IconBottle@2x.png" 12 | }, 13 | { 14 | "idiom" : "universal", 15 | "scale" : "3x", 16 | "filename" : "ff_IconBottle@3x.png" 17 | } 18 | ], 19 | "info" : { 20 | "version" : 1, 21 | "author" : "xcode" 22 | } 23 | } -------------------------------------------------------------------------------- /SJStaticTableViewDemo/SJStaticTableViewDemo/Discover.xcassets/ff_IconBottle.imageset/ff_IconBottle.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/knightsj/SJStaticTableView/6fb11c1f13569763a722c7d839bdfc3935735c9c/SJStaticTableViewDemo/SJStaticTableViewDemo/Discover.xcassets/ff_IconBottle.imageset/ff_IconBottle.png -------------------------------------------------------------------------------- /SJStaticTableViewDemo/SJStaticTableViewDemo/Discover.xcassets/ff_IconBottle.imageset/ff_IconBottle@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/knightsj/SJStaticTableView/6fb11c1f13569763a722c7d839bdfc3935735c9c/SJStaticTableViewDemo/SJStaticTableViewDemo/Discover.xcassets/ff_IconBottle.imageset/ff_IconBottle@2x.png -------------------------------------------------------------------------------- /SJStaticTableViewDemo/SJStaticTableViewDemo/Discover.xcassets/ff_IconBottle.imageset/ff_IconBottle@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/knightsj/SJStaticTableView/6fb11c1f13569763a722c7d839bdfc3935735c9c/SJStaticTableViewDemo/SJStaticTableViewDemo/Discover.xcassets/ff_IconBottle.imageset/ff_IconBottle@3x.png -------------------------------------------------------------------------------- /SJStaticTableViewDemo/SJStaticTableViewDemo/Discover.xcassets/ff_IconLocationService.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x", 6 | "filename" : "ff_IconLocationService.png" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x", 11 | "filename" : "ff_IconLocationService@2x.png" 12 | }, 13 | { 14 | "idiom" : "universal", 15 | "scale" : "3x", 16 | "filename" : "ff_IconLocationService@3x.png" 17 | } 18 | ], 19 | "info" : { 20 | "version" : 1, 21 | "author" : "xcode" 22 | } 23 | } -------------------------------------------------------------------------------- /SJStaticTableViewDemo/SJStaticTableViewDemo/Discover.xcassets/ff_IconLocationService.imageset/ff_IconLocationService.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/knightsj/SJStaticTableView/6fb11c1f13569763a722c7d839bdfc3935735c9c/SJStaticTableViewDemo/SJStaticTableViewDemo/Discover.xcassets/ff_IconLocationService.imageset/ff_IconLocationService.png -------------------------------------------------------------------------------- /SJStaticTableViewDemo/SJStaticTableViewDemo/Discover.xcassets/ff_IconLocationService.imageset/ff_IconLocationService@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/knightsj/SJStaticTableView/6fb11c1f13569763a722c7d839bdfc3935735c9c/SJStaticTableViewDemo/SJStaticTableViewDemo/Discover.xcassets/ff_IconLocationService.imageset/ff_IconLocationService@2x.png -------------------------------------------------------------------------------- /SJStaticTableViewDemo/SJStaticTableViewDemo/Discover.xcassets/ff_IconLocationService.imageset/ff_IconLocationService@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/knightsj/SJStaticTableView/6fb11c1f13569763a722c7d839bdfc3935735c9c/SJStaticTableViewDemo/SJStaticTableViewDemo/Discover.xcassets/ff_IconLocationService.imageset/ff_IconLocationService@3x.png -------------------------------------------------------------------------------- /SJStaticTableViewDemo/SJStaticTableViewDemo/Discover.xcassets/ff_IconQRCode.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x", 6 | "filename" : "ff_IconQRCode.png" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x", 11 | "filename" : "ff_IconQRCode@2x.png" 12 | }, 13 | { 14 | "idiom" : "universal", 15 | "scale" : "3x", 16 | "filename" : "ff_IconQRCode@3x.png" 17 | } 18 | ], 19 | "info" : { 20 | "version" : 1, 21 | "author" : "xcode" 22 | } 23 | } -------------------------------------------------------------------------------- /SJStaticTableViewDemo/SJStaticTableViewDemo/Discover.xcassets/ff_IconQRCode.imageset/ff_IconQRCode.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/knightsj/SJStaticTableView/6fb11c1f13569763a722c7d839bdfc3935735c9c/SJStaticTableViewDemo/SJStaticTableViewDemo/Discover.xcassets/ff_IconQRCode.imageset/ff_IconQRCode.png -------------------------------------------------------------------------------- /SJStaticTableViewDemo/SJStaticTableViewDemo/Discover.xcassets/ff_IconQRCode.imageset/ff_IconQRCode@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/knightsj/SJStaticTableView/6fb11c1f13569763a722c7d839bdfc3935735c9c/SJStaticTableViewDemo/SJStaticTableViewDemo/Discover.xcassets/ff_IconQRCode.imageset/ff_IconQRCode@2x.png -------------------------------------------------------------------------------- /SJStaticTableViewDemo/SJStaticTableViewDemo/Discover.xcassets/ff_IconQRCode.imageset/ff_IconQRCode@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/knightsj/SJStaticTableView/6fb11c1f13569763a722c7d839bdfc3935735c9c/SJStaticTableViewDemo/SJStaticTableViewDemo/Discover.xcassets/ff_IconQRCode.imageset/ff_IconQRCode@3x.png -------------------------------------------------------------------------------- /SJStaticTableViewDemo/SJStaticTableViewDemo/Discover.xcassets/ff_IconShake.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x", 6 | "filename" : "ff_IconShake.png" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x", 11 | "filename" : "ff_IconShake@2x.png" 12 | }, 13 | { 14 | "idiom" : "universal", 15 | "scale" : "3x", 16 | "filename" : "ff_IconShake@3x.png" 17 | } 18 | ], 19 | "info" : { 20 | "version" : 1, 21 | "author" : "xcode" 22 | } 23 | } -------------------------------------------------------------------------------- /SJStaticTableViewDemo/SJStaticTableViewDemo/Discover.xcassets/ff_IconShake.imageset/ff_IconShake.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/knightsj/SJStaticTableView/6fb11c1f13569763a722c7d839bdfc3935735c9c/SJStaticTableViewDemo/SJStaticTableViewDemo/Discover.xcassets/ff_IconShake.imageset/ff_IconShake.png -------------------------------------------------------------------------------- /SJStaticTableViewDemo/SJStaticTableViewDemo/Discover.xcassets/ff_IconShake.imageset/ff_IconShake@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/knightsj/SJStaticTableView/6fb11c1f13569763a722c7d839bdfc3935735c9c/SJStaticTableViewDemo/SJStaticTableViewDemo/Discover.xcassets/ff_IconShake.imageset/ff_IconShake@2x.png -------------------------------------------------------------------------------- /SJStaticTableViewDemo/SJStaticTableViewDemo/Discover.xcassets/ff_IconShake.imageset/ff_IconShake@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/knightsj/SJStaticTableView/6fb11c1f13569763a722c7d839bdfc3935735c9c/SJStaticTableViewDemo/SJStaticTableViewDemo/Discover.xcassets/ff_IconShake.imageset/ff_IconShake@3x.png -------------------------------------------------------------------------------- /SJStaticTableViewDemo/SJStaticTableViewDemo/Discover.xcassets/ff_IconShowAlbum.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x", 6 | "filename" : "ff_IconShowAlbum.png" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x", 11 | "filename" : "ff_IconShowAlbum@2x.png" 12 | }, 13 | { 14 | "idiom" : "universal", 15 | "scale" : "3x", 16 | "filename" : "ff_IconShowAlbum@3x.png" 17 | } 18 | ], 19 | "info" : { 20 | "version" : 1, 21 | "author" : "xcode" 22 | } 23 | } -------------------------------------------------------------------------------- /SJStaticTableViewDemo/SJStaticTableViewDemo/Discover.xcassets/ff_IconShowAlbum.imageset/ff_IconShowAlbum.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/knightsj/SJStaticTableView/6fb11c1f13569763a722c7d839bdfc3935735c9c/SJStaticTableViewDemo/SJStaticTableViewDemo/Discover.xcassets/ff_IconShowAlbum.imageset/ff_IconShowAlbum.png -------------------------------------------------------------------------------- /SJStaticTableViewDemo/SJStaticTableViewDemo/Discover.xcassets/ff_IconShowAlbum.imageset/ff_IconShowAlbum@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/knightsj/SJStaticTableView/6fb11c1f13569763a722c7d839bdfc3935735c9c/SJStaticTableViewDemo/SJStaticTableViewDemo/Discover.xcassets/ff_IconShowAlbum.imageset/ff_IconShowAlbum@2x.png -------------------------------------------------------------------------------- /SJStaticTableViewDemo/SJStaticTableViewDemo/Discover.xcassets/ff_IconShowAlbum.imageset/ff_IconShowAlbum@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/knightsj/SJStaticTableView/6fb11c1f13569763a722c7d839bdfc3935735c9c/SJStaticTableViewDemo/SJStaticTableViewDemo/Discover.xcassets/ff_IconShowAlbum.imageset/ff_IconShowAlbum@3x.png -------------------------------------------------------------------------------- /SJStaticTableViewDemo/SJStaticTableViewDemo/Discover.xcassets/game_1.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x" 6 | }, 7 | { 8 | "idiom" : "universal", 9 | "filename" : "game_1@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 | } -------------------------------------------------------------------------------- /SJStaticTableViewDemo/SJStaticTableViewDemo/Discover.xcassets/game_1.imageset/game_1@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/knightsj/SJStaticTableView/6fb11c1f13569763a722c7d839bdfc3935735c9c/SJStaticTableViewDemo/SJStaticTableViewDemo/Discover.xcassets/game_1.imageset/game_1@2x.png -------------------------------------------------------------------------------- /SJStaticTableViewDemo/SJStaticTableViewDemo/Emoji.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "version" : 1, 4 | "author" : "xcode" 5 | } 6 | } -------------------------------------------------------------------------------- /SJStaticTableViewDemo/SJStaticTableViewDemo/Emoji.xcassets/emoji_1.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x" 6 | }, 7 | { 8 | "idiom" : "universal", 9 | "filename" : "emoji_1@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 | } -------------------------------------------------------------------------------- /SJStaticTableViewDemo/SJStaticTableViewDemo/Emoji.xcassets/emoji_1.imageset/emoji_1@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/knightsj/SJStaticTableView/6fb11c1f13569763a722c7d839bdfc3935735c9c/SJStaticTableViewDemo/SJStaticTableViewDemo/Emoji.xcassets/emoji_1.imageset/emoji_1@2x.png -------------------------------------------------------------------------------- /SJStaticTableViewDemo/SJStaticTableViewDemo/Emoji.xcassets/emoji_2.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x" 6 | }, 7 | { 8 | "idiom" : "universal", 9 | "filename" : "emoji_2@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 | } -------------------------------------------------------------------------------- /SJStaticTableViewDemo/SJStaticTableViewDemo/Emoji.xcassets/emoji_2.imageset/emoji_2@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/knightsj/SJStaticTableView/6fb11c1f13569763a722c7d839bdfc3935735c9c/SJStaticTableViewDemo/SJStaticTableViewDemo/Emoji.xcassets/emoji_2.imageset/emoji_2@2x.png -------------------------------------------------------------------------------- /SJStaticTableViewDemo/SJStaticTableViewDemo/Emoji.xcassets/emoji_3.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x" 6 | }, 7 | { 8 | "idiom" : "universal", 9 | "filename" : "emoji_3@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 | } -------------------------------------------------------------------------------- /SJStaticTableViewDemo/SJStaticTableViewDemo/Emoji.xcassets/emoji_3.imageset/emoji_3@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/knightsj/SJStaticTableView/6fb11c1f13569763a722c7d839bdfc3935735c9c/SJStaticTableViewDemo/SJStaticTableViewDemo/Emoji.xcassets/emoji_3.imageset/emoji_3@2x.png -------------------------------------------------------------------------------- /SJStaticTableViewDemo/SJStaticTableViewDemo/Emoji.xcassets/emoji_4.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x" 6 | }, 7 | { 8 | "idiom" : "universal", 9 | "filename" : "emoji_4@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 | } -------------------------------------------------------------------------------- /SJStaticTableViewDemo/SJStaticTableViewDemo/Emoji.xcassets/emoji_4.imageset/emoji_4@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/knightsj/SJStaticTableView/6fb11c1f13569763a722c7d839bdfc3935735c9c/SJStaticTableViewDemo/SJStaticTableViewDemo/Emoji.xcassets/emoji_4.imageset/emoji_4@2x.png -------------------------------------------------------------------------------- /SJStaticTableViewDemo/SJStaticTableViewDemo/Emoji.xcassets/emoji_5.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x" 6 | }, 7 | { 8 | "idiom" : "universal", 9 | "filename" : "emoji_5@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 | } -------------------------------------------------------------------------------- /SJStaticTableViewDemo/SJStaticTableViewDemo/Emoji.xcassets/emoji_5.imageset/emoji_5@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/knightsj/SJStaticTableView/6fb11c1f13569763a722c7d839bdfc3935735c9c/SJStaticTableViewDemo/SJStaticTableViewDemo/Emoji.xcassets/emoji_5.imageset/emoji_5@2x.png -------------------------------------------------------------------------------- /SJStaticTableViewDemo/SJStaticTableViewDemo/Emoji.xcassets/emoji_6.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x" 6 | }, 7 | { 8 | "idiom" : "universal", 9 | "filename" : "emoji_6@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 | } -------------------------------------------------------------------------------- /SJStaticTableViewDemo/SJStaticTableViewDemo/Emoji.xcassets/emoji_6.imageset/emoji_6@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/knightsj/SJStaticTableView/6fb11c1f13569763a722c7d839bdfc3935735c9c/SJStaticTableViewDemo/SJStaticTableViewDemo/Emoji.xcassets/emoji_6.imageset/emoji_6@2x.png -------------------------------------------------------------------------------- /SJStaticTableViewDemo/SJStaticTableViewDemo/Images.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "size" : "20x20", 6 | "scale" : "2x" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "size" : "20x20", 11 | "scale" : "3x" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "size" : "29x29", 16 | "scale" : "1x" 17 | }, 18 | { 19 | "size" : "29x29", 20 | "idiom" : "iphone", 21 | "filename" : "Icon-Small@2x.png", 22 | "scale" : "2x" 23 | }, 24 | { 25 | "size" : "29x29", 26 | "idiom" : "iphone", 27 | "filename" : "Icon-Small@3x.png", 28 | "scale" : "3x" 29 | }, 30 | { 31 | "size" : "40x40", 32 | "idiom" : "iphone", 33 | "filename" : "Icon-Spotlight-40@2x-1.png", 34 | "scale" : "2x" 35 | }, 36 | { 37 | "size" : "40x40", 38 | "idiom" : "iphone", 39 | "filename" : "Icon-Spotlight-40@3x.png", 40 | "scale" : "3x" 41 | }, 42 | { 43 | "size" : "57x57", 44 | "idiom" : "iphone", 45 | "filename" : "Icon.png", 46 | "scale" : "1x" 47 | }, 48 | { 49 | "size" : "57x57", 50 | "idiom" : "iphone", 51 | "filename" : "Icon@2x.png", 52 | "scale" : "2x" 53 | }, 54 | { 55 | "size" : "60x60", 56 | "idiom" : "iphone", 57 | "filename" : "Icon-60@2x.png", 58 | "scale" : "2x" 59 | }, 60 | { 61 | "size" : "60x60", 62 | "idiom" : "iphone", 63 | "filename" : "Icon-60@3x.png", 64 | "scale" : "3x" 65 | }, 66 | { 67 | "idiom" : "ipad", 68 | "size" : "20x20", 69 | "scale" : "1x" 70 | }, 71 | { 72 | "idiom" : "ipad", 73 | "size" : "20x20", 74 | "scale" : "2x" 75 | }, 76 | { 77 | "size" : "29x29", 78 | "idiom" : "ipad", 79 | "filename" : "Icon-Small-1.png", 80 | "scale" : "1x" 81 | }, 82 | { 83 | "size" : "29x29", 84 | "idiom" : "ipad", 85 | "filename" : "Icon-Small@2x-1.png", 86 | "scale" : "2x" 87 | }, 88 | { 89 | "size" : "40x40", 90 | "idiom" : "ipad", 91 | "filename" : "Icon-Spotlight-40.png", 92 | "scale" : "1x" 93 | }, 94 | { 95 | "size" : "40x40", 96 | "idiom" : "ipad", 97 | "filename" : "Icon-Spotlight-40@2x.png", 98 | "scale" : "2x" 99 | }, 100 | { 101 | "size" : "50x50", 102 | "idiom" : "ipad", 103 | "filename" : "Icon-Small-50.png", 104 | "scale" : "1x" 105 | }, 106 | { 107 | "size" : "50x50", 108 | "idiom" : "ipad", 109 | "filename" : "Icon-Small-50@2x.png", 110 | "scale" : "2x" 111 | }, 112 | { 113 | "size" : "72x72", 114 | "idiom" : "ipad", 115 | "filename" : "Icon-72.png", 116 | "scale" : "1x" 117 | }, 118 | { 119 | "size" : "72x72", 120 | "idiom" : "ipad", 121 | "filename" : "Icon-72@2x.png", 122 | "scale" : "2x" 123 | }, 124 | { 125 | "size" : "76x76", 126 | "idiom" : "ipad", 127 | "filename" : "Icon-76.png", 128 | "scale" : "1x" 129 | }, 130 | { 131 | "size" : "76x76", 132 | "idiom" : "ipad", 133 | "filename" : "Icon-76@2x.png", 134 | "scale" : "2x" 135 | }, 136 | { 137 | "idiom" : "ipad", 138 | "size" : "83.5x83.5", 139 | "scale" : "2x" 140 | }, 141 | { 142 | "size" : "24x24", 143 | "idiom" : "watch", 144 | "scale" : "2x", 145 | "role" : "notificationCenter", 146 | "subtype" : "38mm" 147 | }, 148 | { 149 | "size" : "27.5x27.5", 150 | "idiom" : "watch", 151 | "scale" : "2x", 152 | "role" : "notificationCenter", 153 | "subtype" : "42mm" 154 | }, 155 | { 156 | "size" : "29x29", 157 | "idiom" : "watch", 158 | "role" : "companionSettings", 159 | "scale" : "2x" 160 | }, 161 | { 162 | "size" : "29x29", 163 | "idiom" : "watch", 164 | "role" : "companionSettings", 165 | "scale" : "3x" 166 | }, 167 | { 168 | "size" : "40x40", 169 | "idiom" : "watch", 170 | "scale" : "2x", 171 | "role" : "appLauncher", 172 | "subtype" : "38mm" 173 | }, 174 | { 175 | "size" : "44x44", 176 | "idiom" : "watch", 177 | "scale" : "2x", 178 | "role" : "longLook", 179 | "subtype" : "42mm" 180 | }, 181 | { 182 | "size" : "86x86", 183 | "idiom" : "watch", 184 | "scale" : "2x", 185 | "role" : "quickLook", 186 | "subtype" : "38mm" 187 | }, 188 | { 189 | "size" : "98x98", 190 | "idiom" : "watch", 191 | "scale" : "2x", 192 | "role" : "quickLook", 193 | "subtype" : "42mm" 194 | } 195 | ], 196 | "info" : { 197 | "version" : 1, 198 | "author" : "xcode" 199 | } 200 | } -------------------------------------------------------------------------------- /SJStaticTableViewDemo/SJStaticTableViewDemo/Images.xcassets/AppIcon.appiconset/Icon-60@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/knightsj/SJStaticTableView/6fb11c1f13569763a722c7d839bdfc3935735c9c/SJStaticTableViewDemo/SJStaticTableViewDemo/Images.xcassets/AppIcon.appiconset/Icon-60@2x.png -------------------------------------------------------------------------------- /SJStaticTableViewDemo/SJStaticTableViewDemo/Images.xcassets/AppIcon.appiconset/Icon-60@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/knightsj/SJStaticTableView/6fb11c1f13569763a722c7d839bdfc3935735c9c/SJStaticTableViewDemo/SJStaticTableViewDemo/Images.xcassets/AppIcon.appiconset/Icon-60@3x.png -------------------------------------------------------------------------------- /SJStaticTableViewDemo/SJStaticTableViewDemo/Images.xcassets/AppIcon.appiconset/Icon-72.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/knightsj/SJStaticTableView/6fb11c1f13569763a722c7d839bdfc3935735c9c/SJStaticTableViewDemo/SJStaticTableViewDemo/Images.xcassets/AppIcon.appiconset/Icon-72.png -------------------------------------------------------------------------------- /SJStaticTableViewDemo/SJStaticTableViewDemo/Images.xcassets/AppIcon.appiconset/Icon-72@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/knightsj/SJStaticTableView/6fb11c1f13569763a722c7d839bdfc3935735c9c/SJStaticTableViewDemo/SJStaticTableViewDemo/Images.xcassets/AppIcon.appiconset/Icon-72@2x.png -------------------------------------------------------------------------------- /SJStaticTableViewDemo/SJStaticTableViewDemo/Images.xcassets/AppIcon.appiconset/Icon-76.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/knightsj/SJStaticTableView/6fb11c1f13569763a722c7d839bdfc3935735c9c/SJStaticTableViewDemo/SJStaticTableViewDemo/Images.xcassets/AppIcon.appiconset/Icon-76.png -------------------------------------------------------------------------------- /SJStaticTableViewDemo/SJStaticTableViewDemo/Images.xcassets/AppIcon.appiconset/Icon-76@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/knightsj/SJStaticTableView/6fb11c1f13569763a722c7d839bdfc3935735c9c/SJStaticTableViewDemo/SJStaticTableViewDemo/Images.xcassets/AppIcon.appiconset/Icon-76@2x.png -------------------------------------------------------------------------------- /SJStaticTableViewDemo/SJStaticTableViewDemo/Images.xcassets/AppIcon.appiconset/Icon-Small-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/knightsj/SJStaticTableView/6fb11c1f13569763a722c7d839bdfc3935735c9c/SJStaticTableViewDemo/SJStaticTableViewDemo/Images.xcassets/AppIcon.appiconset/Icon-Small-1.png -------------------------------------------------------------------------------- /SJStaticTableViewDemo/SJStaticTableViewDemo/Images.xcassets/AppIcon.appiconset/Icon-Small-50.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/knightsj/SJStaticTableView/6fb11c1f13569763a722c7d839bdfc3935735c9c/SJStaticTableViewDemo/SJStaticTableViewDemo/Images.xcassets/AppIcon.appiconset/Icon-Small-50.png -------------------------------------------------------------------------------- /SJStaticTableViewDemo/SJStaticTableViewDemo/Images.xcassets/AppIcon.appiconset/Icon-Small-50@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/knightsj/SJStaticTableView/6fb11c1f13569763a722c7d839bdfc3935735c9c/SJStaticTableViewDemo/SJStaticTableViewDemo/Images.xcassets/AppIcon.appiconset/Icon-Small-50@2x.png -------------------------------------------------------------------------------- /SJStaticTableViewDemo/SJStaticTableViewDemo/Images.xcassets/AppIcon.appiconset/Icon-Small@2x-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/knightsj/SJStaticTableView/6fb11c1f13569763a722c7d839bdfc3935735c9c/SJStaticTableViewDemo/SJStaticTableViewDemo/Images.xcassets/AppIcon.appiconset/Icon-Small@2x-1.png -------------------------------------------------------------------------------- /SJStaticTableViewDemo/SJStaticTableViewDemo/Images.xcassets/AppIcon.appiconset/Icon-Small@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/knightsj/SJStaticTableView/6fb11c1f13569763a722c7d839bdfc3935735c9c/SJStaticTableViewDemo/SJStaticTableViewDemo/Images.xcassets/AppIcon.appiconset/Icon-Small@2x.png -------------------------------------------------------------------------------- /SJStaticTableViewDemo/SJStaticTableViewDemo/Images.xcassets/AppIcon.appiconset/Icon-Small@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/knightsj/SJStaticTableView/6fb11c1f13569763a722c7d839bdfc3935735c9c/SJStaticTableViewDemo/SJStaticTableViewDemo/Images.xcassets/AppIcon.appiconset/Icon-Small@3x.png -------------------------------------------------------------------------------- /SJStaticTableViewDemo/SJStaticTableViewDemo/Images.xcassets/AppIcon.appiconset/Icon-Spotlight-40.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/knightsj/SJStaticTableView/6fb11c1f13569763a722c7d839bdfc3935735c9c/SJStaticTableViewDemo/SJStaticTableViewDemo/Images.xcassets/AppIcon.appiconset/Icon-Spotlight-40.png -------------------------------------------------------------------------------- /SJStaticTableViewDemo/SJStaticTableViewDemo/Images.xcassets/AppIcon.appiconset/Icon-Spotlight-40@2x-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/knightsj/SJStaticTableView/6fb11c1f13569763a722c7d839bdfc3935735c9c/SJStaticTableViewDemo/SJStaticTableViewDemo/Images.xcassets/AppIcon.appiconset/Icon-Spotlight-40@2x-1.png -------------------------------------------------------------------------------- /SJStaticTableViewDemo/SJStaticTableViewDemo/Images.xcassets/AppIcon.appiconset/Icon-Spotlight-40@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/knightsj/SJStaticTableView/6fb11c1f13569763a722c7d839bdfc3935735c9c/SJStaticTableViewDemo/SJStaticTableViewDemo/Images.xcassets/AppIcon.appiconset/Icon-Spotlight-40@2x.png -------------------------------------------------------------------------------- /SJStaticTableViewDemo/SJStaticTableViewDemo/Images.xcassets/AppIcon.appiconset/Icon-Spotlight-40@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/knightsj/SJStaticTableView/6fb11c1f13569763a722c7d839bdfc3935735c9c/SJStaticTableViewDemo/SJStaticTableViewDemo/Images.xcassets/AppIcon.appiconset/Icon-Spotlight-40@3x.png -------------------------------------------------------------------------------- /SJStaticTableViewDemo/SJStaticTableViewDemo/Images.xcassets/AppIcon.appiconset/Icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/knightsj/SJStaticTableView/6fb11c1f13569763a722c7d839bdfc3935735c9c/SJStaticTableViewDemo/SJStaticTableViewDemo/Images.xcassets/AppIcon.appiconset/Icon.png -------------------------------------------------------------------------------- /SJStaticTableViewDemo/SJStaticTableViewDemo/Images.xcassets/AppIcon.appiconset/Icon@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/knightsj/SJStaticTableView/6fb11c1f13569763a722c7d839bdfc3935735c9c/SJStaticTableViewDemo/SJStaticTableViewDemo/Images.xcassets/AppIcon.appiconset/Icon@2x.png -------------------------------------------------------------------------------- /SJStaticTableViewDemo/SJStaticTableViewDemo/Images.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "version" : 1, 4 | "author" : "xcode" 5 | } 6 | } -------------------------------------------------------------------------------- /SJStaticTableViewDemo/SJStaticTableViewDemo/Images.xcassets/launch.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x" 6 | }, 7 | { 8 | "idiom" : "universal", 9 | "filename" : "launch@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 | } -------------------------------------------------------------------------------- /SJStaticTableViewDemo/SJStaticTableViewDemo/Images.xcassets/launch.imageset/launch@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/knightsj/SJStaticTableView/6fb11c1f13569763a722c7d839bdfc3935735c9c/SJStaticTableViewDemo/SJStaticTableViewDemo/Images.xcassets/launch.imageset/launch@2x.png -------------------------------------------------------------------------------- /SJStaticTableViewDemo/SJStaticTableViewDemo/Images.xcassets/tabbar_contacts.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x" 6 | }, 7 | { 8 | "idiom" : "universal", 9 | "scale" : "2x", 10 | "filename" : "tabbar_contacts@2x.png" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x", 15 | "filename" : "tabbar_contacts@3x.png" 16 | } 17 | ], 18 | "info" : { 19 | "version" : 1, 20 | "author" : "xcode" 21 | } 22 | } -------------------------------------------------------------------------------- /SJStaticTableViewDemo/SJStaticTableViewDemo/Images.xcassets/tabbar_contacts.imageset/tabbar_contacts@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/knightsj/SJStaticTableView/6fb11c1f13569763a722c7d839bdfc3935735c9c/SJStaticTableViewDemo/SJStaticTableViewDemo/Images.xcassets/tabbar_contacts.imageset/tabbar_contacts@2x.png -------------------------------------------------------------------------------- /SJStaticTableViewDemo/SJStaticTableViewDemo/Images.xcassets/tabbar_contacts.imageset/tabbar_contacts@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/knightsj/SJStaticTableView/6fb11c1f13569763a722c7d839bdfc3935735c9c/SJStaticTableViewDemo/SJStaticTableViewDemo/Images.xcassets/tabbar_contacts.imageset/tabbar_contacts@3x.png -------------------------------------------------------------------------------- /SJStaticTableViewDemo/SJStaticTableViewDemo/Images.xcassets/tabbar_contactsHL.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x" 6 | }, 7 | { 8 | "idiom" : "universal", 9 | "filename" : "tabbar_contactsHL@2x.png", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "filename" : "tabbar_contactsHL@3x.png", 15 | "scale" : "3x" 16 | } 17 | ], 18 | "info" : { 19 | "version" : 1, 20 | "author" : "xcode" 21 | } 22 | } -------------------------------------------------------------------------------- /SJStaticTableViewDemo/SJStaticTableViewDemo/Images.xcassets/tabbar_contactsHL.imageset/tabbar_contactsHL@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/knightsj/SJStaticTableView/6fb11c1f13569763a722c7d839bdfc3935735c9c/SJStaticTableViewDemo/SJStaticTableViewDemo/Images.xcassets/tabbar_contactsHL.imageset/tabbar_contactsHL@2x.png -------------------------------------------------------------------------------- /SJStaticTableViewDemo/SJStaticTableViewDemo/Images.xcassets/tabbar_contactsHL.imageset/tabbar_contactsHL@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/knightsj/SJStaticTableView/6fb11c1f13569763a722c7d839bdfc3935735c9c/SJStaticTableViewDemo/SJStaticTableViewDemo/Images.xcassets/tabbar_contactsHL.imageset/tabbar_contactsHL@3x.png -------------------------------------------------------------------------------- /SJStaticTableViewDemo/SJStaticTableViewDemo/Images.xcassets/tabbar_discover.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x" 6 | }, 7 | { 8 | "idiom" : "universal", 9 | "filename" : "tabbar_discover@2x.png", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "filename" : "tabbar_discover@3x.png", 15 | "scale" : "3x" 16 | } 17 | ], 18 | "info" : { 19 | "version" : 1, 20 | "author" : "xcode" 21 | } 22 | } -------------------------------------------------------------------------------- /SJStaticTableViewDemo/SJStaticTableViewDemo/Images.xcassets/tabbar_discover.imageset/tabbar_discover@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/knightsj/SJStaticTableView/6fb11c1f13569763a722c7d839bdfc3935735c9c/SJStaticTableViewDemo/SJStaticTableViewDemo/Images.xcassets/tabbar_discover.imageset/tabbar_discover@2x.png -------------------------------------------------------------------------------- /SJStaticTableViewDemo/SJStaticTableViewDemo/Images.xcassets/tabbar_discover.imageset/tabbar_discover@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/knightsj/SJStaticTableView/6fb11c1f13569763a722c7d839bdfc3935735c9c/SJStaticTableViewDemo/SJStaticTableViewDemo/Images.xcassets/tabbar_discover.imageset/tabbar_discover@3x.png -------------------------------------------------------------------------------- /SJStaticTableViewDemo/SJStaticTableViewDemo/Images.xcassets/tabbar_discoverHL.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x" 6 | }, 7 | { 8 | "idiom" : "universal", 9 | "filename" : "tabbar_discoverHL@2x.png", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "filename" : "tabbar_discoverHL@3x.png", 15 | "scale" : "3x" 16 | } 17 | ], 18 | "info" : { 19 | "version" : 1, 20 | "author" : "xcode" 21 | } 22 | } -------------------------------------------------------------------------------- /SJStaticTableViewDemo/SJStaticTableViewDemo/Images.xcassets/tabbar_discoverHL.imageset/tabbar_discoverHL@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/knightsj/SJStaticTableView/6fb11c1f13569763a722c7d839bdfc3935735c9c/SJStaticTableViewDemo/SJStaticTableViewDemo/Images.xcassets/tabbar_discoverHL.imageset/tabbar_discoverHL@2x.png -------------------------------------------------------------------------------- /SJStaticTableViewDemo/SJStaticTableViewDemo/Images.xcassets/tabbar_discoverHL.imageset/tabbar_discoverHL@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/knightsj/SJStaticTableView/6fb11c1f13569763a722c7d839bdfc3935735c9c/SJStaticTableViewDemo/SJStaticTableViewDemo/Images.xcassets/tabbar_discoverHL.imageset/tabbar_discoverHL@3x.png -------------------------------------------------------------------------------- /SJStaticTableViewDemo/SJStaticTableViewDemo/Images.xcassets/tabbar_mainframe.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x" 6 | }, 7 | { 8 | "idiom" : "universal", 9 | "filename" : "tabbar_mainframe@2x.png", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "filename" : "tabbar_mainframe@3x.png", 15 | "scale" : "3x" 16 | } 17 | ], 18 | "info" : { 19 | "version" : 1, 20 | "author" : "xcode" 21 | } 22 | } -------------------------------------------------------------------------------- /SJStaticTableViewDemo/SJStaticTableViewDemo/Images.xcassets/tabbar_mainframe.imageset/tabbar_mainframe@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/knightsj/SJStaticTableView/6fb11c1f13569763a722c7d839bdfc3935735c9c/SJStaticTableViewDemo/SJStaticTableViewDemo/Images.xcassets/tabbar_mainframe.imageset/tabbar_mainframe@2x.png -------------------------------------------------------------------------------- /SJStaticTableViewDemo/SJStaticTableViewDemo/Images.xcassets/tabbar_mainframe.imageset/tabbar_mainframe@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/knightsj/SJStaticTableView/6fb11c1f13569763a722c7d839bdfc3935735c9c/SJStaticTableViewDemo/SJStaticTableViewDemo/Images.xcassets/tabbar_mainframe.imageset/tabbar_mainframe@3x.png -------------------------------------------------------------------------------- /SJStaticTableViewDemo/SJStaticTableViewDemo/Images.xcassets/tabbar_mainframeHL.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x" 6 | }, 7 | { 8 | "idiom" : "universal", 9 | "filename" : "tabbar_mainframeHL@2x.png", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "filename" : "tabbar_mainframeHL@3x.png", 15 | "scale" : "3x" 16 | } 17 | ], 18 | "info" : { 19 | "version" : 1, 20 | "author" : "xcode" 21 | } 22 | } -------------------------------------------------------------------------------- /SJStaticTableViewDemo/SJStaticTableViewDemo/Images.xcassets/tabbar_mainframeHL.imageset/tabbar_mainframeHL@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/knightsj/SJStaticTableView/6fb11c1f13569763a722c7d839bdfc3935735c9c/SJStaticTableViewDemo/SJStaticTableViewDemo/Images.xcassets/tabbar_mainframeHL.imageset/tabbar_mainframeHL@2x.png -------------------------------------------------------------------------------- /SJStaticTableViewDemo/SJStaticTableViewDemo/Images.xcassets/tabbar_mainframeHL.imageset/tabbar_mainframeHL@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/knightsj/SJStaticTableView/6fb11c1f13569763a722c7d839bdfc3935735c9c/SJStaticTableViewDemo/SJStaticTableViewDemo/Images.xcassets/tabbar_mainframeHL.imageset/tabbar_mainframeHL@3x.png -------------------------------------------------------------------------------- /SJStaticTableViewDemo/SJStaticTableViewDemo/Images.xcassets/tabbar_me.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x" 6 | }, 7 | { 8 | "idiom" : "universal", 9 | "filename" : "tabbar_me@2x.png", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "filename" : "tabbar_me@3x.png", 15 | "scale" : "3x" 16 | } 17 | ], 18 | "info" : { 19 | "version" : 1, 20 | "author" : "xcode" 21 | } 22 | } -------------------------------------------------------------------------------- /SJStaticTableViewDemo/SJStaticTableViewDemo/Images.xcassets/tabbar_me.imageset/tabbar_me@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/knightsj/SJStaticTableView/6fb11c1f13569763a722c7d839bdfc3935735c9c/SJStaticTableViewDemo/SJStaticTableViewDemo/Images.xcassets/tabbar_me.imageset/tabbar_me@2x.png -------------------------------------------------------------------------------- /SJStaticTableViewDemo/SJStaticTableViewDemo/Images.xcassets/tabbar_me.imageset/tabbar_me@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/knightsj/SJStaticTableView/6fb11c1f13569763a722c7d839bdfc3935735c9c/SJStaticTableViewDemo/SJStaticTableViewDemo/Images.xcassets/tabbar_me.imageset/tabbar_me@3x.png -------------------------------------------------------------------------------- /SJStaticTableViewDemo/SJStaticTableViewDemo/Images.xcassets/tabbar_meHL.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x" 6 | }, 7 | { 8 | "idiom" : "universal", 9 | "filename" : "tabbar_meHL@2x.png", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "filename" : "tabbar_meHL@3x.png", 15 | "scale" : "3x" 16 | } 17 | ], 18 | "info" : { 19 | "version" : 1, 20 | "author" : "xcode" 21 | } 22 | } -------------------------------------------------------------------------------- /SJStaticTableViewDemo/SJStaticTableViewDemo/Images.xcassets/tabbar_meHL.imageset/tabbar_meHL@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/knightsj/SJStaticTableView/6fb11c1f13569763a722c7d839bdfc3935735c9c/SJStaticTableViewDemo/SJStaticTableViewDemo/Images.xcassets/tabbar_meHL.imageset/tabbar_meHL@2x.png -------------------------------------------------------------------------------- /SJStaticTableViewDemo/SJStaticTableViewDemo/Images.xcassets/tabbar_meHL.imageset/tabbar_meHL@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/knightsj/SJStaticTableView/6fb11c1f13569763a722c7d839bdfc3935735c9c/SJStaticTableViewDemo/SJStaticTableViewDemo/Images.xcassets/tabbar_meHL.imageset/tabbar_meHL@3x.png -------------------------------------------------------------------------------- /SJStaticTableViewDemo/SJStaticTableViewDemo/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | APPL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleVersion 20 | 1 21 | LSRequiresIPhoneOS 22 | 23 | UILaunchStoryboardName 24 | LaunchScreen 25 | UIMainStoryboardFile 26 | Main 27 | UIRequiredDeviceCapabilities 28 | 29 | armv7 30 | 31 | UISupportedInterfaceOrientations 32 | 33 | UIInterfaceOrientationPortrait 34 | UIInterfaceOrientationLandscapeLeft 35 | UIInterfaceOrientationLandscapeRight 36 | 37 | 38 | 39 | -------------------------------------------------------------------------------- /SJStaticTableViewDemo/SJStaticTableViewDemo/Me.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "version" : 1, 4 | "author" : "xcode" 5 | } 6 | } -------------------------------------------------------------------------------- /SJStaticTableViewDemo/SJStaticTableViewDemo/Me.xcassets/MoreMyAlbum.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x", 6 | "filename" : "MoreMyAlbum.png" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x", 11 | "filename" : "MoreMyAlbum@2x.png" 12 | }, 13 | { 14 | "idiom" : "universal", 15 | "scale" : "3x", 16 | "filename" : "MoreMyAlbum@3x.png" 17 | } 18 | ], 19 | "info" : { 20 | "version" : 1, 21 | "author" : "xcode" 22 | } 23 | } -------------------------------------------------------------------------------- /SJStaticTableViewDemo/SJStaticTableViewDemo/Me.xcassets/MoreMyAlbum.imageset/MoreMyAlbum.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/knightsj/SJStaticTableView/6fb11c1f13569763a722c7d839bdfc3935735c9c/SJStaticTableViewDemo/SJStaticTableViewDemo/Me.xcassets/MoreMyAlbum.imageset/MoreMyAlbum.png -------------------------------------------------------------------------------- /SJStaticTableViewDemo/SJStaticTableViewDemo/Me.xcassets/MoreMyAlbum.imageset/MoreMyAlbum@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/knightsj/SJStaticTableView/6fb11c1f13569763a722c7d839bdfc3935735c9c/SJStaticTableViewDemo/SJStaticTableViewDemo/Me.xcassets/MoreMyAlbum.imageset/MoreMyAlbum@2x.png -------------------------------------------------------------------------------- /SJStaticTableViewDemo/SJStaticTableViewDemo/Me.xcassets/MoreMyAlbum.imageset/MoreMyAlbum@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/knightsj/SJStaticTableView/6fb11c1f13569763a722c7d839bdfc3935735c9c/SJStaticTableViewDemo/SJStaticTableViewDemo/Me.xcassets/MoreMyAlbum.imageset/MoreMyAlbum@3x.png -------------------------------------------------------------------------------- /SJStaticTableViewDemo/SJStaticTableViewDemo/Me.xcassets/MoreMyBankCard.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x", 6 | "filename" : "MoreMyBankCard.png" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x", 11 | "filename" : "MoreMyBankCard@2x.png" 12 | }, 13 | { 14 | "idiom" : "universal", 15 | "scale" : "3x", 16 | "filename" : "MoreMyBankCard@3x.png" 17 | } 18 | ], 19 | "info" : { 20 | "version" : 1, 21 | "author" : "xcode" 22 | } 23 | } -------------------------------------------------------------------------------- /SJStaticTableViewDemo/SJStaticTableViewDemo/Me.xcassets/MoreMyBankCard.imageset/MoreMyBankCard.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/knightsj/SJStaticTableView/6fb11c1f13569763a722c7d839bdfc3935735c9c/SJStaticTableViewDemo/SJStaticTableViewDemo/Me.xcassets/MoreMyBankCard.imageset/MoreMyBankCard.png -------------------------------------------------------------------------------- /SJStaticTableViewDemo/SJStaticTableViewDemo/Me.xcassets/MoreMyBankCard.imageset/MoreMyBankCard@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/knightsj/SJStaticTableView/6fb11c1f13569763a722c7d839bdfc3935735c9c/SJStaticTableViewDemo/SJStaticTableViewDemo/Me.xcassets/MoreMyBankCard.imageset/MoreMyBankCard@2x.png -------------------------------------------------------------------------------- /SJStaticTableViewDemo/SJStaticTableViewDemo/Me.xcassets/MoreMyBankCard.imageset/MoreMyBankCard@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/knightsj/SJStaticTableView/6fb11c1f13569763a722c7d839bdfc3935735c9c/SJStaticTableViewDemo/SJStaticTableViewDemo/Me.xcassets/MoreMyBankCard.imageset/MoreMyBankCard@3x.png -------------------------------------------------------------------------------- /SJStaticTableViewDemo/SJStaticTableViewDemo/Me.xcassets/MoreMyFavorites.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x", 6 | "filename" : "MoreMyFavorites.png" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x", 11 | "filename" : "MoreMyFavorites@2x.png" 12 | }, 13 | { 14 | "idiom" : "universal", 15 | "scale" : "3x", 16 | "filename" : "MoreMyFavorites@3x.png" 17 | } 18 | ], 19 | "info" : { 20 | "version" : 1, 21 | "author" : "xcode" 22 | } 23 | } -------------------------------------------------------------------------------- /SJStaticTableViewDemo/SJStaticTableViewDemo/Me.xcassets/MoreMyFavorites.imageset/MoreMyFavorites.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/knightsj/SJStaticTableView/6fb11c1f13569763a722c7d839bdfc3935735c9c/SJStaticTableViewDemo/SJStaticTableViewDemo/Me.xcassets/MoreMyFavorites.imageset/MoreMyFavorites.png -------------------------------------------------------------------------------- /SJStaticTableViewDemo/SJStaticTableViewDemo/Me.xcassets/MoreMyFavorites.imageset/MoreMyFavorites@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/knightsj/SJStaticTableView/6fb11c1f13569763a722c7d839bdfc3935735c9c/SJStaticTableViewDemo/SJStaticTableViewDemo/Me.xcassets/MoreMyFavorites.imageset/MoreMyFavorites@2x.png -------------------------------------------------------------------------------- /SJStaticTableViewDemo/SJStaticTableViewDemo/Me.xcassets/MoreMyFavorites.imageset/MoreMyFavorites@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/knightsj/SJStaticTableView/6fb11c1f13569763a722c7d839bdfc3935735c9c/SJStaticTableViewDemo/SJStaticTableViewDemo/Me.xcassets/MoreMyFavorites.imageset/MoreMyFavorites@3x.png -------------------------------------------------------------------------------- /SJStaticTableViewDemo/SJStaticTableViewDemo/Me.xcassets/MoreSetting.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x" 6 | }, 7 | { 8 | "idiom" : "universal", 9 | "scale" : "2x", 10 | "filename" : "MoreSetting@2x.png" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x", 15 | "filename" : "MoreSetting@3x.png" 16 | } 17 | ], 18 | "info" : { 19 | "version" : 1, 20 | "author" : "xcode" 21 | } 22 | } -------------------------------------------------------------------------------- /SJStaticTableViewDemo/SJStaticTableViewDemo/Me.xcassets/MoreSetting.imageset/MoreSetting@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/knightsj/SJStaticTableView/6fb11c1f13569763a722c7d839bdfc3935735c9c/SJStaticTableViewDemo/SJStaticTableViewDemo/Me.xcassets/MoreSetting.imageset/MoreSetting@2x.png -------------------------------------------------------------------------------- /SJStaticTableViewDemo/SJStaticTableViewDemo/Me.xcassets/MoreSetting.imageset/MoreSetting@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/knightsj/SJStaticTableView/6fb11c1f13569763a722c7d839bdfc3935735c9c/SJStaticTableViewDemo/SJStaticTableViewDemo/Me.xcassets/MoreSetting.imageset/MoreSetting@3x.png -------------------------------------------------------------------------------- /SJStaticTableViewDemo/SJStaticTableViewDemo/Me.xcassets/MyCardPackageIcon.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x" 6 | }, 7 | { 8 | "idiom" : "universal", 9 | "scale" : "2x", 10 | "filename" : "MyCardPackageIcon@2x.png" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /SJStaticTableViewDemo/SJStaticTableViewDemo/Me.xcassets/MyCardPackageIcon.imageset/MyCardPackageIcon@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/knightsj/SJStaticTableView/6fb11c1f13569763a722c7d839bdfc3935735c9c/SJStaticTableViewDemo/SJStaticTableViewDemo/Me.xcassets/MyCardPackageIcon.imageset/MyCardPackageIcon@2x.png -------------------------------------------------------------------------------- /SJStaticTableViewDemo/SJStaticTableViewDemo/Me.xcassets/ProfileLockOn.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x" 6 | }, 7 | { 8 | "idiom" : "universal", 9 | "scale" : "2x", 10 | "filename" : "ProfileLockOn@2x.png" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x", 15 | "filename" : "ProfileLockOn@3x.png" 16 | } 17 | ], 18 | "info" : { 19 | "version" : 1, 20 | "author" : "xcode" 21 | } 22 | } -------------------------------------------------------------------------------- /SJStaticTableViewDemo/SJStaticTableViewDemo/Me.xcassets/ProfileLockOn.imageset/ProfileLockOn@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/knightsj/SJStaticTableView/6fb11c1f13569763a722c7d839bdfc3935735c9c/SJStaticTableViewDemo/SJStaticTableViewDemo/Me.xcassets/ProfileLockOn.imageset/ProfileLockOn@2x.png -------------------------------------------------------------------------------- /SJStaticTableViewDemo/SJStaticTableViewDemo/Me.xcassets/ProfileLockOn.imageset/ProfileLockOn@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/knightsj/SJStaticTableView/6fb11c1f13569763a722c7d839bdfc3935735c9c/SJStaticTableViewDemo/SJStaticTableViewDemo/Me.xcassets/ProfileLockOn.imageset/ProfileLockOn@3x.png -------------------------------------------------------------------------------- /SJStaticTableViewDemo/SJStaticTableViewDemo/Me.xcassets/avatar.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x" 6 | }, 7 | { 8 | "idiom" : "universal", 9 | "filename" : "avatar@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 | } -------------------------------------------------------------------------------- /SJStaticTableViewDemo/SJStaticTableViewDemo/Me.xcassets/avatar.imageset/avatar@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/knightsj/SJStaticTableView/6fb11c1f13569763a722c7d839bdfc3935735c9c/SJStaticTableViewDemo/SJStaticTableViewDemo/Me.xcassets/avatar.imageset/avatar@2x.png -------------------------------------------------------------------------------- /SJStaticTableViewDemo/SJStaticTableViewDemo/Me.xcassets/emoticon.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x" 6 | }, 7 | { 8 | "idiom" : "universal", 9 | "filename" : "emoticon@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 | } -------------------------------------------------------------------------------- /SJStaticTableViewDemo/SJStaticTableViewDemo/Me.xcassets/emoticon.imageset/emoticon@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/knightsj/SJStaticTableView/6fb11c1f13569763a722c7d839bdfc3935735c9c/SJStaticTableViewDemo/SJStaticTableViewDemo/Me.xcassets/emoticon.imageset/emoticon@2x.png -------------------------------------------------------------------------------- /SJStaticTableViewDemo/SJStaticTableViewDemo/Me.xcassets/qrcode.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x" 6 | }, 7 | { 8 | "idiom" : "universal", 9 | "filename" : "qrcode@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 | } -------------------------------------------------------------------------------- /SJStaticTableViewDemo/SJStaticTableViewDemo/Me.xcassets/qrcode.imageset/qrcode@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/knightsj/SJStaticTableView/6fb11c1f13569763a722c7d839bdfc3935735c9c/SJStaticTableViewDemo/SJStaticTableViewDemo/Me.xcassets/qrcode.imageset/qrcode@2x.png -------------------------------------------------------------------------------- /SJStaticTableViewDemo/SJStaticTableViewDemo/Me.xcassets/wzry.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x" 6 | }, 7 | { 8 | "idiom" : "universal", 9 | "filename" : "wzry@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 | } -------------------------------------------------------------------------------- /SJStaticTableViewDemo/SJStaticTableViewDemo/Me.xcassets/wzry.imageset/wzry@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/knightsj/SJStaticTableView/6fb11c1f13569763a722c7d839bdfc3935735c9c/SJStaticTableViewDemo/SJStaticTableViewDemo/Me.xcassets/wzry.imageset/wzry@2x.png -------------------------------------------------------------------------------- /SJStaticTableViewDemo/SJStaticTableViewDemo/SJStaticTableViewComponent/Factory.h: -------------------------------------------------------------------------------- 1 | // 2 | // Factory.h 3 | // SSJStaticTableViewDemo 4 | // 5 | // Created by Sun Shijie on 2017/3/15. 6 | // Copyright © 2017年 Shijie. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface Factory : NSObject 12 | 13 | //我页面 14 | + (NSArray *)mePageData; 15 | 16 | //设置页面 17 | + (NSArray *)settingPageData; 18 | 19 | //个人信息页 20 | + (NSArray *)infoPageData; 21 | 22 | //发现页 23 | + (NSArray *)momentsPageData; 24 | 25 | //定制cell页 - 分组 26 | + (NSArray *)customCellsPageData; 27 | 28 | //定制cell页 - 同组 29 | + (NSArray *)customCellsOneSectionPageData; 30 | 31 | //表情页 32 | + (NSArray *)emoticonPage; 33 | 34 | @end 35 | -------------------------------------------------------------------------------- /SJStaticTableViewDemo/SJStaticTableViewDemo/SJStaticTableViewComponent/Resources/arrow@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/knightsj/SJStaticTableView/6fb11c1f13569763a722c7d839bdfc3935735c9c/SJStaticTableViewDemo/SJStaticTableViewDemo/SJStaticTableViewComponent/Resources/arrow@2x.png -------------------------------------------------------------------------------- /SJStaticTableViewDemo/SJStaticTableViewDemo/SJStaticTableViewComponent/SJConst.h: -------------------------------------------------------------------------------- 1 | // 2 | // SJConst.h 3 | // SSJStaticTableViewDemo 4 | // 5 | // Created by Sun Shijie on 2017/3/18. 6 | // Copyright © 2017年 Shijie. All rights reserved. 7 | // 8 | 9 | #ifndef SJConst_h 10 | #define SJConst_h 11 | 12 | //distance 13 | #define SJScreenWidth [UIScreen mainScreen].bounds.size.width 14 | #define SJScreenHeight [UIScreen mainScreen].bounds.size.height 15 | 16 | #define SJTopGap 8 //same as bottom gap 17 | #define SJLeftGap 12 //same as right gap 18 | #define SJLeftMiddleGap 10 //in left part: the gap between image and label 19 | #define SJRightMiddleGap 6 //in right part: the gap between image and label 20 | #define SJImgWidth 30 21 | #define SJTitleWidthLimit 180 22 | 23 | 24 | //image 25 | #define SJIndicatorArrow @"arrow" 26 | 27 | 28 | //font 29 | #define SJLeftTitleTextFont [UIFont systemFontOfSize:15] 30 | #define SJLogoutButtonFont [UIFont systemFontOfSize:16] 31 | #define SJIndicatorLeftTitleTextFont [UIFont systemFontOfSize:13] 32 | 33 | //color 34 | #define SJColorWithRGB(R,G,B,A) [UIColor colorWithRed:R/255.0 green:G/255.0 blue:B/255.0 alpha:A] 35 | #define SJLeftTitleTextColor [UIColor blackColor] 36 | #define SJIndicatorLeftTitleTextColor SJColorWithRGB(136,136,136,1) 37 | 38 | 39 | #endif /* SJConst_h */ 40 | -------------------------------------------------------------------------------- /SJStaticTableViewDemo/SJStaticTableViewDemo/SJStaticTableViewComponent/SJStaticTableView.h: -------------------------------------------------------------------------------- 1 | // 2 | // SJStaticTableView.h 3 | // SSJStaticTableViewDemo 4 | // 5 | // Created by Sun Shijie on 2017/3/15. 6 | // Copyright © 2017年 Shijie. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "SJStaticTableViewDataSource.h" 11 | 12 | 13 | 14 | @protocol SJStaticTableViewDelegate 15 | 16 | @optional 17 | 18 | - (void)didSelectViewModel: (SJStaticTableviewCellViewModel *)viewModel atIndexPath:(NSIndexPath *)indexPath; 19 | 20 | @end 21 | 22 | 23 | 24 | 25 | 26 | @interface SJStaticTableView : UITableView 27 | 28 | @property (nonatomic, weak) id sjDelegate; 29 | @property (nonatomic, weak) id sjDataSource; 30 | 31 | @end 32 | -------------------------------------------------------------------------------- /SJStaticTableViewDemo/SJStaticTableViewDemo/SJStaticTableViewComponent/SJStaticTableView.m: -------------------------------------------------------------------------------- 1 | // 2 | // SJStaticTableView.m 3 | // SSJStaticTableViewDemo 4 | // 5 | // Created by Sun Shijie on 2017/3/15. 6 | // Copyright © 2017年 Shijie. All rights reserved. 7 | // 8 | 9 | #import "SJStaticTableView.h" 10 | #import "SJStaticTableviewCellViewModel.h" 11 | #import "SJStaticTableviewSectionViewModel.h" 12 | #import "SJStaticTableViewCell.h" 13 | 14 | @implementation SJStaticTableView 15 | 16 | - (instancetype)initWithFrame:(CGRect)frame style:(UITableViewStyle)style { 17 | self = [super initWithFrame:frame style:style]; 18 | if (self) { 19 | self.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight; 20 | self.showsVerticalScrollIndicator = NO; 21 | self.showsHorizontalScrollIndicator = NO; 22 | self.backgroundColor = SJColorWithRGB(240, 239, 245, 1); 23 | self.tableFooterView = [[UIView alloc]initWithFrame:CGRectZero]; 24 | self.delegate = self; 25 | } 26 | return self; 27 | } 28 | 29 | - (void)setSjDataSource:(id)sjDataSource 30 | { 31 | if (_sjDataSource != sjDataSource) { 32 | _sjDataSource = sjDataSource; 33 | self.dataSource = _sjDataSource; 34 | } 35 | } 36 | 37 | #pragma mark - Tableview Delegate 38 | 39 | - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath 40 | { 41 | SJStaticTableviewCellViewModel *cellViewModel = [self.sjDataSource tableView:tableView cellViewModelAtIndexPath:indexPath]; 42 | return cellViewModel.cellHeight; 43 | } 44 | 45 | 46 | - (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section 47 | { 48 | SJStaticTableviewSectionViewModel *sectionViewModel = [self.sjDataSource tableView:tableView sectionViewModelInSection:section]; 49 | return sectionViewModel.sectionHeaderHeight; 50 | } 51 | 52 | - (CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section 53 | { 54 | SJStaticTableviewSectionViewModel *sectionViewModel = [self.sjDataSource tableView:tableView sectionViewModelInSection:section]; 55 | return sectionViewModel.sectionFooterHeight; 56 | } 57 | 58 | 59 | - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath 60 | { 61 | [tableView deselectRowAtIndexPath:indexPath animated:YES]; 62 | if ((self.sjDelegate) && [self.sjDelegate respondsToSelector:@selector(didSelectViewModel:atIndexPath:)]) { 63 | 64 | SJStaticTableviewCellViewModel *cellViewModel = [self.sjDataSource tableView:tableView cellViewModelAtIndexPath:indexPath]; 65 | [self.sjDelegate didSelectViewModel:cellViewModel atIndexPath:indexPath]; 66 | 67 | }else if((self.sjDelegate)&& [self.sjDelegate respondsToSelector:@selector(tableView:didSelectRowAtIndexPath:)]){ 68 | 69 | [self.sjDelegate tableView:tableView didSelectRowAtIndexPath:indexPath]; 70 | 71 | } 72 | } 73 | 74 | 75 | @end 76 | -------------------------------------------------------------------------------- /SJStaticTableViewDemo/SJStaticTableViewDemo/SJStaticTableViewComponent/SJStaticTableViewCell+AccessoryDisclosureIndicator.h: -------------------------------------------------------------------------------- 1 | // 2 | // SJStaticTableViewCell+AccessoryDisclosureIndicator.h 3 | // SSJStaticTableViewDemo 4 | // 5 | // Created by Sun Shijie on 2017/3/15. 6 | // Copyright © 2017年 Shijie. All rights reserved. 7 | // 8 | 9 | #import "SJStaticTableViewCell.h" 10 | 11 | @interface SJStaticTableViewCell (AccessoryDisclosureIndicator) 12 | 13 | - (void)configureAccessoryDisclosureIndicatorCellWithViewModel:(SJStaticTableviewCellViewModel *)viewModel; 14 | 15 | @end 16 | -------------------------------------------------------------------------------- /SJStaticTableViewDemo/SJStaticTableViewDemo/SJStaticTableViewComponent/SJStaticTableViewCell+AccessoryDisclosureIndicator.m: -------------------------------------------------------------------------------- 1 | // 2 | // SJStaticTableViewCell+AccessoryDisclosureIndicator.m 3 | // SSJStaticTableViewDemo 4 | // 5 | // Created by Sun Shijie on 2017/3/15. 6 | // Copyright © 2017年 Shijie. All rights reserved. 7 | // 8 | 9 | #import "SJStaticTableViewCell+AccessoryDisclosureIndicator.h" 10 | 11 | @implementation SJStaticTableViewCell (AccessoryDisclosureIndicator) 12 | 13 | - (void)configureAccessoryDisclosureIndicatorCellWithViewModel:(SJStaticTableviewCellViewModel *)viewModel 14 | { 15 | //左侧控件的配置 16 | [self layoutLeftPartSubViewsWithViewModel:viewModel]; 17 | 18 | //右侧存在箭头 19 | [self.contentView addSubview:self.indicatorArrow]; 20 | 21 | //右侧存在箭头+文字 22 | if ( (viewModel.indicatorLeftTitle) && (viewModel.indicatorLeftLabelSize.width != 0)) { 23 | [self.contentView addSubview:self.indicatorLeftLabel]; 24 | [self configureIndicatorLeftLabel]; 25 | } 26 | 27 | //右侧存在箭头+图片 28 | if ((self.viewModel.indicatorLeftImage) && (viewModel.indicatorLeftImageSize.height != 0)){ 29 | [self.contentView addSubview:self.indicatorLeftImageView]; 30 | [self configureIndicatorLeftImage]; 31 | } 32 | } 33 | 34 | //将右侧label的配置从懒加载里抽出来 35 | - (void)configureIndicatorLeftLabel 36 | { 37 | 38 | self.indicatorLeftLabel.font = self.viewModel.indicatorLeftLabelTextFont; 39 | self.indicatorLeftLabel.textColor = self.viewModel.indicatorLeftLabelTextColor; 40 | self.indicatorLeftLabel.text = self.viewModel.indicatorLeftTitle; 41 | 42 | if (!self.viewModel.hasIndicatorImageAndLabel) { 43 | //只存在右侧Label 44 | self.indicatorLeftLabel.frame = CGRectMake(self.indicatorArrow.frame.origin.x - SJLeftGap - self.viewModel.indicatorLeftLabelSize.width , (self.viewModel.cellHeight - self.viewModel.indicatorLeftLabelSize.height)/2, self.viewModel.indicatorLeftLabelSize.width, self.viewModel.indicatorLeftLabelSize.height); 45 | }else{ 46 | //右侧Label和image同时存在 47 | if (self.viewModel.isImageFirst) { 48 | 49 | self.indicatorLeftLabel.frame = CGRectMake(SJScreenWidth - SJLeftGap - self.indicatorArrow.bounds.size.width - self.viewModel.indicatorLeftImageAndLabelGap - self.viewModel.indicatorLeftImageSize.width - SJLeftGap - self.viewModel.indicatorLeftLabelSize.width, (self.viewModel.cellHeight - self.viewModel.indicatorLeftLabelSize.height)/2, self.viewModel.indicatorLeftLabelSize.width, self.viewModel.indicatorLeftLabelSize.height); 50 | 51 | }else{ 52 | 53 | self.indicatorLeftLabel.frame = CGRectMake(SJScreenWidth - SJLeftGap - self.indicatorArrow.bounds.size.width - SJLeftGap - self.viewModel.indicatorLeftLabelSize.width, (self.viewModel.cellHeight - self.viewModel.indicatorLeftLabelSize.height)/2, self.viewModel.indicatorLeftLabelSize.width, self.viewModel.indicatorLeftLabelSize.height); 54 | } 55 | } 56 | } 57 | 58 | //将右侧image的配置从懒加载里抽出来 59 | - (void)configureIndicatorLeftImage 60 | { 61 | self.indicatorLeftImageView.image = self.viewModel.indicatorLeftImage; 62 | 63 | if (!self.viewModel.hasIndicatorImageAndLabel) { 64 | //只存在右侧image 65 | self.indicatorLeftImageView.frame = CGRectMake(self.indicatorArrow.frame.origin.x - SJLeftGap - self.viewModel.indicatorLeftImageSize.width, (self.viewModel.cellHeight - self.viewModel.indicatorLeftImageSize.height)/2, self.viewModel.indicatorLeftImageSize.width , self.viewModel.indicatorLeftImageSize.height); 66 | }else{ 67 | //右侧Label和image同时存在 68 | if (self.viewModel.isImageFirst) { 69 | 70 | self.indicatorLeftImageView.frame = CGRectMake(SJScreenWidth - SJLeftGap - self.indicatorArrow.bounds.size.width - SJLeftGap - self.viewModel.indicatorLeftImageSize.width, (self.viewModel.cellHeight - self.viewModel.indicatorLeftImageSize.height)/2, self.viewModel.indicatorLeftImageSize.width, self.viewModel.indicatorLeftImageSize.height); 71 | 72 | }else{ 73 | 74 | self.indicatorLeftImageView.frame = CGRectMake(SJScreenWidth - SJLeftGap - self.indicatorArrow.bounds.size.width - self.viewModel.indicatorLeftImageAndLabelGap - self.viewModel.indicatorLeftLabelSize.width - SJLeftGap - self.viewModel.indicatorLeftImageSize.width, (self.viewModel.cellHeight - self.viewModel.indicatorLeftImageSize.height)/2, self.viewModel.indicatorLeftImageSize.width,self.viewModel.indicatorLeftImageSize.height); 75 | } 76 | 77 | } 78 | } 79 | 80 | @end 81 | -------------------------------------------------------------------------------- /SJStaticTableViewDemo/SJStaticTableViewDemo/SJStaticTableViewComponent/SJStaticTableViewCell+AccessoryNone.h: -------------------------------------------------------------------------------- 1 | // 2 | // SJStaticTableViewCell+AccessoryNone.h 3 | // SSJStaticTableViewDemo 4 | // 5 | // Created by Sun Shijie on 2017/3/17. 6 | // Copyright © 2017年 Shijie. All rights reserved. 7 | // 8 | 9 | #import "SJStaticTableViewCell.h" 10 | 11 | @interface SJStaticTableViewCell (AccessoryNone) 12 | 13 | - (void)configureAccessoryNoneCellWithViewModel:(SJStaticTableviewCellViewModel *)viewModel; 14 | 15 | @end 16 | -------------------------------------------------------------------------------- /SJStaticTableViewDemo/SJStaticTableViewDemo/SJStaticTableViewComponent/SJStaticTableViewCell+AccessoryNone.m: -------------------------------------------------------------------------------- 1 | // 2 | // SJStaticTableViewCell+AccessoryNone.m 3 | // SSJStaticTableViewDemo 4 | // 5 | // Created by Sun Shijie on 2017/3/17. 6 | // Copyright © 2017年 Shijie. All rights reserved. 7 | // 8 | 9 | #import "SJStaticTableViewCell+AccessoryNone.h" 10 | 11 | @implementation SJStaticTableViewCell (AccessoryNone) 12 | 13 | - (void)configureAccessoryNoneCellWithViewModel:(SJStaticTableviewCellViewModel *)viewModel 14 | { 15 | [self layoutLeftPartSubViewsWithViewModel:viewModel]; 16 | } 17 | @end 18 | -------------------------------------------------------------------------------- /SJStaticTableViewDemo/SJStaticTableViewDemo/SJStaticTableViewComponent/SJStaticTableViewCell+AccessorySwitch.h: -------------------------------------------------------------------------------- 1 | // 2 | // SJStaticTableViewCell+AccessorySwitch.h 3 | // SSJStaticTableViewDemo 4 | // 5 | // Created by Sun Shijie on 2017/3/17. 6 | // Copyright © 2017年 Shijie. All rights reserved. 7 | // 8 | 9 | #import "SJStaticTableViewCell.h" 10 | 11 | @interface SJStaticTableViewCell (AccessorySwitch) 12 | 13 | - (void)configureAccessorySwitchCellWithViewModel:(SJStaticTableviewCellViewModel *)viewModel; 14 | 15 | @end 16 | -------------------------------------------------------------------------------- /SJStaticTableViewDemo/SJStaticTableViewDemo/SJStaticTableViewComponent/SJStaticTableViewCell+AccessorySwitch.m: -------------------------------------------------------------------------------- 1 | // 2 | // SJStaticTableViewCell+AccessorySwitch.m 3 | // SSJStaticTableViewDemo 4 | // 5 | // Created by Sun Shijie on 2017/3/17. 6 | // Copyright © 2017年 Shijie. All rights reserved. 7 | // 8 | 9 | #import "SJStaticTableViewCell+AccessorySwitch.h" 10 | 11 | @implementation SJStaticTableViewCell (AccessorySwitch) 12 | 13 | - (void)configureAccessorySwitchCellWithViewModel:(SJStaticTableviewCellViewModel *)viewModel 14 | { 15 | [self layoutLeftPartSubViewsWithViewModel:viewModel]; 16 | [self.contentView addSubview:self.indicatorSwitch]; 17 | } 18 | 19 | @end 20 | -------------------------------------------------------------------------------- /SJStaticTableViewDemo/SJStaticTableViewDemo/SJStaticTableViewComponent/SJStaticTableViewCell+Logout.h: -------------------------------------------------------------------------------- 1 | // 2 | // SJStaticTableViewCell+Logout.h 3 | // SSJStaticTableViewDemo 4 | // 5 | // Created by Sun Shijie on 2017/3/16. 6 | // Copyright © 2017年 Shijie. All rights reserved. 7 | // 8 | 9 | #import "SJStaticTableViewCell.h" 10 | 11 | @interface SJStaticTableViewCell (Logout) 12 | 13 | - (void)configureLogoutTableViewCellWithViewModel:(SJStaticTableviewCellViewModel *)viewModel; 14 | 15 | @end 16 | -------------------------------------------------------------------------------- /SJStaticTableViewDemo/SJStaticTableViewDemo/SJStaticTableViewComponent/SJStaticTableViewCell+Logout.m: -------------------------------------------------------------------------------- 1 | // 2 | // SJStaticTableViewCell+Logout.m 3 | // SSJStaticTableViewDemo 4 | // 5 | // Created by Sun Shijie on 2017/3/16. 6 | // Copyright © 2017年 Shijie. All rights reserved. 7 | // 8 | 9 | #import "SJStaticTableViewCell+Logout.h" 10 | 11 | @implementation SJStaticTableViewCell (Logout) 12 | 13 | - (void)configureLogoutTableViewCellWithViewModel:(SJStaticTableviewCellViewModel *)viewModel 14 | { 15 | self.viewModel = viewModel; 16 | [self.contentView addSubview:self.logoutLabel]; 17 | } 18 | @end 19 | -------------------------------------------------------------------------------- /SJStaticTableViewDemo/SJStaticTableViewDemo/SJStaticTableViewComponent/SJStaticTableViewCell+MeAvatar.h: -------------------------------------------------------------------------------- 1 | // 2 | // SJStaticTableViewCell+MeAvatar.h 3 | // SSJStaticTableViewDemo 4 | // 5 | // Created by Sun Shijie on 2017/3/15. 6 | // Copyright © 2017年 Shijie. All rights reserved. 7 | // 8 | 9 | #import "SJStaticTableViewCell.h" 10 | 11 | @interface SJStaticTableViewCell (MeAvatar) 12 | 13 | - (void)configureMeAvatarTableViewCellWithViewModel:(SJStaticTableviewCellViewModel *)viewModel; 14 | 15 | @end 16 | -------------------------------------------------------------------------------- /SJStaticTableViewDemo/SJStaticTableViewDemo/SJStaticTableViewComponent/SJStaticTableViewCell+MeAvatar.m: -------------------------------------------------------------------------------- 1 | // 2 | // SJStaticTableViewCell+MeAvatar.m 3 | // SSJStaticTableViewDemo 4 | // 5 | // Created by Sun Shijie on 2017/3/15. 6 | // Copyright © 2017年 Shijie. All rights reserved. 7 | // 8 | 9 | #import "SJStaticTableViewCell+MeAvatar.h" 10 | 11 | @implementation SJStaticTableViewCell (MeAvatar) 12 | 13 | - (void)configureMeAvatarTableViewCellWithViewModel:(SJStaticTableviewCellViewModel *)viewModel{ 14 | 15 | self.viewModel = viewModel; 16 | 17 | [self.contentView addSubview:self.avatarImageView]; 18 | [self.contentView addSubview:self.userNameLabel]; 19 | [self.contentView addSubview:self.userIdLabel]; 20 | [self.contentView addSubview:self.avatarIndicatorImageView]; 21 | [self.contentView addSubview:self.codeImageView]; 22 | 23 | } 24 | 25 | 26 | 27 | @end 28 | -------------------------------------------------------------------------------- /SJStaticTableViewDemo/SJStaticTableViewDemo/SJStaticTableViewComponent/SJStaticTableViewCell.h: -------------------------------------------------------------------------------- 1 | // 2 | // SJStaticTableViewCell.h 3 | // SSJStaticTableViewDemo 4 | // 5 | // Created by Sun Shijie on 2017/3/15. 6 | // Copyright © 2017年 Shijie. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "SJStaticTableviewCellViewModel.h" 11 | 12 | //所有cell都是这个类的分类 13 | 14 | @interface SJStaticTableViewCell : UITableViewCell 15 | 16 | @property (nonatomic, strong) SJStaticTableviewCellViewModel *viewModel; 17 | 18 | // =============== 系统风格cell的所有控件 =============== // 19 | 20 | //左半部分 21 | @property (nonatomic, strong) UIImageView *leftImageView; //左侧的ImageView 22 | @property (nonatomic, strong) UILabel *leftTitleLabel; //左侧的Label 23 | 24 | //右半部分 25 | @property (nonatomic, strong) UIImageView *indicatorArrow; //右侧的箭头 26 | @property (nonatomic, strong) UIImageView *indicatorLeftImageView; //右侧的箭头的左边的imageview 27 | @property (nonatomic, strong) UILabel *indicatorLeftLabel; //右侧的箭头的左边的Label 28 | @property (nonatomic, strong) UISwitch *indicatorSwitch; //右侧的箭头的左边的开关 29 | @property (nonatomic, strong) UILabel *logoutLabel; //退出登录的label 30 | 31 | // =============== 用户自定义的cell里面的控件 =============== // 32 | 33 | //MeViewController里面的头像cell 34 | @property (nonatomic, strong) UIImageView *avatarImageView; 35 | @property (nonatomic, strong) UIImageView *codeImageView; 36 | @property (nonatomic, strong) UIImageView *avatarIndicatorImageView; 37 | @property (nonatomic, strong) UILabel *userNameLabel; 38 | @property (nonatomic, strong) UILabel *userIdLabel; 39 | 40 | 41 | //统一的,布局cell左侧部分的内容(标题 / 图片 + 标题),所有系统风格的cell都要调用这个方法 42 | - (void)layoutLeftPartSubViewsWithViewModel:(SJStaticTableviewCellViewModel *)viewModel; 43 | 44 | 45 | @end 46 | -------------------------------------------------------------------------------- /SJStaticTableViewDemo/SJStaticTableViewDemo/SJStaticTableViewComponent/SJStaticTableViewCell.m: -------------------------------------------------------------------------------- 1 | // 2 | // SJStaticTableViewCell.m 3 | // SSJStaticTableViewDemo 4 | // 5 | // Created by Sun Shijie on 2017/3/15. 6 | // Copyright © 2017年 Shijie. All rights reserved. 7 | // 8 | 9 | #import "SJStaticTableViewCell.h" 10 | 11 | @implementation SJStaticTableViewCell 12 | 13 | 14 | - (void)layoutLeftPartSubViewsWithViewModel:(SJStaticTableviewCellViewModel *)viewModel 15 | { 16 | self.viewModel = viewModel; 17 | 18 | //存在最左边的图片 19 | if (self.viewModel.leftImage) { 20 | 21 | [self.contentView addSubview:self.leftImageView]; 22 | 23 | self.leftImageView.image = self.viewModel.leftImage; 24 | self.leftImageView.frame = CGRectMake(SJLeftGap, (self.viewModel.cellHeight - self.viewModel.leftImageSize.height)/2, self.viewModel.leftImageSize.width , self.viewModel.leftImageSize.height); 25 | } 26 | 27 | 28 | //存在标题文字 29 | if (self.viewModel.leftTitle.length) { 30 | 31 | [self.contentView addSubview:self.leftTitleLabel]; 32 | 33 | self.leftTitleLabel.font = self.viewModel.leftLabelTextFont; 34 | self.leftTitleLabel.textColor = self.viewModel.leftLabelTextColor; 35 | self.leftTitleLabel.text = self.viewModel.leftTitle; 36 | 37 | CGFloat x = 0; 38 | if (_leftImageView) { 39 | x = CGRectGetMaxX(self.leftImageView.frame) + self.viewModel.leftImageAndLabelGap; 40 | }else{ 41 | x = SJLeftGap; 42 | } 43 | 44 | self.leftTitleLabel.frame = CGRectMake( x, (self.viewModel.cellHeight - self.viewModel.leftTitleLabelSize.height)/2, self.viewModel.leftTitleLabelSize.width, self.viewModel.leftTitleLabelSize.height); 45 | } 46 | 47 | } 48 | 49 | 50 | 51 | #pragma mark- switch block 52 | - (void)switchTouched:(UISwitch *)indicatorSwitch 53 | { 54 | if (self.viewModel.switchValueDidChangeBlock){ 55 | self.viewModel.switchValueDidChangeBlock(indicatorSwitch.isOn); 56 | } 57 | } 58 | 59 | 60 | #pragma mark- system-like cell 61 | #pragma mark basic views 62 | - (UIImageView *)leftImageView 63 | { 64 | if (!_leftImageView) { 65 | _leftImageView = [[UIImageView alloc] init]; 66 | } 67 | return _leftImageView; 68 | } 69 | 70 | - (UILabel *)leftTitleLabel 71 | { 72 | if (!_leftTitleLabel) { 73 | _leftTitleLabel= [[UILabel alloc] init]; 74 | } 75 | return _leftTitleLabel; 76 | } 77 | 78 | 79 | - (UISwitch *)indicatorSwitch 80 | { 81 | if (!_indicatorSwitch) { 82 | _indicatorSwitch = [[UISwitch alloc] init]; 83 | _indicatorSwitch.frame = CGRectMake(SJScreenWidth - SJLeftGap - _indicatorSwitch.bounds.size.width, (_viewModel.cellHeight - _indicatorSwitch.bounds.size.height)/2, _indicatorSwitch.bounds.size.width, _indicatorSwitch.bounds.size.height); 84 | [_indicatorSwitch addTarget:self action:@selector(switchTouched:) forControlEvents:UIControlEventValueChanged]; 85 | 86 | } 87 | return _indicatorSwitch; 88 | } 89 | 90 | - (UIImageView *)indicatorArrow 91 | { 92 | if (!_indicatorArrow) { 93 | _indicatorArrow = [[UIImageView alloc] initWithImage:[UIImage imageNamed:SJIndicatorArrow]]; 94 | _indicatorArrow.frame = CGRectMake(SJScreenWidth - SJLeftGap - _indicatorArrow.bounds.size.width, (_viewModel.cellHeight - _indicatorArrow.bounds.size.height)/2, _indicatorArrow.bounds.size.width, _indicatorArrow.bounds.size.height); 95 | } 96 | return _indicatorArrow; 97 | } 98 | 99 | - (UILabel *)indicatorLeftLabel 100 | { 101 | if (!_indicatorLeftLabel) { 102 | _indicatorLeftLabel= [[UILabel alloc] init]; 103 | } 104 | return _indicatorLeftLabel; 105 | } 106 | 107 | - (UIImageView *)indicatorLeftImageView 108 | { 109 | if (!_indicatorLeftImageView) { 110 | _indicatorLeftImageView = [[UIImageView alloc] init]; 111 | } 112 | return _indicatorLeftImageView; 113 | } 114 | 115 | 116 | 117 | #pragma mark logout cell 118 | - (UILabel *)logoutLabel 119 | { 120 | if (!_logoutLabel) { 121 | _logoutLabel = [[UILabel alloc] init]; 122 | _logoutLabel.frame = CGRectMake(0, 0, SJScreenWidth, _viewModel.cellHeight); 123 | _logoutLabel.text = @"退出登录"; 124 | _logoutLabel.textAlignment = NSTextAlignmentCenter; 125 | _logoutLabel.textColor = [UIColor blackColor]; 126 | _logoutLabel.font = SJLogoutButtonFont; 127 | } 128 | return _logoutLabel; 129 | } 130 | 131 | 132 | #pragma mark- custom cell 133 | #pragma mark MeController Avatar Cell 134 | - (UIImageView *)avatarImageView 135 | { 136 | if (!_avatarImageView) { 137 | _avatarImageView = [[UIImageView alloc] initWithImage:self.viewModel.avatarImage]; 138 | _avatarImageView.frame = CGRectMake(SJLeftGap, SJLeftGap, self.viewModel.cellHeight - 2*SJLeftGap, self.viewModel.cellHeight - 2*SJLeftGap); 139 | 140 | } 141 | return _avatarImageView; 142 | } 143 | 144 | - (UILabel *)userNameLabel 145 | { 146 | if (!_userNameLabel) { 147 | _userNameLabel = [[UILabel alloc] init]; 148 | _userNameLabel.text = self.viewModel.userName; 149 | _userNameLabel.font = SJLeftTitleTextFont; 150 | _userNameLabel.textColor = [UIColor blackColor]; 151 | _userNameLabel.frame = CGRectMake(CGRectGetMaxX(_avatarImageView.frame) + SJLeftGap, self.avatarImageView.frame.origin.y + SJLeftGap/2, 150, 20); 152 | 153 | } 154 | return _userNameLabel; 155 | } 156 | 157 | 158 | - (UILabel *)userIdLabel 159 | { 160 | if (!_userIdLabel) { 161 | _userIdLabel = [[UILabel alloc] init]; 162 | _userIdLabel.text = self.viewModel.userID; 163 | _userIdLabel.font = [UIFont systemFontOfSize:12]; 164 | _userIdLabel.textColor = [UIColor blackColor]; 165 | _userIdLabel.frame = CGRectMake(CGRectGetMaxX(_avatarImageView.frame) + SJLeftGap, CGRectGetMaxY(self.userNameLabel.frame) + 4, 150, 20); 166 | } 167 | return _userIdLabel; 168 | } 169 | 170 | - (UIImageView *)avatarIndicatorImageView 171 | { 172 | if (!_avatarIndicatorImageView) { 173 | _avatarIndicatorImageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"arrow"]]; 174 | _avatarIndicatorImageView.frame = CGRectMake(SJScreenWidth - SJLeftGap - _avatarIndicatorImageView.bounds.size.width, (_viewModel.cellHeight - _avatarIndicatorImageView.bounds.size.height)/2, _avatarIndicatorImageView.bounds.size.width, _avatarIndicatorImageView.bounds.size.height); 175 | } 176 | 177 | return _avatarIndicatorImageView; 178 | } 179 | 180 | - (UIImageView *)codeImageView 181 | { 182 | if (!_codeImageView) { 183 | _codeImageView = [[UIImageView alloc] initWithImage:self.viewModel.codeImage]; 184 | _codeImageView.frame = CGRectMake(SJScreenWidth - SJLeftGap - _avatarIndicatorImageView.bounds.size.width - SJLeftGap - 20, (self.viewModel.cellHeight - 20)/2, 20, 20); 185 | } 186 | return _codeImageView; 187 | } 188 | 189 | 190 | 191 | @end 192 | -------------------------------------------------------------------------------- /SJStaticTableViewDemo/SJStaticTableViewDemo/SJStaticTableViewComponent/SJStaticTableViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // SJStaticTableViewController.h 3 | // SSJStaticTableViewDemo 4 | // 5 | // Created by Sun Shijie on 2017/3/15. 6 | // Copyright © 2017年 Shijie. All rights reserved. 7 | // 8 | 9 | 10 | #import "SJStaticTableViewHeader.h" 11 | #import "Factory.h"//假数据 12 | 13 | 14 | @protocol SJStaticTableViewControllerDelegate 15 | 16 | @required 17 | - (void)createDataSource; 18 | @end 19 | 20 | typedef enum : NSUInteger { 21 | 22 | SJDefaultDataTypeExist, //可以生成默认数据源(1. 完全不依赖网络请求,有现成的数据 2. 先生成默认数据源,然后通过网络请求来刷新表格) 23 | SJDefaultDataTypeNone, //无法生成默认数据源,完全依赖网络请求,拿到数据后,生成表格 24 | 25 | }SJDefaultDataType; 26 | 27 | 28 | @interface SJStaticTableViewController : UIViewController 29 | 30 | @property (nonatomic, readwrite, strong) SJStaticTableView *tableView; 31 | @property (nonatomic, readwrite, strong) SJStaticTableViewDataSource *dataSource; 32 | @property (nonatomic, readonly, assign) SJDefaultDataType defualtDataType; 33 | 34 | - (instancetype)initWithDefaultDataType:(SJDefaultDataType)defualtDataType; 35 | - (void)configureTableView; 36 | 37 | @end 38 | -------------------------------------------------------------------------------- /SJStaticTableViewDemo/SJStaticTableViewDemo/SJStaticTableViewComponent/SJStaticTableViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // SJStaticTableViewController.m 3 | // SSJStaticTableViewDemo 4 | // 5 | // Created by Sun Shijie on 2017/3/15. 6 | // Copyright © 2017年 Shijie. All rights reserved. 7 | // 8 | 9 | #import "SJStaticTableViewController.h" 10 | #import "SJStaticTableViewDataSource.h" 11 | 12 | @interface SJStaticTableViewController() 13 | 14 | @property (nonatomic, readwrite, assign) SJDefaultDataType defualtDataType; 15 | 16 | @end 17 | 18 | 19 | @implementation SJStaticTableViewController 20 | 21 | #pragma mark- init 22 | 23 | - (instancetype)initWithDefaultDataType:(SJDefaultDataType)defualtDataType 24 | { 25 | self = [super init]; 26 | if (self) { 27 | self.defualtDataType = defualtDataType; 28 | } 29 | return self; 30 | } 31 | 32 | - (instancetype)init 33 | { 34 | self = [self initWithDefaultDataType:SJDefaultDataTypeExist]; 35 | return self; 36 | } 37 | 38 | #pragma mark- life circle 39 | - (void)viewDidLoad { 40 | 41 | [super viewDidLoad]; 42 | [self configureNav]; 43 | 44 | //在能够提供给tableivew全部,或者部分数据源的情况下,可以先构造出tableview; 45 | //否则,需要在网络请求结束后,手动调用configureTableView方法 46 | if (self.defualtDataType == SJDefaultDataTypeExist) { 47 | [self configureTableView]; 48 | } 49 | 50 | } 51 | 52 | #pragma mark- configure subviews 53 | - (void)configureNav 54 | { 55 | self.automaticallyAdjustsScrollViewInsets = NO; 56 | //修改导航条背景色 57 | self.navigationController.navigationBar.barTintColor = SJColorWithRGB(18, 18, 18, 1.0); 58 | 59 | //修改导航条标题颜色 60 | [self.navigationController.navigationBar setTitleTextAttributes:[NSDictionary dictionaryWithObjectsAndKeys:[UIColor whiteColor],NSForegroundColorAttributeName,nil]]; 61 | 62 | //修改导航条添加的按钮 63 | self.navigationController.navigationBar.tintColor = [UIColor whiteColor]; 64 | } 65 | 66 | - (void)configureTableView 67 | { 68 | [self createDataSource]; 69 | [self createTableView]; 70 | } 71 | 72 | 73 | - (void)createDataSource 74 | { 75 | //交给子类实现 76 | 77 | } 78 | 79 | - (void)createTableView { 80 | 81 | if (!self.tableView) { 82 | self.tableView = [[SJStaticTableView alloc] initWithFrame:CGRectMake(0, 0, SJScreenWidth, SJScreenHeight) style:UITableViewStyleGrouped]; 83 | self.tableView.contentInset = UIEdgeInsetsMake(44,0,0,0); 84 | self.tableView.sjDelegate = self; 85 | self.tableView.sjDataSource = self.dataSource; 86 | [self.view addSubview:self.tableView]; 87 | } 88 | } 89 | 90 | 91 | 92 | @end 93 | -------------------------------------------------------------------------------- /SJStaticTableViewDemo/SJStaticTableViewDemo/SJStaticTableViewComponent/SJStaticTableViewDataSource.h: -------------------------------------------------------------------------------- 1 | // 2 | // SJStaticTableViewDataSource.h 3 | // SSJStaticTableViewDemo 4 | // 5 | // Created by Sun Shijie on 2017/3/15. 6 | // Copyright © 2017年 Shijie. All rights reserved. 7 | // 8 | 9 | #import 10 | #import 11 | 12 | 13 | @class SJStaticTableViewCell; 14 | @class SJStaticTableviewCellViewModel; 15 | @class SJStaticTableviewSectionViewModel; 16 | 17 | @protocol SJStaticTableViewDataSource 18 | 19 | @optional 20 | 21 | - (SJStaticTableviewSectionViewModel *)tableView:(UITableView *)tableView sectionViewModelInSection:(NSInteger )section; 22 | - (SJStaticTableviewCellViewModel *)tableView:(UITableView *)tableview cellViewModelAtIndexPath:(NSIndexPath *)indexPath; 23 | 24 | @end 25 | 26 | 27 | typedef void(^SJStaticCellConfigureBlock)(SJStaticTableViewCell *cell, SJStaticTableviewCellViewModel * viewModel); 28 | 29 | 30 | @interface SJStaticTableViewDataSource : NSObject 31 | 32 | @property (nonatomic, strong) NSArray *viewModelsArray; 33 | 34 | - (instancetype)initWithViewModelsArray:(NSArray *)viewModelsArray configureBlock:(SJStaticCellConfigureBlock)block; 35 | 36 | @end 37 | -------------------------------------------------------------------------------- /SJStaticTableViewDemo/SJStaticTableViewDemo/SJStaticTableViewComponent/SJStaticTableViewDataSource.m: -------------------------------------------------------------------------------- 1 | // 2 | // SJStaticTableViewDataSource.m 3 | // SSJStaticTableViewDemo 4 | // 5 | // Created by Sun Shijie on 2017/3/15. 6 | // Copyright © 2017年 Shijie. All rights reserved. 7 | // 8 | 9 | #import "SJStaticTableViewDataSource.h" 10 | #import "SJStaticTableviewCellViewModel.h" 11 | #import "SJStaticTableviewSectionViewModel.h" 12 | #import "SJStaticTableViewCell.h" 13 | 14 | @interface SJStaticTableViewDataSource() 15 | 16 | @property (nonatomic, copy) SJStaticCellConfigureBlock cellConfigureBlock; 17 | 18 | @end 19 | 20 | 21 | @implementation SJStaticTableViewDataSource 22 | 23 | #pragma mark- Public API 24 | 25 | - (instancetype)initWithViewModelsArray:(NSArray *)viewModelsArray configureBlock:(SJStaticCellConfigureBlock)block 26 | { 27 | self = [super init]; 28 | if (self) { 29 | self.viewModelsArray = viewModelsArray; 30 | self.cellConfigureBlock = [block copy]; 31 | } 32 | return self; 33 | } 34 | 35 | #pragma mark- SJStaticTableViewDataSource 36 | - (SJStaticTableviewCellViewModel *)tableView:(UITableView *)tableview cellViewModelAtIndexPath:(NSIndexPath *)indexPath 37 | { 38 | if (self.viewModelsArray.count > indexPath.section) { 39 | SJStaticTableviewSectionViewModel *sectionViewModel = [self.viewModelsArray objectAtIndex:indexPath.section]; 40 | if (sectionViewModel.cellViewModelsArray.count > indexPath.row) { 41 | return [sectionViewModel.cellViewModelsArray objectAtIndex:indexPath.row]; 42 | } 43 | } 44 | return nil; 45 | } 46 | 47 | - (SJStaticTableviewSectionViewModel *)tableView:(UITableView *)tableView sectionViewModelInSection:(NSInteger )section 48 | { 49 | if (self.viewModelsArray.count > section) { 50 | return [self.viewModelsArray objectAtIndex:section]; 51 | } 52 | return nil; 53 | } 54 | 55 | #pragma mark - Tableview Datasource 56 | 57 | - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView 58 | { 59 | return self.viewModelsArray.count; 60 | } 61 | 62 | - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section 63 | { 64 | SJStaticTableviewSectionViewModel *vm = self.viewModelsArray[section]; 65 | return vm.cellViewModelsArray.count; 66 | } 67 | 68 | - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath 69 | { 70 | 71 | SJStaticTableviewSectionViewModel *sectionViewModel = self.viewModelsArray[indexPath.section]; 72 | SJStaticTableviewCellViewModel *cellViewModel = sectionViewModel.cellViewModelsArray[indexPath.row]; 73 | 74 | SJStaticTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:cellViewModel.cellID]; 75 | if (!cell) { 76 | cell = [[SJStaticTableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellViewModel.cellID]; 77 | } 78 | self.cellConfigureBlock(cell,cellViewModel); 79 | 80 | return cell; 81 | 82 | } 83 | 84 | - (NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section{ 85 | SJStaticTableviewSectionViewModel *vm = self.viewModelsArray[section]; 86 | return vm.sectionHeaderTitle; 87 | 88 | } 89 | 90 | - (NSString *)tableView:(UITableView *)tableView titleForFooterInSection:(NSInteger)section 91 | { 92 | SJStaticTableviewSectionViewModel *vm = self.viewModelsArray[section]; 93 | return vm.sectionFooterTitle; 94 | } 95 | 96 | @end 97 | -------------------------------------------------------------------------------- /SJStaticTableViewDemo/SJStaticTableViewDemo/SJStaticTableViewComponent/SJStaticTableViewHeader.h: -------------------------------------------------------------------------------- 1 | // 2 | // SJStaticTableViewHeader.h 3 | // SSJStaticTableViewDemo 4 | // 5 | // Created by Sun Shijie on 2017/3/19. 6 | // Copyright © 2017年 Shijie. All rights reserved. 7 | // 8 | 9 | #import 10 | #import 11 | 12 | #import "SJConst.h" //基本配置 13 | 14 | #import "SJStaticTableViewController.h" //封装好的根类控制器,持有SJStaticTableView 15 | #import "SJStaticTableView.h" //封装好的表格视图 16 | #import "SJStaticTableViewDataSource.h" //封装好的数据源 17 | 18 | #import "SJStaticTableviewCellViewModel.h" //cell对应的viewModel 19 | #import "SJStaticTableviewSectionViewModel.h" //section对应的viewModel 20 | 21 | #import "SJStaticTableViewCell.h" //所有cell的根类 22 | #import "SJStaticTableViewCell+Logout.h" //退出登录cell 23 | #import "SJStaticTableViewCell+AccessoryNone.h" //右侧没有控件的cell 24 | #import "SJStaticTableViewCell+AccessorySwitch.h" //右侧有开关的cell 25 | #import "SJStaticTableViewCell+AccessoryDisclosureIndicator.h" //右侧有剪头的cell 26 | 27 | 28 | -------------------------------------------------------------------------------- /SJStaticTableViewDemo/SJStaticTableViewDemo/SJStaticTableViewComponent/SJStaticTableviewCellViewModel.h: -------------------------------------------------------------------------------- 1 | // 2 | // SJStaticTableviewCellViewModel.h 3 | // SSJStaticTableViewDemo 4 | // 5 | // Created by Sun Shijie on 2017/3/14. 6 | // Copyright © 2017年 Shijie. All rights reserved. 7 | // 8 | 9 | #import 10 | #import 11 | #import "SJConst.h" 12 | 13 | typedef NS_ENUM(NSInteger, SJStaticCellType) { 14 | 15 | //系统风格的各种cell类型,已封装好,可以直接用 16 | SJStaticCellTypeSystemLogout, //退出登录cell(已封装好) 17 | SJStaticCellTypeSystemAccessoryNone, //右侧没有任何控件 18 | SJStaticCellTypeSystemAccessorySwitch, //右侧是开关 19 | SJStaticCellTypeSystemAccessoryDisclosureIndicator, //右侧是三角箭头(箭头左侧可以有一个image或者一个label,或者二者都有,根据传入的参数决定) 20 | 21 | //需要用户自己添加的自定义cell类型 22 | SJStaticCellTypeMeAvatar, //个人页“我”cell 23 | 24 | }; 25 | 26 | 27 | typedef void(^SwitchValueChagedBlock)(BOOL isOn); //switch开关切换时调用的block 28 | 29 | 30 | @interface SJStaticTableviewCellViewModel : NSObject 31 | 32 | @property (nonatomic, assign) SJStaticCellType staticCellType; //类型 33 | 34 | 35 | @property (nonatomic, copy) NSString *cellID; //cell reuser identifier 36 | @property (nonatomic, assign) NSInteger identifier; //区别每个cell,用于点击 37 | 38 | // =============== 系统默认cell左侧 =============== // 39 | @property (nonatomic, strong) UIImage *leftImage; //左侧的image,按需传入 40 | @property (nonatomic, assign) CGSize leftImageSize; //左侧image的大小,存在默认设置 41 | 42 | @property (nonatomic, copy) NSString *leftTitle; //cell主标题,按需传入 43 | @property (nonatomic, strong) UIColor *leftLabelTextColor; //当前组cell左侧label里文字的颜色 44 | @property (nonatomic, strong) UIFont *leftLabelTextFont; //当前组cell左侧label里文字的字体 45 | 46 | @property (nonatomic, assign) CGFloat leftImageAndLabelGap; //左侧image和label的距离,存在默认值 47 | 48 | 49 | // =============== 系统默认cell右侧 =============== // 50 | @property (nonatomic, copy) NSString *indicatorLeftTitle; //右侧箭头左侧的文本,按需传入 51 | @property (nonatomic, strong) UIColor *indicatorLeftLabelTextColor; //右侧文字的颜色,存在默认设置,也可以自定义 52 | @property (nonatomic, strong) UIFont *indicatorLeftLabelTextFont; //右侧文字的字体,存在默认设置,也可以自定义 53 | @property (nonatomic, strong) UIImage *indicatorLeftImage; //右侧箭头左侧的image,按需传入 54 | @property (nonatomic, assign) CGSize indicatorLeftImageSize; //右侧尖头左侧image大小,存在默认设置,也可以自定义 55 | 56 | @property (nonatomic, assign, readonly) BOOL hasIndicatorImageAndLabel; //右侧尖头左侧的文本和image是否同时存在,只能通过内部计算 57 | 58 | @property (nonatomic, assign) CGFloat indicatorLeftImageAndLabelGap; //右侧尖头左侧image和label的距离,存在默认值 59 | @property (nonatomic, assign) BOOL isImageFirst; //右侧尖头左侧的文本和image同时存在时,是否是image挨着箭头,默认为YES 60 | @property (nonatomic, copy) SwitchValueChagedBlock switchValueDidChangeBlock; //切换switch开关的时候调用的block 61 | 62 | 63 | // =============== 长宽数据 =============== // 64 | @property (nonatomic, assign) CGFloat cellHeight; //cell高度,默认是44,可以设置 65 | @property (nonatomic, assign) CGSize leftTitleLabelSize; //左侧默认Label的size,传入text以后内部计算 66 | @property (nonatomic, assign) CGSize indicatorLeftLabelSize; //右侧label的size 67 | 68 | 69 | // =============== 自定义cell的数据放在这里 =============== // 70 | @property (nonatomic, strong) UIImage *avatarImage; 71 | @property (nonatomic, strong) UIImage *codeImage; 72 | @property (nonatomic, copy) NSString *userName; 73 | @property (nonatomic, copy) NSString *userID; 74 | 75 | 76 | 77 | @end 78 | -------------------------------------------------------------------------------- /SJStaticTableViewDemo/SJStaticTableViewDemo/SJStaticTableViewComponent/SJStaticTableviewCellViewModel.m: -------------------------------------------------------------------------------- 1 | // 2 | // SJStaticTableviewCellViewModel.m 3 | // SSJStaticTableViewDemo 4 | // 5 | // Created by Sun Shijie on 2017/3/14. 6 | // Copyright © 2017年 Shijie. All rights reserved. 7 | // 8 | 9 | #import "SJStaticTableviewCellViewModel.h" 10 | 11 | 12 | @interface SJStaticTableviewCellViewModel() 13 | 14 | @property (nonatomic, assign, readwrite) BOOL hasIndicatorImageAndLabel; //右侧尖头左侧的文本和image是否同时存在 15 | @property (nonatomic, assign, readwrite) CGFloat indicatorLeftImgWidth; //右侧图片宽度 16 | @property (nonatomic, assign, readwrite) CGFloat indicatorLeftImgHeight; //右侧图片高度 17 | 18 | @end 19 | 20 | 21 | @implementation SJStaticTableviewCellViewModel 22 | 23 | - (instancetype)init 24 | { 25 | self = [super init]; 26 | if (self) { 27 | _cellHeight = 44; 28 | _cellID = @"defaultCell"; 29 | _staticCellType = SJStaticCellTypeSystemAccessoryDisclosureIndicator;//默认是存在三角箭头的cell 30 | _isImageFirst = YES; 31 | 32 | //都是默认配置 33 | _leftLabelTextFont = SJLeftTitleTextFont; 34 | _leftLabelTextColor = SJLeftTitleTextColor; 35 | _leftImageSize = CGSizeMake(SJImgWidth, SJImgWidth); 36 | _leftImageAndLabelGap = SJLeftMiddleGap; 37 | _indicatorLeftLabelTextFont = SJIndicatorLeftTitleTextFont; 38 | _indicatorLeftLabelTextColor = SJIndicatorLeftTitleTextColor; 39 | _indicatorLeftImageSize = CGSizeMake(SJImgWidth, SJImgWidth); 40 | _indicatorLeftImageAndLabelGap = SJRightMiddleGap; 41 | } 42 | return self; 43 | } 44 | 45 | 46 | - (void)setLeftTitle:(NSString *)leftTitle 47 | { 48 | if (_leftTitle != leftTitle) { 49 | 50 | _leftTitle = leftTitle; 51 | _leftTitleLabelSize = [self sizeForTitle:leftTitle withFont:_leftLabelTextFont]; 52 | 53 | //very long title 54 | if (_leftTitleLabelSize.width > SJTitleWidthLimit) { 55 | CGSize size = _leftTitleLabelSize; 56 | size.width = SJTitleWidthLimit; 57 | _leftTitleLabelSize = size; 58 | } 59 | 60 | } 61 | } 62 | 63 | - (void)setLeftLabelTextFont:(UIFont *)leftLabelTextFont 64 | { 65 | if (_leftLabelTextFont != leftLabelTextFont) { 66 | 67 | if (![self font1:_leftLabelTextFont hasSameFontSizeOfFont2:leftLabelTextFont]) { 68 | //如果新的宽度大于原来的宽度,需要重新设置,否则不需要 69 | _leftLabelTextFont = leftLabelTextFont; 70 | CGSize size = [self sizeForTitle:self.leftTitle withFont:leftLabelTextFont]; 71 | if (size.width > self.leftTitleLabelSize.width) { 72 | self.leftTitleLabelSize = size; 73 | } 74 | } 75 | } 76 | } 77 | 78 | - (void)setIndicatorLeftTitle:(NSString *)indicatorLeftTitle 79 | { 80 | if (_indicatorLeftTitle != indicatorLeftTitle) { 81 | 82 | _indicatorLeftTitle = indicatorLeftTitle; 83 | _indicatorLeftLabelSize = [self sizeForTitle:_indicatorLeftTitle withFont:_indicatorLeftLabelTextFont]; 84 | 85 | //very long title 86 | if (_indicatorLeftLabelSize.width > SJTitleWidthLimit) { 87 | CGSize size = _indicatorLeftLabelSize; 88 | size.width = SJTitleWidthLimit; 89 | _indicatorLeftLabelSize = size; 90 | } 91 | 92 | if (_indicatorLeftImage) { 93 | _hasIndicatorImageAndLabel = YES; 94 | } 95 | } 96 | } 97 | 98 | 99 | - (void)setIndicatorLeftImage:(UIImage *)indicatorLeftImage 100 | { 101 | if (_indicatorLeftImage != indicatorLeftImage) { 102 | 103 | _indicatorLeftImage = indicatorLeftImage; 104 | 105 | CGFloat limitHeight = self.cellHeight - 2*SJTopGap; 106 | CGFloat indicatorLeftImageWidth = 0.0f; 107 | CGFloat indicatorLeftImageHeight = 0.0f; 108 | 109 | if (_indicatorLeftImage.size.height < limitHeight) { 110 | indicatorLeftImageHeight = _indicatorLeftImage.size.height; 111 | indicatorLeftImageWidth = _indicatorLeftImage.size.width; 112 | 113 | }else{ 114 | // image with very large height 115 | indicatorLeftImageHeight = limitHeight; 116 | indicatorLeftImageWidth = (_indicatorLeftImage.size.width / _indicatorLeftImage.size.height) * indicatorLeftImageHeight ; 117 | } 118 | 119 | _indicatorLeftImageSize = CGSizeMake(indicatorLeftImageWidth, indicatorLeftImageHeight); 120 | 121 | if (_indicatorLeftTitle) { 122 | _hasIndicatorImageAndLabel = YES; 123 | } 124 | 125 | } 126 | } 127 | 128 | 129 | - (void)setIndicatorLeftLabelTextFont:(UIFont *)indicatorLeftLabelTextFont 130 | { 131 | if (_indicatorLeftLabelTextFont != indicatorLeftLabelTextFont) { 132 | 133 | if (![self font1:_indicatorLeftLabelTextFont hasSameFontSizeOfFont2:indicatorLeftLabelTextFont]) { 134 | 135 | //如果新的宽度大于原来的宽度,需要重新设置,否则不需要 136 | _indicatorLeftLabelTextFont = indicatorLeftLabelTextFont; 137 | CGSize size = [self sizeForTitle:self.indicatorLeftTitle withFont:indicatorLeftLabelTextFont]; 138 | if (size.width > self.indicatorLeftLabelSize.width) { 139 | self.indicatorLeftLabelSize = size; 140 | } 141 | } 142 | 143 | } 144 | } 145 | 146 | 147 | 148 | - (CGSize)sizeForTitle:(NSString *)title withFont:(UIFont *)font 149 | { 150 | CGRect titleRect = [title boundingRectWithSize:CGSizeMake(FLT_MAX, FLT_MAX) 151 | options:NSStringDrawingUsesLineFragmentOrigin 152 | attributes:@{NSFontAttributeName : font} 153 | context:nil]; 154 | 155 | return CGSizeMake(titleRect.size.width, 156 | titleRect.size.height); 157 | } 158 | 159 | //判断字体大小是否一致 160 | - (BOOL)font1:(UIFont *)font1 hasSameFontSizeOfFont2:(UIFont *)font2 161 | { 162 | BOOL res = NO; 163 | UIFontDescriptor *font1Des = font1.fontDescriptor; 164 | NSNumber *font1Number = [font1Des objectForKey:@"NSFontSizeAttribute"]; 165 | 166 | UIFontDescriptor *font2Des = font2.fontDescriptor; 167 | NSNumber *font2Number = [font2Des objectForKey:@"NSFontSizeAttribute"]; 168 | 169 | if ([font1Number integerValue] == [font2Number integerValue]) { 170 | res = YES; 171 | } 172 | 173 | return res; 174 | } 175 | 176 | @end 177 | 178 | -------------------------------------------------------------------------------- /SJStaticTableViewDemo/SJStaticTableViewDemo/SJStaticTableViewComponent/SJStaticTableviewSectionViewModel.h: -------------------------------------------------------------------------------- 1 | // 2 | // SJStaticTableviewSectionViewModel.h 3 | // SSJStaticTableViewDemo 4 | // 5 | // Created by Sun Shijie on 2017/3/14. 6 | // Copyright © 2017年 Shijie. All rights reserved. 7 | // 8 | 9 | #import 10 | #import 11 | 12 | @interface SJStaticTableviewSectionViewModel : NSObject 13 | 14 | @property (nonatomic, copy) NSString *sectionHeaderTitle; //该section的标题 15 | @property (nonatomic, copy) NSString *sectionFooterTitle; //该section的标题 16 | @property (nonatomic, strong) NSMutableArray *cellViewModelsArray; //该section的数据源 17 | 18 | @property (nonatomic, assign) CGFloat sectionHeaderHeight; //header的高度 19 | @property (nonatomic, assign) CGFloat sectionFooterHeight; //footer的高度 20 | 21 | @property (nonatomic, assign) CGSize leftImageSize; //当前组cell左侧image的大小 22 | @property (nonatomic, strong) UIColor *leftLabelTextColor; //当前组cell左侧label里文字的颜色 23 | @property (nonatomic, strong) UIFont *leftLabelTextFont; //当前组cell左侧label里文字的字体 24 | @property (nonatomic, assign) CGFloat leftImageAndLabelGap; //当前组左侧image和label的距离,存在默认值 25 | 26 | @property (nonatomic, strong) UIColor *indicatorLeftLabelTextColor; //当前组cell右侧label里文字的颜色 27 | @property (nonatomic, strong) UIFont *indicatorLeftLabelTextFont; //当前组cell右侧label里文字的字体 28 | @property (nonatomic, assign) CGSize indicatorLeftImageSize; //当前组cell右侧image的大小 29 | @property (nonatomic, assign) CGFloat indicatorLeftImageAndLabelGap;//当前组cell右侧image和label的距离,存在默认值 30 | 31 | 32 | - (instancetype)initWithCellViewModelsArray:(NSArray *)cellViewModelsArray; 33 | 34 | @end 35 | -------------------------------------------------------------------------------- /SJStaticTableViewDemo/SJStaticTableViewDemo/SJStaticTableViewComponent/SJStaticTableviewSectionViewModel.m: -------------------------------------------------------------------------------- 1 | // 2 | // SJStaticTableviewSectionViewModel.m 3 | // SSJStaticTableViewDemo 4 | // 5 | // Created by Sun Shijie on 2017/3/14. 6 | // Copyright © 2017年 Shijie. All rights reserved. 7 | // 8 | 9 | #import "SJStaticTableviewSectionViewModel.h" 10 | #import "SJConst.h" 11 | #import "SJStaticTableviewCellViewModel.h" 12 | 13 | @implementation SJStaticTableviewSectionViewModel 14 | 15 | - (instancetype)initWithCellViewModelsArray:(NSArray *)cellViewModelsArray 16 | { 17 | self = [super init]; 18 | if (self) { 19 | _sectionHeaderHeight = 10; 20 | _sectionFooterHeight = 10; 21 | _leftLabelTextFont = SJLeftTitleTextFont; 22 | _leftLabelTextColor = SJLeftTitleTextColor; 23 | _leftImageSize = CGSizeMake(SJImgWidth, SJImgWidth); 24 | _leftImageAndLabelGap = SJLeftMiddleGap; 25 | _indicatorLeftLabelTextFont = SJIndicatorLeftTitleTextFont; 26 | _indicatorLeftLabelTextColor = SJIndicatorLeftTitleTextColor; 27 | _indicatorLeftImageSize = CGSizeMake(SJImgWidth, SJImgWidth); 28 | _indicatorLeftImageAndLabelGap = SJRightMiddleGap; 29 | _cellViewModelsArray = [cellViewModelsArray mutableCopy]; 30 | } 31 | return self; 32 | } 33 | 34 | - (void)setLeftLabelTextFont:(UIFont *)leftLabelTextFont 35 | { 36 | if (_leftLabelTextFont != leftLabelTextFont) { 37 | 38 | if (![self font1:_leftLabelTextFont hasSameFontSizeOfFont2:leftLabelTextFont]) { 39 | 40 | _leftLabelTextFont = leftLabelTextFont; 41 | 42 | //如果新的宽度大于原来的宽度,需要重新设置,否则不需要 43 | [_cellViewModelsArray enumerateObjectsUsingBlock:^(SJStaticTableviewCellViewModel * viewModel, NSUInteger idx, BOOL * _Nonnull stop) { 44 | viewModel.leftLabelTextFont = _leftLabelTextFont; 45 | CGSize size = [self sizeForTitle:viewModel.leftTitle withFont:_leftLabelTextFont]; 46 | if (size.width > viewModel.leftTitleLabelSize.width) { 47 | viewModel.leftTitleLabelSize = size; 48 | } 49 | }]; 50 | 51 | } 52 | } 53 | } 54 | 55 | - (void)setLeftLabelTextColor:(UIColor *)leftLabelTextColor 56 | { 57 | if (![self color1:_leftLabelTextColor hasTheSameRGBAOfColor2:leftLabelTextColor]) { 58 | _leftLabelTextColor = leftLabelTextColor; 59 | [_cellViewModelsArray makeObjectsPerformSelector:@selector(setLeftLabelTextColor:) withObject:_leftLabelTextColor]; 60 | } 61 | } 62 | 63 | - (void)setLeftImageSize:(CGSize)leftImageSize 64 | { 65 | SJStaticTableviewCellViewModel *viewMoel = _cellViewModelsArray.firstObject; 66 | 67 | CGFloat cellHeight = viewMoel.cellHeight; 68 | if ( (!CGSizeEqualToSize(_leftImageSize, leftImageSize)) && (leftImageSize.height < cellHeight)) { 69 | _leftImageSize = leftImageSize; 70 | [_cellViewModelsArray enumerateObjectsUsingBlock:^(SJStaticTableviewCellViewModel *viewModel, NSUInteger idx, BOOL * _Nonnull stop) 71 | { 72 | viewMoel.leftImageSize = _leftImageSize; 73 | }]; 74 | } 75 | } 76 | 77 | - (void)setLeftImageAndLabelGap:(CGFloat)leftImageAndLabelGap 78 | { 79 | if (_leftImageAndLabelGap != leftImageAndLabelGap) { 80 | _leftImageAndLabelGap = leftImageAndLabelGap; 81 | [_cellViewModelsArray enumerateObjectsUsingBlock:^(SJStaticTableviewCellViewModel * viewModel, NSUInteger idx, BOOL * _Nonnull stop) { 82 | viewModel.leftImageAndLabelGap = _leftImageAndLabelGap; 83 | }]; 84 | } 85 | } 86 | 87 | - (void)setIndicatorLeftLabelTextFont:(UIFont *)indicatorLeftLabelTextFont 88 | { 89 | if (_indicatorLeftLabelTextFont != indicatorLeftLabelTextFont) { 90 | 91 | if (![self font1:_indicatorLeftLabelTextFont hasSameFontSizeOfFont2:indicatorLeftLabelTextFont]) { 92 | _indicatorLeftLabelTextFont = indicatorLeftLabelTextFont; 93 | 94 | //如果新的宽度大于原来的宽度,需要重新设置,否则不需要 95 | [_cellViewModelsArray enumerateObjectsUsingBlock:^(SJStaticTableviewCellViewModel * viewModel, NSUInteger idx, BOOL * _Nonnull stop) { 96 | viewModel.indicatorLeftLabelTextFont = _indicatorLeftLabelTextFont; 97 | CGSize size = [self sizeForTitle:viewModel.indicatorLeftTitle withFont:_indicatorLeftLabelTextFont]; 98 | if (size.width > viewModel.indicatorLeftLabelSize.width) { 99 | viewModel.indicatorLeftLabelSize = size; 100 | } 101 | }]; 102 | } 103 | 104 | } 105 | } 106 | 107 | - (void)setIndicatorLeftLabelTextColor:(UIColor *)indicatorLeftLabelTextColor 108 | { 109 | if (![self color1:_indicatorLeftLabelTextColor hasTheSameRGBAOfColor2:indicatorLeftLabelTextColor]) { 110 | _indicatorLeftLabelTextColor = indicatorLeftLabelTextColor; 111 | [_cellViewModelsArray makeObjectsPerformSelector:@selector(setIndicatorLeftLabelTextColor:) withObject:_indicatorLeftLabelTextColor]; 112 | } 113 | } 114 | 115 | 116 | - (void)setIndicatorLeftImageSize:(CGSize)indicatorLeftImageSize 117 | { 118 | SJStaticTableviewCellViewModel *viewMoel = _cellViewModelsArray.firstObject; 119 | CGFloat cellHeight = viewMoel.cellHeight; 120 | 121 | if ( (!CGSizeEqualToSize(_indicatorLeftImageSize, indicatorLeftImageSize)) && (indicatorLeftImageSize.height < cellHeight)) { 122 | 123 | _indicatorLeftImageSize = indicatorLeftImageSize; 124 | 125 | [_cellViewModelsArray enumerateObjectsUsingBlock:^(SJStaticTableviewCellViewModel *viewModel, NSUInteger idx, BOOL * _Nonnull stop) 126 | { 127 | viewMoel.indicatorLeftImageSize = _indicatorLeftImageSize; 128 | }]; 129 | } 130 | 131 | } 132 | 133 | - (void)setIndicatorLeftImageAndLabelGap:(CGFloat)indicatorLeftImageAndLabelGap 134 | { 135 | if (_indicatorLeftImageAndLabelGap != indicatorLeftImageAndLabelGap) { 136 | _indicatorLeftImageAndLabelGap = indicatorLeftImageAndLabelGap; 137 | [_cellViewModelsArray enumerateObjectsUsingBlock:^(SJStaticTableviewCellViewModel * viewModel, NSUInteger idx, BOOL * _Nonnull stop) { 138 | viewModel.indicatorLeftImageAndLabelGap = _indicatorLeftImageAndLabelGap; 139 | }]; 140 | } 141 | } 142 | 143 | //判断字体大小是否一致 144 | - (BOOL)font1:(UIFont *)font1 hasSameFontSizeOfFont2:(UIFont *)font2 145 | { 146 | BOOL res = NO; 147 | UIFontDescriptor *font1Des = font1.fontDescriptor; 148 | NSNumber *font1Number = [font1Des objectForKey:@"NSFontSizeAttribute"]; 149 | 150 | UIFontDescriptor *font2Des = font2.fontDescriptor; 151 | NSNumber *font2Number = [font2Des objectForKey:@"NSFontSizeAttribute"]; 152 | 153 | if ([font1Number integerValue] == [font2Number integerValue]) { 154 | res = YES; 155 | } 156 | 157 | return res; 158 | } 159 | 160 | //判断颜色是否相等 161 | - (BOOL)color1:(UIColor *)color1 hasTheSameRGBAOfColor2:(UIColor *)color2 162 | { 163 | BOOL res = NO; 164 | 165 | CGFloat red1,red2,green1,green2,blue1,blue2,alpha1,alpha2; 166 | 167 | //取出color1的背景颜色的RGBA值 168 | [color1 getRed:&red1 green:&green1 blue:&blue1 alpha:&alpha1]; 169 | 170 | //取出color2的背景颜色的RGBA值 171 | [color2 getRed:&red2 green:&green2 blue:&blue2 alpha:&alpha2]; 172 | 173 | if ((red1 == red2)&&(green1 == green2)&&(blue1 == blue2)&&(alpha1 == alpha2)) { 174 | res = YES; 175 | } 176 | 177 | return res; 178 | } 179 | 180 | - (CGSize)sizeForTitle:(NSString *)title withFont:(UIFont *)font 181 | { 182 | CGRect titleRect = [title boundingRectWithSize:CGSizeMake(FLT_MAX, FLT_MAX) 183 | options:NSStringDrawingUsesLineFragmentOrigin 184 | attributes:@{NSFontAttributeName : font} 185 | context:nil]; 186 | 187 | return CGSizeMake(titleRect.size.width, 188 | titleRect.size.height); 189 | } 190 | 191 | @end 192 | -------------------------------------------------------------------------------- /SJStaticTableViewDemo/SJStaticTableViewDemo/ViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.h 3 | // SJStaticTableViewDemo 4 | // 5 | // Created by Sun Shijie on 2017/3/19. 6 | // Copyright © 2017年 Shijie. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface ViewController : UIViewController 12 | 13 | 14 | @end 15 | 16 | -------------------------------------------------------------------------------- /SJStaticTableViewDemo/SJStaticTableViewDemo/ViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.m 3 | // SJStaticTableViewDemo 4 | // 5 | // Created by Sun Shijie on 2017/3/19. 6 | // Copyright © 2017年 Shijie. All rights reserved. 7 | // 8 | 9 | #import "ViewController.h" 10 | 11 | @interface ViewController () 12 | 13 | @end 14 | 15 | @implementation ViewController 16 | 17 | - (void)viewDidLoad { 18 | [super viewDidLoad]; 19 | // Do any additional setup after loading the view, typically from a nib. 20 | } 21 | 22 | 23 | - (void)didReceiveMemoryWarning { 24 | [super didReceiveMemoryWarning]; 25 | // Dispose of any resources that can be recreated. 26 | } 27 | 28 | 29 | @end 30 | -------------------------------------------------------------------------------- /SJStaticTableViewDemo/SJStaticTableViewDemo/ViewController/SJCustomCellsOneSectionViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // SJCustomCellsOneSectionViewController.h 3 | // SSJStaticTableViewDemo 4 | // 5 | // Created by Sun Shijie on 2017/3/18. 6 | // Copyright © 2017年 Shijie. All rights reserved. 7 | // 8 | 9 | #import "SJStaticTableViewController.h" 10 | 11 | @interface SJCustomCellsOneSectionViewController : SJStaticTableViewController 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /SJStaticTableViewDemo/SJStaticTableViewDemo/ViewController/SJCustomCellsOneSectionViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // SJCustomCellsOneSectionViewController.m 3 | // SSJStaticTableViewDemo 4 | // 5 | // Created by Sun Shijie on 2017/3/18. 6 | // Copyright © 2017年 Shijie. All rights reserved. 7 | // 8 | 9 | #import "SJCustomCellsOneSectionViewController.h" 10 | 11 | @interface SJCustomCellsOneSectionViewController () 12 | 13 | @end 14 | 15 | @implementation SJCustomCellsOneSectionViewController 16 | 17 | - (void)viewDidLoad { 18 | 19 | [super viewDidLoad]; 20 | self.navigationItem.title = @"定制cell页面 - 同组"; 21 | } 22 | 23 | 24 | - (void)createDataSource 25 | { 26 | self.dataSource = [[SJStaticTableViewDataSource alloc] initWithViewModelsArray:[Factory customCellsOneSectionPageData] configureBlock:^(SJStaticTableViewCell *cell, SJStaticTableviewCellViewModel *viewModel) { 27 | 28 | switch (viewModel.staticCellType) 29 | { 30 | case SJStaticCellTypeSystemAccessoryDisclosureIndicator: 31 | { 32 | [cell configureAccessoryDisclosureIndicatorCellWithViewModel:viewModel]; 33 | } 34 | break; 35 | 36 | default: 37 | break; 38 | } 39 | }]; 40 | } 41 | 42 | 43 | @end 44 | -------------------------------------------------------------------------------- /SJStaticTableViewDemo/SJStaticTableViewDemo/ViewController/SJCustomCellsViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // SJCustomCellsViewController.h 3 | // SSJStaticTableViewDemo 4 | // 5 | // Created by Sun Shijie on 2017/3/18. 6 | // Copyright © 2017年 Shijie. All rights reserved. 7 | // 8 | 9 | #import "SJStaticTableViewController.h" 10 | 11 | @interface SJCustomCellsViewController : SJStaticTableViewController 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /SJStaticTableViewDemo/SJStaticTableViewDemo/ViewController/SJCustomCellsViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // SJCustomCellsViewController.m 3 | // SSJStaticTableViewDemo 4 | // 5 | // Created by Sun Shijie on 2017/3/18. 6 | // Copyright © 2017年 Shijie. All rights reserved. 7 | // 8 | 9 | #import "SJCustomCellsViewController.h" 10 | 11 | @interface SJCustomCellsViewController () 12 | 13 | @end 14 | 15 | @implementation SJCustomCellsViewController 16 | 17 | - (void)viewDidLoad { 18 | 19 | [super viewDidLoad]; 20 | self.navigationItem.title = @"定制cell页面 - 分组"; 21 | } 22 | 23 | 24 | - (void)createDataSource 25 | { 26 | self.dataSource = [[SJStaticTableViewDataSource alloc] initWithViewModelsArray:[Factory customCellsPageData] configureBlock:^(SJStaticTableViewCell *cell, SJStaticTableviewCellViewModel *viewModel) { 27 | 28 | switch (viewModel.staticCellType) 29 | { 30 | case SJStaticCellTypeSystemAccessoryDisclosureIndicator: 31 | { 32 | [cell configureAccessoryDisclosureIndicatorCellWithViewModel:viewModel]; 33 | } 34 | break; 35 | 36 | default: 37 | break; 38 | } 39 | }]; 40 | } 41 | 42 | @end 43 | -------------------------------------------------------------------------------- /SJStaticTableViewDemo/SJStaticTableViewDemo/ViewController/SJDiscoverViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // SJDiscoverViewController.h 3 | // SSJStaticTableViewDemo 4 | // 5 | // Created by Sun Shijie on 2017/3/16. 6 | // Copyright © 2017年 Shijie. All rights reserved. 7 | // 8 | 9 | #import "SJStaticTableViewController.h" 10 | 11 | @interface SJDiscoverViewController : SJStaticTableViewController 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /SJStaticTableViewDemo/SJStaticTableViewDemo/ViewController/SJDiscoverViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // SJDiscoverViewController.m 3 | // SSJStaticTableViewDemo 4 | // 5 | // Created by Sun Shijie on 2017/3/16. 6 | // Copyright © 2017年 Shijie. All rights reserved. 7 | // 8 | 9 | #import "SJDiscoverViewController.h" 10 | 11 | @interface SJDiscoverViewController () 12 | 13 | @end 14 | 15 | @implementation SJDiscoverViewController 16 | 17 | - (void)viewDidLoad { 18 | 19 | [super viewDidLoad]; 20 | self.navigationItem.title = @"发现"; 21 | [self networkRequest]; 22 | } 23 | 24 | - (void)networkRequest 25 | { 26 | //模拟网络请求 27 | dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(2 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ 28 | 29 | //请求成功 30 | NSDictionary *responseDict = @{@"title_info":@"新游戏上架啦", 31 | @"title_icon":@"game_1", 32 | @"game_info":@"一起来玩斗地主呀!", 33 | @"game_icon":@"doudizhu" 34 | }; 35 | //将要刷新cell的indexPath 36 | NSIndexPath *indexPath = [NSIndexPath indexPathForRow:1 inSection:3]; 37 | 38 | //获取cell对应的viewModel 39 | SJStaticTableviewCellViewModel *viewModel = [self.dataSource tableView:self.tableView cellViewModelAtIndexPath:indexPath]; 40 | 41 | if (viewModel) { 42 | //更新viewModel 43 | viewModel.leftTitle = responseDict[@"title_info"]; 44 | viewModel.leftImage = [UIImage imageNamed:responseDict[@"title_icon"]]; 45 | viewModel.indicatorLeftImage = [UIImage imageNamed:responseDict[@"game_icon"]]; 46 | viewModel.indicatorLeftTitle = responseDict[@"game_info"]; 47 | 48 | //刷新tableview 49 | [self.tableView reloadData]; 50 | } 51 | }); 52 | } 53 | 54 | - (void)createDataSource 55 | { 56 | self.dataSource = [[SJStaticTableViewDataSource alloc] initWithViewModelsArray:[Factory momentsPageData] configureBlock:^(SJStaticTableViewCell *cell, SJStaticTableviewCellViewModel *viewModel) { 57 | 58 | switch (viewModel.staticCellType) 59 | { 60 | case SJStaticCellTypeSystemAccessoryDisclosureIndicator: 61 | { 62 | [cell configureAccessoryDisclosureIndicatorCellWithViewModel:viewModel]; 63 | } 64 | break; 65 | 66 | default: 67 | break; 68 | } 69 | }]; 70 | } 71 | 72 | @end 73 | -------------------------------------------------------------------------------- /SJStaticTableViewDemo/SJStaticTableViewDemo/ViewController/SJEmoticonViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // SJEmoticonViewController.h 3 | // SJStaticTableViewDemo 4 | // 5 | // Created by Sun Shijie on 2017/4/22. 6 | // Copyright © 2017年 Shijie. All rights reserved. 7 | // 8 | 9 | #import "SJStaticTableViewController.h" 10 | 11 | @interface SJEmoticonViewController : SJStaticTableViewController 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /SJStaticTableViewDemo/SJStaticTableViewDemo/ViewController/SJEmoticonViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // SJEmoticonViewController.m 3 | // SJStaticTableViewDemo 4 | // 5 | // Created by Sun Shijie on 2017/4/22. 6 | // Copyright © 2017年 Shijie. All rights reserved. 7 | // 8 | 9 | #import "SJEmoticonViewController.h" 10 | #import "MBProgressHUD.h" 11 | 12 | 13 | @interface SJEmoticonViewController () 14 | 15 | @property (nonatomic, readwrite, strong) NSArray *modelsArray; 16 | 17 | @end 18 | 19 | @implementation SJEmoticonViewController 20 | 21 | - (void)viewDidLoad { 22 | 23 | [super viewDidLoad]; 24 | 25 | self.navigationItem.title = @"表情"; 26 | [self networkRequest]; 27 | } 28 | 29 | 30 | - (void)networkRequest 31 | { 32 | [MBProgressHUD showHUDAddedTo:self.view animated:YES]; 33 | 34 | //模拟网络请求 35 | dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(1.5 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ 36 | 37 | [MBProgressHUD hideHUDForView:self.view animated:YES]; 38 | self.modelsArray = [Factory emoticonPage];//网络请求后,将数据保存在self.modelsArray里面 39 | [self configureTableView]; 40 | 41 | }); 42 | } 43 | 44 | - (void)createDataSource 45 | { 46 | self.dataSource = [[SJStaticTableViewDataSource alloc] initWithViewModelsArray:self.modelsArray configureBlock:^(SJStaticTableViewCell *cell, SJStaticTableviewCellViewModel *viewModel) { 47 | 48 | switch (viewModel.staticCellType) { 49 | 50 | case SJStaticCellTypeSystemAccessoryDisclosureIndicator: 51 | { 52 | [cell configureAccessoryDisclosureIndicatorCellWithViewModel:viewModel]; 53 | } 54 | break; 55 | 56 | default: 57 | break; 58 | } 59 | }]; 60 | } 61 | 62 | 63 | @end 64 | -------------------------------------------------------------------------------- /SJStaticTableViewDemo/SJStaticTableViewDemo/ViewController/SJInfoViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // SJInfoViewController.h 3 | // SSJStaticTableViewDemo 4 | // 5 | // Created by Sun Shijie on 2017/3/16. 6 | // Copyright © 2017年 Shijie. All rights reserved. 7 | // 8 | 9 | #import "SJStaticTableViewController.h" 10 | 11 | @interface SJInfoViewController : SJStaticTableViewController 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /SJStaticTableViewDemo/SJStaticTableViewDemo/ViewController/SJInfoViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // SJInfoViewController.m 3 | // SSJStaticTableViewDemo 4 | // 5 | // Created by Sun Shijie on 2017/3/16. 6 | // Copyright © 2017年 Shijie. All rights reserved. 7 | // 8 | 9 | #import "SJInfoViewController.h" 10 | 11 | 12 | @interface SJInfoViewController () 13 | 14 | @end 15 | 16 | @implementation SJInfoViewController 17 | 18 | - (void)viewDidLoad { 19 | [super viewDidLoad]; 20 | self.navigationItem.title = @"个人信息"; 21 | } 22 | 23 | 24 | 25 | - (void)createDataSource 26 | { 27 | self.dataSource = [[SJStaticTableViewDataSource alloc] initWithViewModelsArray:[Factory infoPageData] configureBlock:^(SJStaticTableViewCell *cell, SJStaticTableviewCellViewModel *viewModel) { 28 | 29 | switch (viewModel.staticCellType) 30 | { 31 | case SJStaticCellTypeSystemAccessoryDisclosureIndicator: 32 | { 33 | [cell configureAccessoryDisclosureIndicatorCellWithViewModel:viewModel]; 34 | } 35 | break; 36 | 37 | default: 38 | break; 39 | } 40 | }]; 41 | } 42 | 43 | 44 | 45 | @end 46 | -------------------------------------------------------------------------------- /SJStaticTableViewDemo/SJStaticTableViewDemo/ViewController/SJMeViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // SJMeViewController.h 3 | // SSJStaticTableViewDemo 4 | // 5 | // Created by Sun Shijie on 2017/3/15. 6 | // Copyright © 2017年 Shijie. All rights reserved. 7 | // 8 | 9 | #import "SJStaticTableViewController.h" 10 | 11 | @interface SJMeViewController : SJStaticTableViewController 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /SJStaticTableViewDemo/SJStaticTableViewDemo/ViewController/SJMeViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // SJMeViewController.m 3 | // SSJStaticTableViewDemo 4 | // 5 | // Created by Sun Shijie on 2017/3/15. 6 | // Copyright © 2017年 Shijie. All rights reserved. 7 | // 8 | 9 | #import "SJMeViewController.h" 10 | #import "SJStaticTableViewCell+MeAvatar.h" 11 | #import "SJSettingViewController.h" 12 | #import "SJInfoViewController.h" 13 | #import "SJEmoticonViewController.h" 14 | 15 | @interface SJMeViewController () 16 | 17 | @end 18 | 19 | @implementation SJMeViewController 20 | 21 | 22 | - (void)viewDidLoad { 23 | 24 | [super viewDidLoad]; 25 | self.navigationItem.title = @"我"; 26 | } 27 | 28 | - (void)createDataSource 29 | { 30 | self.dataSource = [[SJStaticTableViewDataSource alloc] initWithViewModelsArray:[Factory mePageData] configureBlock:^(SJStaticTableViewCell *cell, SJStaticTableviewCellViewModel *viewModel) { 31 | 32 | switch (viewModel.staticCellType) { 33 | 34 | case SJStaticCellTypeSystemAccessoryDisclosureIndicator: 35 | { 36 | [cell configureAccessoryDisclosureIndicatorCellWithViewModel:viewModel]; 37 | } 38 | break; 39 | 40 | case SJStaticCellTypeMeAvatar: 41 | { 42 | [cell configureMeAvatarTableViewCellWithViewModel:viewModel]; 43 | } 44 | break; 45 | 46 | default: 47 | break; 48 | } 49 | }]; 50 | } 51 | 52 | - (void)didSelectViewModel:(SJStaticTableviewCellViewModel *)viewModel atIndexPath:(NSIndexPath *)indexPath 53 | { 54 | 55 | switch (viewModel.identifier) 56 | { 57 | case 0: 58 | { 59 | NSLog(@"跳转到详情页"); 60 | SJInfoViewController *vc = [[SJInfoViewController alloc] init]; 61 | [self.navigationController pushViewController:vc animated:YES]; 62 | } 63 | break; 64 | 65 | 66 | case 5: 67 | { 68 | NSLog(@"跳转到表情页"); 69 | SJEmoticonViewController *vc = [[SJEmoticonViewController alloc] initWithDefaultDataType:SJDefaultDataTypeNone]; 70 | [self.navigationController pushViewController:vc animated:YES]; 71 | } 72 | break; 73 | 74 | case 7: 75 | { 76 | NSLog(@"跳转到设置页"); 77 | SJSettingViewController *vc = [[SJSettingViewController alloc] init]; 78 | [self.navigationController pushViewController:vc animated:YES]; 79 | } 80 | break; 81 | 82 | 83 | default: 84 | break; 85 | } 86 | } 87 | 88 | @end 89 | -------------------------------------------------------------------------------- /SJStaticTableViewDemo/SJStaticTableViewDemo/ViewController/SJSettingViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // SJSettingViewController.h 3 | // SSJStaticTableViewDemo 4 | // 5 | // Created by Sun Shijie on 2017/3/16. 6 | // Copyright © 2017年 Shijie. All rights reserved. 7 | // 8 | 9 | #import "SJStaticTableViewController.h" 10 | 11 | @interface SJSettingViewController : SJStaticTableViewController 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /SJStaticTableViewDemo/SJStaticTableViewDemo/ViewController/SJSettingViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // SJSettingViewController.m 3 | // SSJStaticTableViewDemo 4 | // 5 | // Created by Sun Shijie on 2017/3/16. 6 | // Copyright © 2017年 Shijie. All rights reserved. 7 | // 8 | 9 | #import "SJSettingViewController.h" 10 | #import "SJCustomCellsViewController.h" 11 | #import "SJCustomCellsOneSectionViewController.h" 12 | 13 | 14 | @interface SJSettingViewController () 15 | 16 | @end 17 | 18 | @implementation SJSettingViewController 19 | 20 | - (void)viewDidLoad { 21 | 22 | [super viewDidLoad]; 23 | self.navigationItem.title = @"设置"; 24 | } 25 | 26 | - (void)createDataSource 27 | { 28 | self.dataSource = [[SJStaticTableViewDataSource alloc] initWithViewModelsArray:[Factory settingPageData] configureBlock:^(SJStaticTableViewCell *cell, SJStaticTableviewCellViewModel *viewModel) { 29 | 30 | switch (viewModel.staticCellType) 31 | { 32 | case SJStaticCellTypeSystemAccessoryDisclosureIndicator: 33 | { 34 | [cell configureAccessoryDisclosureIndicatorCellWithViewModel:viewModel]; 35 | } 36 | break; 37 | 38 | case SJStaticCellTypeSystemAccessorySwitch: 39 | { 40 | [cell configureAccessorySwitchCellWithViewModel:viewModel]; 41 | } 42 | break; 43 | 44 | case SJStaticCellTypeSystemLogout: 45 | { 46 | [cell configureLogoutTableViewCellWithViewModel:viewModel]; 47 | } 48 | break; 49 | 50 | case SJStaticCellTypeSystemAccessoryNone: 51 | { 52 | [cell configureAccessoryNoneCellWithViewModel:viewModel]; 53 | } 54 | break; 55 | 56 | default: 57 | break; 58 | } 59 | }]; 60 | } 61 | 62 | 63 | - (void)didSelectViewModel:(SJStaticTableviewCellViewModel *)viewModel atIndexPath:(NSIndexPath *)indexPath 64 | { 65 | 66 | switch (viewModel.identifier) 67 | { 68 | 69 | case 6: 70 | { 71 | NSLog(@"退出登录"); 72 | [self showAlertWithMessage:@"真的要退出登录嘛?"]; 73 | } 74 | break; 75 | 76 | case 8: 77 | { 78 | NSLog(@"清理缓存"); 79 | } 80 | break; 81 | 82 | case 9: 83 | { 84 | NSLog(@"跳转到定制性cell展示页面 - 分组"); 85 | SJCustomCellsViewController *vc = [[SJCustomCellsViewController alloc] init]; 86 | [self.navigationController pushViewController:vc animated:YES]; 87 | } 88 | break; 89 | 90 | case 10: 91 | { 92 | NSLog(@"跳转到定制性cell展示页面 - 同组"); 93 | SJCustomCellsOneSectionViewController *vc = [[SJCustomCellsOneSectionViewController alloc] init]; 94 | [self.navigationController pushViewController:vc animated:YES]; 95 | } 96 | break; 97 | 98 | default: 99 | break; 100 | } 101 | } 102 | 103 | - (void)showAlertWithMessage:(NSString *)alertTitle 104 | { 105 | 106 | UIAlertController *vc = [UIAlertController alertControllerWithTitle:alertTitle message:nil preferredStyle:UIAlertControllerStyleAlert]; 107 | UIAlertAction *actionCancel = [UIAlertAction actionWithTitle:@"取消" style:UIAlertActionStyleCancel handler:^(UIAlertAction * _Nonnull action) { 108 | 109 | }]; 110 | 111 | UIAlertAction *actionOK = [UIAlertAction actionWithTitle:@"是的" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) { 112 | 113 | }]; 114 | [vc addAction:actionCancel]; 115 | [vc addAction:actionOK]; 116 | [self presentViewController:vc animated:YES completion:nil]; 117 | 118 | } 119 | 120 | 121 | 122 | @end 123 | -------------------------------------------------------------------------------- /SJStaticTableViewDemo/SJStaticTableViewDemo/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // SJStaticTableViewDemo 4 | // 5 | // Created by Sun Shijie on 2017/3/19. 6 | // Copyright © 2017年 Shijie. 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 | -------------------------------------------------------------------------------- /SJStaticTableViewDemo/SJStaticTableViewDemoTests/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | BNDL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleVersion 20 | 1 21 | 22 | 23 | -------------------------------------------------------------------------------- /SJStaticTableViewDemo/SJStaticTableViewDemoTests/SJStaticTableViewDemoTests.m: -------------------------------------------------------------------------------- 1 | // 2 | // SJStaticTableViewDemoTests.m 3 | // SJStaticTableViewDemoTests 4 | // 5 | // Created by Sun Shijie on 2017/3/19. 6 | // Copyright © 2017年 Shijie. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface SJStaticTableViewDemoTests : XCTestCase 12 | 13 | @end 14 | 15 | @implementation SJStaticTableViewDemoTests 16 | 17 | - (void)setUp { 18 | [super setUp]; 19 | // Put setup code here. This method is called before the invocation of each test method in the class. 20 | } 21 | 22 | - (void)tearDown { 23 | // Put teardown code here. This method is called after the invocation of each test method in the class. 24 | [super tearDown]; 25 | } 26 | 27 | - (void)testExample { 28 | // This is an example of a functional test case. 29 | // Use XCTAssert and related functions to verify your tests produce the correct results. 30 | } 31 | 32 | - (void)testPerformanceExample { 33 | // This is an example of a performance test case. 34 | [self measureBlock:^{ 35 | // Put the code you want to measure the time of here. 36 | }]; 37 | } 38 | 39 | @end 40 | -------------------------------------------------------------------------------- /SJStaticTableViewDemo/SJStaticTableViewDemoUITests/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | BNDL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleVersion 20 | 1 21 | 22 | 23 | -------------------------------------------------------------------------------- /SJStaticTableViewDemo/SJStaticTableViewDemoUITests/SJStaticTableViewDemoUITests.m: -------------------------------------------------------------------------------- 1 | // 2 | // SJStaticTableViewDemoUITests.m 3 | // SJStaticTableViewDemoUITests 4 | // 5 | // Created by Sun Shijie on 2017/3/19. 6 | // Copyright © 2017年 Shijie. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface SJStaticTableViewDemoUITests : XCTestCase 12 | 13 | @end 14 | 15 | @implementation SJStaticTableViewDemoUITests 16 | 17 | - (void)setUp { 18 | [super setUp]; 19 | 20 | // Put setup code here. This method is called before the invocation of each test method in the class. 21 | 22 | // In UI tests it is usually best to stop immediately when a failure occurs. 23 | self.continueAfterFailure = NO; 24 | // UI tests must launch the application that they test. Doing this in setup will make sure it happens for each test method. 25 | [[[XCUIApplication alloc] init] launch]; 26 | 27 | // In UI tests it’s important to set the initial state - such as interface orientation - required for your tests before they run. The setUp method is a good place to do this. 28 | } 29 | 30 | - (void)tearDown { 31 | // Put teardown code here. This method is called after the invocation of each test method in the class. 32 | [super tearDown]; 33 | } 34 | 35 | - (void)testExample { 36 | // Use recording to get started writing UI tests. 37 | // Use XCTAssert and related functions to verify your tests produce the correct results. 38 | } 39 | 40 | @end 41 | --------------------------------------------------------------------------------