- (UIImage *) allocImageByImgName:(NSString *)imageName {
NSString *pathStr = nil;
pathStr = [[NSBundle mainBundle] pathForResource:[NSString stringWithFormat:@"%@@2x",imageName] ofType:@"png"];
if ([[NSFileManager defaultManager] fileExistsAtPath:pathStr]) {
UIImage *image = [UIImage imageWithContentsOfFile:pathStr];
return [[UIImage alloc] initWithCGImage:[image CGImage] scale:2.0f orientation:UIImageOrientationUp];
}else {
pathStr = [[NSBundle mainBundle] pathForResource:imageName ofType:@"png"];
if ([[NSFileManager defaultManager] fileExistsAtPath:pathStr]) {
return [[UIImage alloc] initWithContentsOfFile:pathStr];
}else {
return nil;
}
}
}