IOS彩票第二天设置界面(1)
****跳转到设置界面
- (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)的更多相关文章
- IOS彩票第二天设置界面(2)
*********代码的抽取ILBaseTableViewController.h #import <UIKit/UIKit.h> @interface ILBaseTableViewCo ...
- iOS提醒用户进入设置界面进行重新授权通知定位等功能
iOS 8及以上版本最不为人知的一个特点是与应用设置的深层链接,用户可以根据APP的需要授权启用位置.通知.联系人.相机.日历以及健康等设置. 大多数应用程序仅仅是弹出一个包含操作指令的警示窗口,如“ ...
- iOS APP跳转设置界面以及设置中的其他界面
1.跳转设置总页面(iOS10+以及之前的都可以用:ios10+ 是跳转到了应用到设置界面) [[UIApplication sharedApplication]openURL:[NSURL URLW ...
- IOS彩票第三天界面
******ios6 和ios7的适配 ILBaseTableViewController.m - (void)viewDidLoad { [super viewDidLoad]; // 244 24 ...
- iOS开发——开发必备OC篇&UITableView设置界面完整封装(二)
UITableView设置界面完整封装(二) 简单MVC实现UITableView设置界面之Cell右边类型设置 首先来看看第一种方法证明使用,结合两种方法之后根据个人的爱好去选择就可以了, 一:使用 ...
- iOS开发 - 如何跳到系统设置里的各种设置界面
在iOS开发中,有时会有跳转系统设置界面的需求,例如提示用户打开蓝牙或者WIFI,提醒用户打开推送或者位置权限等.在iOS6之后,第三方应用需要跳转系统设置界面,需要在URL type中添加一个pre ...
- iOS开发之如何跳到系统设置里的各种设置界面
跳到更多设置界面 除了跳到WiFi设置界面,能不能跳到其他的设置界面呢?比如:定位服务.FaceTime.音乐等等.都是可以的,一起来看看如何实现的! 定位服务 定位服务有很多APP都有,如果用户关闭 ...
- iOS 跳转到系统的设置界面
跳到健康设置 上网找了一下 你会发现很难找到.代码如下 不信你试试 . NSURL *url = [NSURL URLWithString:@"prefs:root=Privacy& ...
- iOS开发——开发必备OC篇&UITableView设置界面完整封装(四)
设置界面完整封装(四) 简单MVC实现UITableView设置界面完善封装及拓展使用 关于使用和拓展, 其实基本上就是同UItableView,知识讲数据改一下就可以 拓展使用 1:首先定义一个数组 ...
随机推荐
- pycharm设置主题/默认格式/字体
1.步骤为:File-->Settings-->Appearance & Behavior-->Appearance-->Theme中就可以选择喜欢的主题 2.一般将文 ...
- Python基础10- 函数之内部函数与强制转换
#coding=utf-8 import mathimport osimport socket Python函数包括以下三类:内部函数.第三方函数和自定义函数内部函数包括:字符函数库.数学函数库.系统 ...
- 建立php开发环境(XAMPP + Xdebug+Zend Studio)
1. 安装XAMPP和Zend Studio Zend Studio下载地址: http://pan.baidu.com/s/1o6BjvAE XAMPP 下载地址: http://pan.baidu ...
- oracle clob like
create table products( productid number(10) not null, name varchar2(255), description CLOB); 查询语句 ...
- javac命令出现“**.java使用了未经检查或不安全的操作”
Collection col=new ArrayList();引发了“**.java使用了未经检查或不安全的操作”错误, 这是因为JDK1.5中引进了泛型,但是你的ArrayList却没有采用,所有会 ...
- 转:45 个 LoadRunner 面试问题(附答案)_纯英文,太有逼格了
What is load testing? - Load testing is to test that if the application works fine with the loads th ...
- [备份]Emacs配置文件
(set-background-color "gray20")(set-foreground-color "wheat") (tool-bar-mode -1) ...
- [深入浅出Windows 10]布局原理
5.2 布局原理 很多时候在编写程序界面的时候都会忽略了应用布局的重要性,仅仅只是把布局看作是对UI元素的排列,只要能实现布局的效果就可以了,但是在实际的产品开发中这是远远不够的,你可能面临要实现的布 ...
- BZOJ1391: [Ceoi2008]order
Description 有N个工作,M种机器,每种机器你可以租或者买过来. 每个工作包括若干道工序,每道工序需要某种机器来完成,你可以通过购买或租用机器来完成. 现在给出这些参数,求最大利润 Inpu ...
- IOS 蓝牙相关-连接外设的代码实现(2)
我们具体说明一下中心模式的应用场景.主设备(手机去扫描连接外设,发现外设服务和属性,操作服务和属性的应用.一般来说,外设(蓝牙设备,比如智能手环之类的东西), 会由硬件工程师开发好,并定义好设备提供的 ...