ボタン背景

UIEdgeInsets insets = UIEdgeInsetsMake(20, 5, 20, 5);
[[UIImage imageNamed:fileName] resizableImageWithCapInsets:insets];
で作ったimageをbackgroundに設定する。

ボタン背景に他に画像を入れたい

imageプロパティに設定する。その画像はsetImageEdgeInsetsで場所を調整可能。

ボタン文字の左寄せ

 [button setContentHorizontalAlignment:UIControlContentHorizontalAlignmentLeft];


マージンの設定

   UIEdgeInsets insets;
   insets.left = insets.right = 10.0f;
   insets.top = insets.bottom = 0.0f;
   button.contentEdgeInsets = insets;

最終更新:2012年10月01日 16:38