zoukankan      html  css  js  c++  java
  • iOS: 创建universal app

    universal app supports both ipad and iphone。要了解universal如何支持both ipad and iphone,最直接的方法就是创建一个universal project。

    universal project的基本特点:

    1. target > summary > devices is universal

    2. xib for ipad and xib for iphone can share the same view controller,当然使用不同的view controller绝对没问题。

    3. in appdelegate.m didFinishLaunchingWithOptions method, use following code to 根据device是ipad还是iphone来指定 access 不同的 view

    1.     self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];  
    2.   
    3.     if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPhone) {  
    4.         self.viewController = [[ViewController alloc] initWithNibName:@"ViewController_iPhone" bundle:nil];  
    5.     } else {  
    6.         self.viewController = [[ViewController alloc] initWithNibName:@"ViewController_iPad" bundle:nil];  
    7.     }  
    8.   
    9. <pre name="code" class="cpp">    self.window.rootViewController = self.viewController;</pre> [self.window makeKeyAndVisible];<p></p>  
    10. <pre></pre>  
    11. <br>  
    12. 4. 其他class还可以通过<br>  
    13. <p></p>  
    14. <p></p><pre name="code" class="cpp">[[UIDevice currentDevice] userInterfaceIdiom]</pre>来判断是ipad还是iphone来执行不同的代码<p></p>  
    15. <p><br>  
    16. </p>  
    17. <p><strong><span style="color:#ff0000">如何把iphone app转换成universal app?</span></strong></p>  
    18. <p>非常简单,只需要把target > summary > devices option设置为universal即可。当然你要自己创建一组for ipad的ui,并在delegate.m里根据device指定不同的view。</p>  
    19. <p><br>  
    20. </p>  
    21. <p>ref links:</p>  
    22. <p><a href="http://richielin-programer.blogspot.com/2010/06/iphone-ipad-universal-app.html">http://richielin-programer.blogspot.com/2010/06/iphone-ipad-universal-app.html</a><br>  
    23. </p>  
    24. <p><a href="http://iphonedevelopment.blogspot.com/2010/04/converting-iphone-apps-to-universal.html">http://iphonedevelopment.blogspot.com/2010/04/converting-iphone-apps-to-universal.html</a><br>  
    25. </p>  
    26. <p><br>  
    27. </p>  
    28. <p><br>  
    29. </p>  
    30. <div><br>  
    31. </div>  
  • 相关阅读:
    2019-8-31-C#-标准性能测试高级用法
    2018-8-29-Roslyn-通过-Target-修改编译的文件
    2018-8-29-Roslyn-通过-Target-修改编译的文件
    2018-2-13-图论-Warshall-和Floyd-矩阵传递闭包
    2018-2-13-图论-Warshall-和Floyd-矩阵传递闭包
    2019-10-26-Inno-Setup-安装包脚本-Run-的-Flags-标记
    netfilter
    mmap内存映射
    vim替换字符串
    vim环境配置
  • 原文地址:https://www.cnblogs.com/lvyinbentengzhe/p/4192075.html
Copyright © 2011-2022 走看看