macOS/iOS API解説

iOS , Mac アプリケーション開発のために使われる主要フレームワークの日本語情報です。2010年代に書かれた内容です。今後更新はありません。

目次

UILabelクラス

ラベルのクラスです。

継承 UIView : UIResponder : NSObject
準拠 NSCoding
NSCoding (UIView)
NSObject (NSObject)
フレームワーク /System/Library/Frameworks/UIKit.framework
使用可能 iPhoneOS2.0
定義 UILabel.h

概要

編集不可なテキストで、iOS6から属性付きテキストが使用可能になりました。

UILabel *aView = [[UILabel alloc] initWithFrame:CGRectMake(0,0,320,80)];
	
	UIFont *aFont = [UIFont boldSystemFontOfSize:30];
	aView.font = aFont;
	aView.text = @"テキストです。";

参照

タスク

テキスト属性にアクセス

text property
font property
textColor property
textAlignment property
lineBreakMode property
enabled property

ラベルのテキストのサイズ

adjustsFontSizeToFitWidth property
baselineAdjustment property
minimumFontSize property
numberOfLines property

ハイライト値の管理

highlightedTextColor property
highlighted property

影の描画

shadowColor property
shadowOffset property

描画と位置のオーバーライド

– textRectForBounds:limitedToNumberOfLines– drawTextInRect

アトリビュートのセットとゲット

userInteractionEnabled property