我有編程方式創建按鈕的代碼,這裏是SETFRAME - 我需要一些澄清這個
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。然後我有不同的圖像「[email protected]和[email protected]」,他們應該與不同的CGRectMake,或者他們應該?我的問題是如何爲兩種分辨率設置按鈕,並以編程方式執行此操作。
無論大小給定,在視網膜或簡單的iPhone顯示屏上自動調整圖片的大小都不會有問題。但要確保@ 2x的雙倍大小圖像存在 – Hiren 2012-02-09 13:03:15
,所以我的代碼可以用於Iphone5>;那麼@ HChouhan02的答案呢? – Spire 2012-02-09 13:10:41
他不清楚這個問題。並確保它不是iPhone 5.這是一個屏幕差異簡單和視網膜像iPhone 2,3,3 3G Vs iPhone 4,4s – Hiren 2012-02-09 13:15:24