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

  関連記事

eyechatch_xcode_tips-300x300
Xcode6 GameCenter 実装

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

no image
iPhone画面サイズ

3.5inch 320 x 480px (Retina 640 x 960px) …

eyechatch_xcode_tips-300x300
SNS連携

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

eyechatch_xcode_tips-300x300
transform中の座標取得

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

no image
CGAffineTransformIdentity

アフィン変換がされたビューを,初期状態(アフィン変換がされていない状態)に戻す …

no image
UIView

タイトル画面の背景など、新たにビューを追加した場合 UIViewを生成し sel …

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

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

no image
UIImageView 画像の差し替え

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

no image
UIViewを透明にする

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

eyechatch_xcode_tips-300x300
配列にNSNumberをぶちこむ

配列から数値を直に取り出したい場合はどうするのかと調べてみたのでメモ。 NSNu …