ボタンをプログラムで作成するためのコードがあります。
UIImage *aroundImage = [UIImage imageNamed:@"locBar.png"];
UIImage *aroundImageDown = [UIImage imageNamed:@"locBarColor.png"];
UIButton *aroundButton = [UIButton buttonWithType:UIButtonTypeCustom];
[aroundButton setFrame:CGRectMake(240, 369, 80, 48)];
[aroundButton setImage:aroundImage forState:UIControlStateNormal];
[aroundButton setImage:aroundImageDown forState:UIControlStateHighlighted];
[aroundButton setImage:aroundImageDown forState:UIControlStateSelected];
[aroundButton addTarget:self action:@selector(aroundMe) forControlEvents:UIControlEventTouchUpInside];
[self.view addSubview:aroundButton];
これでボタンのフレームを設定しましたが、このアプリが iPhone4 で 640x960 で表示されるとどうなりますか。次に、「locBar@2x.pngとlocBarColor@2x.png」という異なる画像があり、それらは異なるCGRectMakeを使用する必要がありますか? 私の質問は、両方の解像度のボタンをどのように設定し、それをプログラムで行うかです。