iOS 5 で導入された新しい外観 API を使用して、それ以上のことを実現できます。
基本的に、UI の外観を一度設定すると、プログラム全体に反映されます。
の例を次に示しUIBarButtonItem
ます。
// You can also use stretchable images
UIImage *image = [[UIImage imageNamed:@"myCoolBarButton.png"] resizableImageWithCapInsets:UIEdgeInsetsMake(0, 5, 0, 5)];
[[UIBarButtonItem appearance] setBackgroundImage:image forState:UIControlStateNormal barMetrics:UIBarMetricsDefault];
iOS 5 を使用できない場合は、次のようにプログラムでビルドする必要があります。
// Create a custom button with an image
UIImage *image = [UIImage imageNamed:@"myCoolBarButton.png"];
UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom];
[button setImage:image forState:UIControlStateNormal];
button.frame = CGRectMake(0.0, 0.0, image.size.width, image.size.height);
// Create a custom UIBarButtonItem with the button
UIBarButtonItem aBarButtonItem = [[UIBarButtonItem alloc] initWithCustomView:aButton];
とにかく、外観に関する優れたチュートリアルのリンクがいくつかあります
iOS 5 でのユーザー インターフェイスのカスタマイズ
新しい iOS 5 Appearance API でアプリを際立たせる方法
編集:明確にするために、色、グラデーション、透明度をいじるよりも、カスタム画像を使用する方がはるかに簡単です。