如果未采用 xib,如何使视图控制器与 iphone 5 兼容 [英] how to make the view controller compatible with iphone 5 if xib not taken

查看:25
本文介绍了如果未采用 xib,如何使视图控制器与 iphone 5 兼容的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果没有使用 xib 文件,视图控制器如何与 iphone 5 兼容.是否可以以编程方式进行更改.提前致谢.

How can a view controller be make compatible with iphone 5 if it's xib file not taken. Is it possible to make that change programmatically. Thanks in advance.

推荐答案

是的,你可以做到这一点.XIB 也只是文件,只需在文本编辑器中打开一个文件 - 您会看到它由可读的 xml 代码组成.现在为了使 viewController 与 Iphone 5 兼容,只需放置 if else 条件并通过检查特定设备的高度为不同设备分别制作
但毫无疑问,这将是一项长期的工作

Yes defiantly you can do this. XIB are just files too just open one in a texteditor - you'll see that it consists of readable xml code. now for making viewController compatible with Iphone 5 just put if else condition and make thing separately for different devices by checking height of particular device
but defiantly its going to be long job

对于我的通用应用程序外汇应用程序,我只是像这样使用屏幕高度检测概念:

For my universal app, Forex App, I'm simply using the screen height detection concept like so:

CGSize screenSize = [[UIScreen mainScreen] bounds].size;

if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone) {
    if (screenSize.height > 480.0f) {
        /*Do iPhone 5 stuff here.*/
    } else {
        /*Do iPhone Classic stuff here.*/
    }
} else {
    /*Do iPad stuff here.*/
}

这篇关于如果未采用 xib,如何使视图控制器与 iphone 5 兼容的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆