iphone5处理屏幕分辨率

iphone5处理屏幕分辨率,第1张

概述创建轻量UIDivece类别用以处理所有的屏幕分辨率 //// UIDevice+Resolutions.h// //// Created by HelenSong on 12-9-25.// Copyright (c) 2012年 . All rights reserved.//#import <UIKit/UIKit.h>enum { UIDevice_iP 创建轻量UIdivece类别用以处理所有的屏幕分辨率

////  UIDevice+Resolutions.h//  ////  Created by HelenSong on 12-9-25.//  copyright (c) 2012年 . All rights reserved.//#import <UIKit/UIKit.h>enum {    UIDevice_iPhonestandardRes      = 1,// iPhone 1,3,3GS Standard Resolution   (320x960px)    UIDevice_iPhoneHiRes            = 2,// iPhone 4,4S High Resolution          (640x960px)    UIDevice_iPhoneTallerHiRes      = 3,// iPhone 5 High Resolution             (640x1136px)    UIDevice_iPadStandardRes        = 4,// iPad 1,2 Standard Resolution         (1024x768px)    UIDevice_iPadHiRes              = 5     // iPad 3 High Resolution               (2048x1536px)}; typedef NSUInteger UIDeviceResolution;@interface UIDevice (Resolutions) { }+ (UIDeviceResolution) currentResolution;@end

////  UIDevice+Resolutions.m//  ////  Created by HelenSong on 12-9-25.//  copyright (c) 2012年 . All rights reserved.//#import "UIDevice+Resolutions.h"@implementation UIDevice (Resolutions)+ (UIDeviceResolution) currentResolution {    if(UI_USER_INTERFACE_IdioM() == UIUserInterfaceIdiomPhone){        if ([[UIScreen mainScreen] respondsToSelector: @selector(scale)]) {            CGSize result = [[UIScreen mainScreen] bounds].size;            result = CGSizeMake(result.wIDth * [UIScreen mainScreen].scale,result.height * [UIScreen mainScreen].scale);            return (result.height == 960 ? UIDevice_iPhoneHiRes : UIDevice_iPhoneTallerHiRes);        } else            return UIDevice_iPhonestandardRes;    } else        return (([[UIScreen mainScreen] respondsToSelector: @selector(scale)]) ? UIDevice_iPadHiRes : UIDevice_iPadStandardRes);}@end

方法二:使用宏定义方式判断是否为iphone5


#define iPhone5 ([UIScreen instancesRespondToSelector:@selector(currentMode)] ? CGSizeEqualToSize(CGSizeMake(640,1136),[[UIScreen mainScreen] currentMode].size) : NO)

if (!iPhone5) {        [[NSBundle mainBundle]loadNibnamed:@"xxxController" owner:self options:nil];      }else {        [[NSBundle mainBundle]loadNibnamed:@"xxxController4inch" owner:self options:nil];    }
总结

以上是内存溢出为你收集整理的iphone5处理屏幕分辨率全部内容,希望文章能够帮你解决iphone5处理屏幕分辨率所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/web/1089507.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-05-27
下一篇 2022-05-27

发表评论

登录后才能评论

评论列表(0条)

保存