切换根控制器UIApplication 主屏幕UIScreen 读取文件资源NSBundle


1 //主屏幕设为webView
2 CGRect frame = [UIScreen mainScreen].applicationFrame;
3 UIWebView *webView = [[[UIWebView alloc] initWithFrame:frame] autorelease];
4 self.view = webView;

 

1 UIApplication *app = [UIApplication sharedApplication];
2 // 显示状态栏
3  app.statusBarHidden = NO;
4 ChangeController *index = [[ChangeController alloc] init];
5 // 设置窗口的根控制器
6 app.keyWindow.rootViewController = index;
7 [index release];

 

1 //回到根控制器
2 popToRootViewControllerAnimationed:YES
3 //返回
4 popViewControllerAnimated


 

  id key = (id)kCFBundleVersionKey;
1
// 检测是否第一次使用这个版本 info.plist 2 NSDictionary *info = [NSBundle mainBundle].infoDictionary; 3 NSString *currentVersion = [info objectForKey:key]; 4 5 // 从沙盒中取出版本号 6 NSUserDefaults *defaults =[NSUserDefaults standardUserDefaults]; 7 NSString *saveVersion = [defaults objectForKey:key];

 

1 //获取图片
2  NSString *path = [[NSBuddle mainBuddle] pathForResource:@"resourceName" oftype@"plist"];
3 UIImage *image = [[UIImage imageWithContentsOfFile:path];
4 UIImage *image = [UIImage imageNamed:@"imageName"];
5 
6 //获取plist文件
7 NSArray *array =[[NSArrayalloc] initWithContentsOfFile:[[NSBundle mainBundle]  pathForResource:@"name" ofType:@"plist"]];
8 NSDictionary *dict=[array objectAtIndex:index];

 

 
 
 
 
 
posted @ 2013-08-02 01:59  wangzhenxiang  阅读(230)  评论(0编辑  收藏  举报