Here is what I learned. Since iOS4,
[[UIScreen mainScreen] applicationFrame].size.width;
and
[[UIScreen mainScreen] applicationFrame].size.height;
"", "". = , iPhone4 4 . iPhone4, . , iPhone4 iPhone .
"" "-res", iPhone, ".png" "@2x.png" ( , ) . , .
, "img.png" , iPhone4 "img@2x.png", .
, / , .
"". . , -, , Wi-Fi - , "" ( " ".
, . , , iPhone4 , . , :
UIButton *myButton = [[UIButton alloc] initWithFrame:CGRectMake(0, 0, 100.0, 50.0)];
[indicatorButton setBackgroundImage:
[UIImage imageNamed:@"buttonImage.png"] forState:UIControlStateNormal];
, buttonImage.png - 200x100, . , 640x960 () , iPad, 320x480 , - :
+ (UIImage*)imageWithImage:(UIImage*)image newX:(float)newX newY:(float)newY{
CGSize newSize=CGSizeMake((CGFloat)newX, (CGFloat)newY);
UIGraphicsBeginImageContext(newSize);
[image drawInRect:CGRectMake(0,0,newX,newY)];
UIImage* newImage = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
return newImage;
}
iPhone4. . , - :
UIButton *myButton = [[UIButton alloc] initWithFrame:CGRectMake(0, 0, 100.0, 50.0)];
[indicatorButton setBackgroundImage:
[Utilities imageWithImage:[UIImage imageNamed:@"buttonImage.png"] newX:100 newY:50] forState:UIControlStateNormal];
, "" iPhone4.
, , iPhone4 ( , ), :
+(bool)imAnIphone4{
return([[UIScreen mainScreen]respondsToSelector:@selector(scale)] && [UIScreen mainScreen].scale==2);
}