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:首先定义一个数组 ...
随机推荐
- [技术学习]js接口继承
js是面向对象语言,但是js又缺乏了面向对象的诸多特性,比如继承,没有接口继承也没有父类继承,因此有时候需要人工来实现继承. 一.首先看下java中面向对象的继承: //定义类鸟类的飞行动作 inte ...
- zookeeper + LevelDB + ActiveMQ实现消息队列高可用
通过集群实现消息队列高可用. 消息队列在项目中存储订单.邮件通知.数据分发等重要信息,故对消息队列稳定可用性有高要求. 现在通过zookeeper选取activemq leader的形式实现当某个ac ...
- PHP 配置文件详解(php.ini 详解 )
[PHP] ; PHP还是一个不断发展的工具,其功能还在不断地删减 ; 而php.ini的设置更改可以反映出相当的变化, ; 在使用新的PHP版本前,研究一下php.ini会有好处的 ;;;;;;;; ...
- TestNg依赖高级用法之强制依赖与顺序依赖------TestNg依赖详解(二)
TestNg使用dependsOnGroups属性来进行依赖测试, 测试方法依赖于某个或某些方法,这个/这些方法作为前置依赖条件 强制依赖:如果被依赖的某一个方法发生了异常,那么之后的方法都不会被执行 ...
- EBay .Net SDK Api 实践
1.请求流程介绍 提供SOA地址:https://api.ebay.com/wsapi WSDL生成的代码在WebService.cs文件当中. ApiCall封装了所有的RPC, ...
- 内网配置DNS服务器,无域名,只有主机名
Hadoop集群中,使用DNS而不是hosts来访问服务器. 1. 安装bind软件 用root用户运行: yum -y install bind* 2. 配置named.conf文件 vi /etc ...
- MySQL优化经验和方法汇总
一.服务器硬件对MySQL性能的影响 1.磁盘寻道能力(磁盘I/O),以目前高转速SCSI硬盘(7200转/秒)为例,这种硬盘理论上每秒寻道7200次,这是物理特性决定的,没有办法改变. MySQL ...
- Java 日期格式化工具类
import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Calendar; impor ...
- 【HDU】2147 kiki's game
http://acm.hdu.edu.cn/showproblem.php?pid=2147 题意:n×m的棋盘,每次可以向左走.向下走.向左下走,初始在(1, m),n,m<=2000,问先手 ...
- [BZOJ2796][Poi2012]Fibonacci Representation
由于是斐波那契数列,所以$x_i+x_j<=x_k,i<j<k$ 所以猜测可以贪心选择两边近的数处理. #include<cstdio> #include<algo ...