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ファ …

no image
CheatSheet

Xcodeの便利なショートカットキー 良く使ってるなと感じたら追記 Cmd+Al …

eyechatch_xcode_tips-300x300
transform中の座標取得

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

no image
アプリの名前をつける

iPhoneのホーム画面に表示される「アプリ名」の付け方 アプリ名の変更には上 …

eyechatch_xcode_tips-300x300
SNS連携

Twitter・Facebookとの連携は #import <Social …

eyechatch_xcode_tips-300x300
.selected

インスタンス名.selected で BOOLを宣言せずにボタンのON/OFF状 …

no image
UIImageView 画像の差し替え

[UIImageView alloc] 後の画像を変換する時は下記コードを参照し …

no image
NSArray valueForkeypath関数

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

eyechatch_xcode_tips-300x300
負の数を絶対数へ変換 abs

負の数を自然数(マイナスを含まない数字)にしたくて、「Xcode 自然数 変換」 …

eyechatch_xcode_tips-300x300
Xcode6 GameCenter 実装

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