zoukankan      html  css  js  c++  java
  • 切换根控制器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];
     
     
     
     
     
  • 相关阅读:
    PHP filter_input_array() 函数
    pt-query-digest 用法
    [SDOI2017]苹果树
    C# json 转 xml 字符串
    C# json 转 xml 字符串
    C# double 好用的扩展
    C# double 好用的扩展
    win10 uwp 使用 Microsoft.Graph 发送邮件
    win10 uwp 使用 Microsoft.Graph 发送邮件
    Sublime Text 安装中文、英文字体
  • 原文地址:https://www.cnblogs.com/wangshengl9263/p/3231650.html
Copyright © 2011-2022 走看看