iOS5开发:从程序里直接跳转到设置项的实现和代码分享(类似于金山电池医生功能,iOS5有效)
转自:
http://blog.csdn.net/ibright/article/details/7276810
参考链接:
http://hi.baidu.com/yanh105/blog/item/ddd85cf9fff419949f51465c.html
http://iphone.tgbus.com/tutorial/use/201111/20111118151520.shtml
http://iphone.tgbus.com/zt/homeicon/
代码如下:
#import <UIKit/UIKit.h>
@interface OMGViewController : UIViewController<UITableViewDelegate,UITableViewDataSource>{
UITableView *_brightTableView;
NSMutableArray *_brightData;
}
@end
#import "OMGViewController.h"
@implementation OMGViewController
- (void)loadData
{
_brightData = [[NSMutableArray alloc] init];
[_brightData addObject:@"About — prefs:root=General&path=About"];
[_brightData addObject:@"Accessibility — prefs:root=General&path=ACCESSIBILITY"];
[_brightData addObject:@"Airplane Mode On — prefs:root=AIRPLANE_MODE"];
[_brightData addObject:@"Auto-Lock — prefs:root=General&path=AUTOLOCK"];
[_brightData addObject:@"Brightness — prefs:root=Brightness"];
[_brightData addObject:@"Bluetooth — prefs:root=General&path=Bluetooth"];
[_brightData addObject:@"Date & Time — prefs:root=General&path=DATE_AND_TIME"];
[_brightData addObject:@"FaceTime — prefs:root=FACETIME"];
[_brightData addObject:@"General — prefs:root=General"];
[_brightData addObject:@"Keyboard — prefs:root=General&path=Keyboard"];
[_brightData addObject:@"iCloud — prefs:root=CASTLE"];
[_brightData addObject:@"iCloud Storage & Backup — prefs:root=CASTLE&path=STORAGE_AND_BACKUP"];
[_brightData addObject:@"International — prefs:root=General&path=INTERNATIONAL"];
[_brightData addObject:@"Location Services — prefs:root=LOCATION_SERVICES"];
[_brightData addObject:@"Music — prefs:root=MUSIC"];
[_brightData addObject:@"Music Equalizer — prefs:root=MUSIC&path=EQ"];
[_brightData addObject:@"Music Volume Limit — prefs:root=MUSIC&path=VolumeLimit"];
[_brightData addObject:@"Network — prefs:root=General&path=Network"];
[_brightData addObject:@"Nike + iPod — prefs:root=NIKE_PLUS_IPOD"];
[_brightData addObject:@"Notes — prefs:root=NOTES"];
[_brightData addObject:@"Notification — prefs:root=NOTIFICATIONS_ID"];
[_brightData addObject:@"Phone — prefs:root=Phone"];
[_brightData addObject:@"Photos — prefs:root=Photos"];
[_brightData addObject:@"Profile — prefs:root=General&path=ManagedConfigurationList"];
[_brightData addObject:@"Reset — prefs:root=General&path=Reset"];
[_brightData addObject:@"Safari — prefs:root=Safari"];
[_brightData addObject:@"Siri — prefs:root=General&path=Assistant"];
[_brightData addObject:@"Sounds — prefs:root=Sounds"];
[_brightData addObject:@"Software Update — prefs:root=General&path=SOFTWARE_UPDATE_LINK"];
[_brightData addObject:@"Store — prefs:root=STORE"];
[_brightData addObject:@"Twitter — prefs:root=TWITTER"];
[_brightData addObject:@"Usage — prefs:root=General&path=USAGE"];
[_brightData addObject:@"VPN — prefs:root=General&path=Network/VPN"];
[_brightData addObject:@"Wallpaper — prefs:root=Wallpaper"];
[_brightData addObject:@"Wi-Fi — prefs:root=WIFI"];
}
- (void)viewDidLoad
{
[super viewDidLoad];
[self loadData];
// Do any additional setup after loading the view, typically from a nib.
_brightTableView = [[UITableView alloc] initWithFrame:self.view.bounds style:UITableViewStyleGrouped];
_brightTableView.delegate = self;
_brightTableView.dataSource = self;
[self.view addSubview:_brightTableView];
}
-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
return [_brightData count];
}
-(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
return 44.0f;
}
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
static NSString *CellIdentifier = @"BookmarkCell";
UITableViewCell *cell = (UITableViewCell*)[tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:CellIdentifier] autorelease];
cell.selectionStyle = UITableViewCellSelectionStyleGray;
}
NSString *string = [_brightData objectAtIndex:indexPath.row];
NSArray *array = [string componentsSeparatedByString:@" — "];
cell.textLabel.text = [array objectAtIndex:0];
cell.detailTextLabel.text = [array objectAtIndex:1];
return cell;
}
-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
NSString *string = [_brightData objectAtIndex:indexPath.row];
NSArray *array = [string componentsSeparatedByString:@" — "];
UIWebView *web = [[UIWebView alloc] initWithFrame:CGRectZero];
//web.hidden = YES;
[self.view addSubview:web];
NSURLRequest *req = [[NSURLRequest alloc] initWithURL:[NSURL URLWithString:[array objectAtIndex:1]]];
[web loadRequest:req];
[req release];
[web release];
/*
NSURL*url=[NSURL URLWithString:[array objectAtIndex:1]];
[[UIApplication sharedApplication] openURL:url];
*/
}
@end
iOS5开发:从程序里直接跳转到设置项的实现和代码分享(类似于金山电池医生功能,iOS5有效)相关推荐
- php程序里如何实现图片翻页,php图片上传代码一例-php 生成翻页链接(页码)列表的...-带多种分页方式的php分页类_169IT.COM...
Class PAGE { //类开始 /******************************************************** * $total 记录总数 * $ ...
- Java开发桌面程序学习(七)——ImageView设置图片以及jar包读取fxml文件
ImageView设置图片 JavaFx的ImageView,设置图片不能直接通过属性设置,只能通过代码来设置 ImageView设置图片 首先,我们让fxml对应的那个controller的java ...
- 自动跳转手机版和电脑版html代码,分享两个手机访问pc网站自动跳转手机端网站代码...
4G降临,移动网站已经一发不可收拾,pc端和移动端官网并存.如何让别人访问你的pc端的官网直接跳转到移动端的网站呢?各位看官,小二上代码!来了! 常用的访问pc自动跳转到移动页面的代码 (functi ...
- Android 类似《金山电池医生》里的那些电量时间是如何计算的?具体看图
跪求大神赐教!!!(参与研讨就酌情给分)
- 小程序高级电商前端第1周走进Web全栈工程师一----小程序注册、开发工具推荐、《风袖》首页布局详尽分析、Webstorm开发小程序必配配置、mock数据...
接下来开启一门全新的课程的学习,其实这是去年6月份所记录的,只是木有公开,然后到目前为止已经间隔了快1年没管了,基本上是已经快放弃的节奏,但是呢它又是我一直特别想学习的,所以决定公开,鞭策自己得继续前 ...
- 识别喜欢开发的程序员
识别一个程序员是否喜欢开发,在你遇到下面的情境时特别重要: 你要招募小伙伴 你要选择结对的开发人员 你想变得更好更强大(与优秀的人在一起事半功倍) 研发新产品,你要从公司内部抽调人手组建团队 你想判断 ...
- 开发小程序的正确方式
工欲善其事必先利其器,在开发小程序之前,不妨让我们先来了解清楚,什么是正确的方式与工具. 如同我们在<小程序的昨日与今天>一文中所说,小程序的开发并不需要配置任何开发环境,只需要安装官方的 ...
- 开发 web 程序服务 之 源码分析
文章目录 开发 web 程序服务 之 源码分析 前言 http 包源码 路由部分 监听和服务部分 mux 库源码 源码分析 创建路由 路由匹配 总结 开发 web 程序服务 之 源码分析 前言 本文的 ...
- android开发UI界面布局教学,android UI学习 -- 设置界面的布局(包括style的使用,selector的使用,Checkbox自定义样式,菜单项的样式)...
最终实现效果如下图: 具体来说就是实现了checkbox自定义选中和为选择样式,菜单项根据不同位置设置不同背景. 先上整体布局文件代码: xmlns:tools="http://schema ...
最新文章
- oracle之数据同步:Oracle Sql Loader使用说明(大批量快速插入数据库记录)
- 文件输入输出和string流
- 《计算机组成原理》实验报告——TEC-2实验系统——运算器实验
- python第三方库安装的各种方法(全网最全,最简单易懂)
- leetcode512. 游戏玩法分析 II(SQL)
- 【OpenCV 例程200篇】63. 图像锐化——Laplacian 算子
- 在java中使用关键字导入包_java的import关键字的使用
- Qt之QSS(白色靓丽)
- 第九届蓝桥杯快速排序java
- 备战软考,怎样复习才最有效?
- html怎么清除背景颜色,怎么去除Word复制网页内容的背景色?
- 自适应模糊神经网络算法,matlab模糊神经网络实例
- 2021人工智能状况分析报告
- 收藏 一句话问答 linux
- css横排文字光影效果_css3模糊发光文字动画特效
- npm --save-dev --save 的区别
- Python练习题:根据一段单词,找出其中的最长单词
- 基于matlab测量物体直径,基于MATLAB的零件尺寸检测误差分析的软件设计
- MT7687芯片资料MT7687原理图资料
- 利用JACK在Windows下PC之间传递声音
热门文章
- python儿童编程培训班-北京哪有儿童python编程培训班
- 珐琅彩瓷:是如何涨到天价的
- 通过用户名密码登陆人人网
- WM通信信息管理类软件评测
- python实现文件传输
- excel2013做数据透视表
- Python Flask构建微信小程序订餐系统 (一)
- zip 打包_一人一首流行最新歌曲精选MP3打包云盘ZIP下载
- rust进去弹出steam的对话框_电脑打开steam平台弹出一个英文框怎么办_电脑打开steam平台弹出一个英文框如何解决-系统城...
- 想要应聘银行工作,这些分析你都清楚吗?