Tabs

iPhone&Androidのアプリ制作・デザイン

*

テキストの文字間を詰める

   


UILabelなどで文字間を詰める(カーニング)したい時がちょいちょいあると思います。
覚えたことをメモメモ…
以下、ラベルにテキストを貼ってからの作業です。

// Hogeラベルの文字間を詰める
NSMutableAttributedString *attributedText =                  [[NSMutableAttributedStringalloc]initWithString:Hoge_Label.text];

[attributedText addAttribute:NSKernAttributeName value:
[NSNumber numberWithFloat:-0.1] range:NSMakeRange(0, attributedText.length)];

Hoge_Label.attributedText = attributedText;

numberWithFloat:(0.0f) で文字間を詰めることが出来ます。
0がデフォルトです。


 - Begin

  関連記事

no image
BGM・SE 導入方法

音楽:導入方法 1… AVFoundationフレームワークを追加 2… hファ …

eyechatch_xcode_tips-300x300
Xcode6 GameCenter 実装

Xcode6(iOS7以上)でのGameCenter実装 検索であまり見つからな …

no image
UIImageViewにボタンを貼りたい場合

タイトル画面などを作りたい場合、UIImageViewを使用して背景などを作るこ …

eyechatch_xcode_tips-300x300
transform中の座標取得

CGAffineTransformを使用して画像を変化させている最中の座標取得方 …

eyechatch_xcode_tips-300x300
UIButton 同時押し制御

UIButton *myBtn = [UIButton alloc] init] …

no image
画面ローテーション

画面ローテーションを制御する場合は下記を追加する – (BOOL)s …

no image
UIViewを透明にする

// opaque属性にNOを設定する事で、背景透過を許可する。 UIView …

no image
タッチイベント:有効・無効

// タッチイベントを有効にしたい場合の処理 [[UIApplication s …

no image
SubViewの重ね順を変更する

SubViewの重ね順を最前面に移動する場合 bringSubviewToFro …

no image
NSArray valueForkeypath関数

NSArrayやNSDictionaryを多用する人にお勧めですCoreData …