0

各ビューにカスタム UIbuttons(10) を持つ 4 つの異なる UIView があります。each view 5 buttons -> redColor each view remaining 5 buttons->blue Color.

それでCSS in which I can define two different global classes、各クラスがボタンに適用するために必要なすべてのプロパティを持ち、ボタンの作成中にそのクラス名を宣言して、button will inherit all the properties of that class? Googleを調べたが何も見つからなかったようなものはありますか...

任意のアイデア/ヘルプをいただければ幸いです..

4

2 に答える 2

2

Objective-C でボタンのプロパティを定義する CSS の方法はありませんが、UIButton をサブクラス化し、赤の背景と青の背景の 2 つのメイン ボタンを作成できます。

于 2013-10-15T09:18:00.663 に答える
0

API は Cocoa Touch で CSS に相当する唯一のUIAppearanceものなので、カスタム サブクラスを使用したくない場合はこれを使用できます。

[[UIButton appearanceWhenContainedIn:[ViewController class], nil] setBackgroundColor:[UIColor blueColor];
于 2013-10-15T09:22:00.717 に答える