macOS/iOS API解説

iOS , Mac アプリケーション開発のために使われる主要フレームワークの日本語情報です。2010年代に書かれた内容です。今後更新はありません。

目次

UIAppearanceプロトコル

INDEX>UIKit>

apple

アピアランスの変更を行います。
準拠 NSObject
フレームワーク /System/Library/Frameworks/UIKit.framework
使用可能 iOS 5.0以降
定義 UIAppearance.h

概要

アピアランスの変更を行います。
クラスに対して変更を行うことができるので、以降作成するオブジェクトに対して変更されたアピアランスが適用されます。(+ appearanceWhenContainedIn:)メソッドでは、あるオブジェクトに含まれる場合のみアピアランスを変更する、といったことが行えます。

アピアランスが適用されるのはaddSubview:で追加される時です。

#pragma mark UIAppearance  appearance:
- (IBAction)button002:(id)sender {
    //UIActivityIndicatorViewのアピアランス
    id aiAppearance = [UIActivityIndicatorView appearance];
    //UIButtonのアピアランス
    id buttonAppearance = [UIButton appearance];
    //UIActivityIndicatorViewのカラーをグリーンに
    [aiAppearance setColor:[UIColor greenColor]];
    //UIButtonのバックグラウンドカラーをグリーンに
    [buttonAppearance setBackgroundColor:[UIColor greenColor]];

}

メソッドとプロパティ

アピアランスの変更

+ appearance
+ appearanceWhenContainedIn

クラス

UIAppearance

参照

iPhoneアプリ開発エキスパートガイド iOS 6対応

iPhoneアプリ開発エキスパートガイド iOS 6対応


編集時のバージョン

OS X 10.8
iOS 7.0