****跳转到设置界面

- (IBAction)setting:(id)sender {

    // 创建设置口控制器
ILSettingTableViewController *settingVc = [[ILSettingTableViewController alloc] init]; // 调整到设置界面
[self.navigationController pushViewController:settingVc animated:YES]; }

******ILSettingTableViewController.m

#import "ILSettingTableViewController.h"

#import "ILSettingCell.h"

#import "ILSettingItem.h"

#import "ILSettingArrowItem.h"
#import "ILSettingSwitchItem.h" #import "ILSettingGroup.h" #import "ILTestViewController.h" @interface ILSettingTableViewController () @property (nonatomic, strong) NSMutableArray *dataList; @end @implementation ILSettingTableViewController - (NSMutableArray *)dataList
{
if (_dataList == nil) {
_dataList = [NSMutableArray array]; // 0组
ILSettingArrowItem *pushNotice = [ILSettingArrowItem itemWithIcon:@"MorePush" title:@"推送和提醒"];
pushNotice.destVcClass = [ILTestViewController class];
pushNotice.destVcName = @"ILTestViewController";
ILSettingItem *yaoyiyao = [ILSettingSwitchItem itemWithIcon:@"handShake" title:@"摇一摇机选"]; ILSettingGroup *group0 = [[ILSettingGroup alloc] init];
group0.items = @[pushNotice,yaoyiyao];
group0.header = @"asdas";
group0.footer = @"asdasd"; // 1组
ILSettingItem *newVersion = [ILSettingArrowItem itemWithIcon:@"MoreUpdate" title:@"检查新版本"];
ILSettingItem *help = [ILSettingArrowItem itemWithIcon:@"MoreHelp" title:@"帮助"]; ILSettingGroup *group1 = [[ILSettingGroup alloc] init];
group1.header = @"帮助";
group1.items = @[newVersion,help]; [_dataList addObject:group0];
[_dataList addObject:group1]; } return _dataList;
} - (id)init
{
return [super initWithStyle:UITableViewStyleGrouped];
} - (void)viewDidLoad
{
[super viewDidLoad]; // Uncomment the following line to preserve selection between presentations.
// self.clearsSelectionOnViewWillAppear = NO; // Uncomment the following line to display an Edit button in the navigation bar for this view controller.
// self.navigationItem.rightBarButtonItem = self.editButtonItem;
} #pragma mark - Table view data source - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{ return self.dataList.count;
} - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{ // Return the number of rows in the section.
ILSettingGroup *group = self.dataList[section];
return group.items.count;
} - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{ // 创建cell
ILSettingCell *cell = [[ILSettingCell class] cellWithTableView:tableView]; // 取出模型
ILSettingGroup *group = self.dataList[indexPath.section];
ILSettingItem *item = group.items[indexPath.row]; // 传递模型
cell.item = item; return cell;
}
//设置头部标题
- (NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section
{
ILSettingGroup *group = self.dataList[section];
return group.header;
}
//底部标题
- (NSString *)tableView:(UITableView *)tableView titleForFooterInSection:(NSInteger)section
{
ILSettingGroup *group = self.dataList[section];
return group.footer;
} //点击cell
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
// 取出模型
ILSettingGroup *group = self.dataList[indexPath.section];
ILSettingItem *item = group.items[indexPath.row]; if ([item isKindOfClass:[ILSettingArrowItem class]]) { // 需要跳转控制器
ILSettingArrowItem *arrowItem = (ILSettingArrowItem *)item; // Class vcClass = NSClassFromString(arrowItem.destVcName); // 创建跳转的控制器
UIViewController *vc = [[arrowItem.destVcClass alloc] init]; [self.navigationController pushViewController:vc animated:YES]; } } @end

***ILSettingTableViewController.h

#import <UIKit/UIKit.h>

@interface ILSettingTableViewController : UITableViewController

@end

*****model  base    ILSettingItem.h

#import <Foundation/Foundation.h>

//typedef enum : NSUInteger {
// ILSettingItemTypeArrow,
// ILSettingItemTypeSwitch,
//} ILSettingItemType; @interface ILSettingItem : NSObject
@property (nonatomic, copy) NSString *title;
@property (nonatomic, copy) NSString *icon;
//@property (nonatomic, assign) ILSettingItemType type; + (instancetype)itemWithIcon:(NSString *)icon title:(NSString *)title; @end

***********ILSettingItem.m

#import "ILSettingItem.h"

@implementation ILSettingItem

+ (instancetype)itemWithIcon:(NSString *)icon title:(NSString *)title
{
ILSettingItem *item = [[self alloc] init]; item.icon = icon;
item.title = title; return item;
} @end

****** ILSettingGroup.h

#import <Foundation/Foundation.h>

@interface ILSettingGroup : NSObject

@property (nonatomic, copy) NSString *header;

@property (nonatomic, strong) NSArray *items;

@property (nonatomic, copy) NSString *footer;

@end

****** ILSettingGroup.m

#import "ILSettingGroup.h"

@implementation ILSettingGroup

@end

IOS彩票第二天设置界面(1)的更多相关文章

  1. IOS彩票第二天设置界面(2)

    *********代码的抽取ILBaseTableViewController.h #import <UIKit/UIKit.h> @interface ILBaseTableViewCo ...

  2. iOS提醒用户进入设置界面进行重新授权通知定位等功能

    iOS 8及以上版本最不为人知的一个特点是与应用设置的深层链接,用户可以根据APP的需要授权启用位置.通知.联系人.相机.日历以及健康等设置. 大多数应用程序仅仅是弹出一个包含操作指令的警示窗口,如“ ...

  3. iOS APP跳转设置界面以及设置中的其他界面

    1.跳转设置总页面(iOS10+以及之前的都可以用:ios10+ 是跳转到了应用到设置界面) [[UIApplication sharedApplication]openURL:[NSURL URLW ...

  4. IOS彩票第三天界面

    ******ios6 和ios7的适配 ILBaseTableViewController.m - (void)viewDidLoad { [super viewDidLoad]; // 244 24 ...

  5. iOS开发——开发必备OC篇&UITableView设置界面完整封装(二)

    UITableView设置界面完整封装(二) 简单MVC实现UITableView设置界面之Cell右边类型设置 首先来看看第一种方法证明使用,结合两种方法之后根据个人的爱好去选择就可以了, 一:使用 ...

  6. iOS开发 - 如何跳到系统设置里的各种设置界面

    在iOS开发中,有时会有跳转系统设置界面的需求,例如提示用户打开蓝牙或者WIFI,提醒用户打开推送或者位置权限等.在iOS6之后,第三方应用需要跳转系统设置界面,需要在URL type中添加一个pre ...

  7. iOS开发之如何跳到系统设置里的各种设置界面

    跳到更多设置界面 除了跳到WiFi设置界面,能不能跳到其他的设置界面呢?比如:定位服务.FaceTime.音乐等等.都是可以的,一起来看看如何实现的! 定位服务 定位服务有很多APP都有,如果用户关闭 ...

  8. iOS 跳转到系统的设置界面

    跳到健康设置   上网找了一下  你会发现很难找到.代码如下  不信你试试 . NSURL *url = [NSURL URLWithString:@"prefs:root=Privacy& ...

  9. iOS开发——开发必备OC篇&UITableView设置界面完整封装(四)

    设置界面完整封装(四) 简单MVC实现UITableView设置界面完善封装及拓展使用 关于使用和拓展, 其实基本上就是同UItableView,知识讲数据改一下就可以 拓展使用 1:首先定义一个数组 ...

随机推荐

  1. TCP拆包粘包之分隔符解码器

    TCP以流的方式进行数据传输,上层的应用协议为了对消息进行区分,往往采用如下4种方式. (1)消息长度固定,累计读取到长度总和为定长LEN的报文后,就认为读取到了一个完整的消息:将计数器置位,重新开始 ...

  2. Spring - 配置Bean - 自动装配 关系 作用域 引用外部属性文件

    1 Autowire自动装配1.1 使用:只需在<bean>中使用autowire元素<bean id="student" class="com.kej ...

  3. Postman - HTTP接口测试工具

    Postman 是一个 Chrome 的 插件,它主要是用来模拟各种HTTP请求的(如:get/post/delete/put..等等),下面介绍下Postman的安装和使用方法: 一.安装Postm ...

  4. jQuery入门第三天

    每个HTML元素根据继承属性都有父parent元素. 举个例子,h3 元素的父元素是 <div class="container-fluid">,<div cla ...

  5. HDU-2844 Coins(多重背包)

    Problem Description Whuacmers use coins.They have coins of value A1,A2,A3...An Silverland dollar. On ...

  6. CodeForceS#276-A

    A. Factory   One industrial factory is reforming working plan. The director suggested to set a mythi ...

  7. ural 1255. Graveyard of the Cosa Nostra

    1255. Graveyard of the Cosa Nostra Time limit: 1.0 secondMemory limit: 64 MB There is a custom among ...

  8. 2014-2015 ACM-ICPC, NEERC, Moscow Subregional Contest C. CIA Datacenter

    C. CIA Datacenter time limit per test 2 seconds memory limit per test 256 megabytes input standard i ...

  9. 【原】文本图片自适应高度小bug以及解决办法

    自定义cell的文本图片自适应高度代码,如果存在自定义的cell赋值封装,就必须将自适应高度代码写在这个方法中

  10. HDU 2842 (递推+矩阵快速幂)

    题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=2842 题目大意:棒子上套环.第i个环能拿下的条件是:第i-1个环在棒子上,前i-2个环不在棒子上.每个 ...