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:首先定义一个数组 ...
随机推荐
- redis 的使用 ( set集合类型操作)
set 集合类型 释义: redis 的 set 是 string 类型的无序集合 set 元素最大可以包含(2的32次方-1)个元素 关于 set 集合类型除了基本的添加删除操 ...
- zoom作用
转自:http://www.cnblogs.com/top5/archive/2011/07/11/2103343.html css中的zoom的作用1.检查页面的标签是否闭合不要小看这条,也许折腾了 ...
- Android自动化测试 - MonkeyRunner(二) 锤子便签测试脚本
来源于:http://testerhome.com/topics/878 # encoding=utf-8 #导入python中自带的time模块和sys模块,脚本中都要用到它们. import ti ...
- HDU5724 Chess(SG定理)
题目 Source http://acm.hdu.edu.cn/showproblem.php?pid=5724 Description Alice and Bob are playing a spe ...
- Eclipse: How to Navigating Java call stack in Eclipse
Link: http://stackoverflow.com/questions/3256369/navigating-java-call-stack-in-eclipse 解决方法: In the ...
- JavaScript实现存储HTML字符串
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <html> <head ...
- Topcoder SRM 626 DIV2 SumOfPower
本题就是求所有连续子数列的和 开始拿到题目还以为求的时数列子集的和,认真看到题目才知道是连续子数列 循环遍历即可 int findSum(vector <int> array) { ; ; ...
- ACM spiral grid
spiral grid 时间限制:2000 ms | 内存限制:65535 KB 难度:4 描述 Xiaod has recently discovered the grid named &q ...
- WebBrowser 多线程 DocumentCompleted 和定时器
备忘 using System; using System.Collections.Generic; using System.Linq; using System.Text; using S ...
- 【BZOJ】2876: [Noi2012]骑行川藏
题意 给出\(s_i, k_i, v_i', E\),满足\(\sum_{i=1}^{n} k_i s_i ( v_i - v_i' )^2 \le E, v_i > v_i'\),最小化$ \ ...