アットウィキロゴ

UIButton

/*
UIButton の隠し API -> http://d.hatena.ne.jp/KishikawaKatsumi/20100507/1273198706
*/
 
// ボタンの生成
UIButton *btn = [UIButton buttonWithType:UIButtonTypeRoundedRect];
btn.frame = CGRectMake(0, 0, 50, 30);
 
typedef enum {
   UIButtonTypeCustom = 0,// 背景画像
   UIButtonTypeRoundedRect,// 角丸
   UIButtonTypeDetailDisclosure,// 詳細へ
   UIButtonTypeInfoLight,// インフォ(明)
   UIButtonTypeInfoDark,// インフォ(暗)
   UIButtonTypeContactAdd,// 追加
} UIButtonType;
 
// ボタンラベル
[btn setTitle:@"タップ" forState:UIControlStateNormal];
 
// ボタンイベント
[btn 
   addTarget:self // イベント時呼び出すメソッドのあるクラス
   action:@selector(btnClick:) // イベント時呼び出すメソッド
   forControlEvents:UIControlEventTouchUpInside // イベント
];

タグ:

+ タグ編集
  • タグ:
最終更新:2012年10月04日 09:23
ツールボックス

下から選んでください:

新しいページを作成する
ヘルプ / FAQ もご覧ください。