当我跑3.5英寸时,游戏运行良好。 像这样:
升级前,4.0英寸的运行也不错。 像这样的代码:
#import <Foundation/Foundation.h>
@interface UIImage(iPhone5Extension)
+ (UIImage *)imageNamedWithiPhone5:(NSString *)name imageTyped:(NSString *)type;
@end
#import "UIImage+iPhone5.h"
@implementation UIImage(iPhone5Extension)
+ (UIImage *)imageNamedWithiPhone5:(NSString *)name imageTyped:(NSString *)type
{
NSString *imgName = nil;
if ([type length]==0) {
type = @"png";
} else {
type = type;
}
if (IS_IPHONE5) {
imgName = [NSString stringWithFormat:@"%@-568h",name];
} else {
imgName = name;
}
NSString *path = [[NSBundle mainBundle] pathForResource:imgName ofType:type];
UIImage *image = [UIImage imageWithContentsOfFile:path];
return image;
}
@end
然后在ViewDidLoad中:
- (void)viewDidLoad
{
[super viewDidLoad];
self.DefaultImageView.image = [UIImage imageNamedWithiPhone5: @"Title" imageTyped:@"png"];
}
但是,我有3种类型的图片: Title.png/Title@2x.png/Title-586h.png
但是在我升级到最新的xCode之后,运行3.5英寸是好的,但是跑了4.0英寸模式,图像变得像这样......
不确定发生了什么!!! 那么我怎样才能恢复它(在4英寸模式下也很好?)
提前致谢!!!