attributedText
属性付きテキスト
@property(nonatomic, copy) NSAttributedString *attributedText
@NSCopying var attributedText: NSAttributedString?
解説
テキストフィールドの属性付きテキスト。
属性付きテキストを使用することで、部分的に色を変えたり、フォントやフォントサイズを変えることが出来ます。
設定値
@property(nonatomic, copy) NSAttributedString *attributedText
@NSCopying var attributedText: NSAttributedString?
フレームワーク
UIKit
クラス
UITextField
使用可能
iOS6.0
参照
NSAttributedString
UIFont
UIColor
関連記事(外部サイト)
例文
@IBOutlet weak var defaultTF: UITextField! //UITextField attributedText @IBAction func function003(sender: AnyObject) { var attrs = [NSForegroundColorAttributeName: UIColor.redColor(), NSFontAttributeName : UIFont.systemFontOfSize(19.0)] var aText : NSAttributedString = NSAttributedString(string: "属性付き文字", attributes: attrs) defaultTF.attributedText = aText }
UICollectionViewクラス
行、列でアイテムを配置して表示できるビュー
継承 | UIScrollView : UIView : UIResponder : NSObject |
準拠 | NSCoding (UIScrollView) |
NSCoding (UIView) | |
UIAppearance (UIView) | |
UIAppearanceContainer (UIView) | |
NSObject (NSObject) | |
フレームワーク | /System/Library/Frameworks/UIKit.framework |
使用可能 | iOS 6.0以降 |
定義 | UICollectionView.h |
概要
行、列でアイテムを配置して表示できるビュー
メソッドとプロパティ
コレクションビューの初期化
コレクションビューの設定
collectionViewLayout property
– setCollectionViewLayout:animated:
delegate property
dataSource property
backgroundView property
コレクションビューセルの作成
– registerClass:forCellWithReuseIdentifier:
– registerNib:forCellWithReuseIdentifier:
– registerClass:forSupplementaryViewOfKind:withReuseIdentifier:
– registerNib:forSupplementaryViewOfKind:withReuseIdentifier:
– dequeueReusableCellWithReuseIdentifier:forIndexPath:
– dequeueReusableSupplementaryViewOfKind:withReuseIdentifier:forIndexPath:
コレクションビューの状態の取得
セクションの挿入、移動、除去
セクションの管理
allowsSelection property
allowsMultipleSelection property
– indexPathsForSelectedItems
– selectItemAtIndexPath:animated:scrollPosition
– deselectItemAtIndexPath:animated
コレクションビューのアイテムの場所
– indexPathForItemAtPoint
– indexPathsForVisibleItems
– indexPathForCell
– cellForItemAtIndexPath
レイアウト情報の取得
– layoutAttributesForItemAtIndexPath
– layoutAttributesForSupplementaryElementOfKind:atIndexPath
ビューでアイテムのスクロール
コレクションビューの同時の変更
フレームワーク
UIKit
クラス
UICollectionView
参照
NSShadowクラス
継承 | NSObject |
準拠 | NSObject (NSObject) |
フレームワーク | /System/Library/Frameworks/UIKit.framework |
使用可能 | iOS 6.0以降 |
定義 | NSShadow.h |
概要
メソッドとプロパティ
シャドウの管理
shadowOffset property
shadowBlurRadius property
shadowColor property
フレームワーク
UIKit
クラス
NSShadow
参照
UIViewクラス
描画とイベントを扱う実体サブクラスを提供するための抽象クラス
解説
UIViewクラスは描画とイベントを扱う実体サブクラスを提供するための抽象クラスです。
継承 | UIResponder : NSObject |
準拠 | NSCoding |
UIAppearance | |
UIAppearanceContainer | |
NSObject (NSObject) | |
フレームワーク | /System/Library/Frameworks/UIKit.framework |
使用可能 | iOS 2.0以降 |
定義 | UIView.h |
概要
UIViewクラスは描画とイベントハンドリング構造の実体サブクラスを提供するための抽象クラスです。
他のビューを含むUIViewの実体インスタンスを作ることができます。
UIViewオブジェクトはUIWindowオブジェクトの中にサブビューの階層を持って配置されます。
ビュー階層の中で親オブジェクトはスーパービュー(superview)と呼ばれます。そして子オブジェクトはサブビュー(subview)と呼ばれます。
ビューオブジェクトはスーパービューの中で矩形領域を要求します、それはその領域でのすべての描画に責任があり、その上発生するイベントを受け取る資格があります。
兄弟ビューは問題なく重ねることができます。複雑なビューの配置ができます。
UIViewはビュー、UIViewControllerがビューをコントロールします。
Xcode5
Constraints:自動レイアウトの制限事項
Width Constraint:幅の制限
Relation:
Constant:
Priority:
Placeholder:
使用可能
iOS 2.0以降
メソッドとプロパティ
アトリビュートのセットとゲット
userInteractionEnabled property
ビュー階層の管理
superview property
subviews property
window property
– addSubview
– bringSubviewToFront
– sendSubviewToBack
– removeFromSuperview
– insertSubview:atIndex
– insertSubview:aboveSubview
– insertSubview:belowSubview
– exchangeSubviewAtIndex:withSubviewAtIndex
– isDescendantOfView:
サブビューのリサイジング
autoresizesSubviews property
autoresizingMask property
– sizeThatFits
– sizeToFit
contentMode property
contentStretch property
ビューの検索
tag property
– viewWithTag:
ビューのレイアウト
表示
clipsToBounds property
backgroundColor property
alpha property
opaque property
clearsContextBeforeDrawing property
– drawRect
– setNeedsDisplay
– setNeedsDisplayInRect
+ layerClass
layer property
hidden property
ビューのアニメーション
+ beginAnimations:context
+ commitAnimations
+ setAnimationStartDate
+ setAnimationsEnabled
+ setAnimationDelegate
+ setAnimationWillStartSelector
+ setAnimationDidStopSelector
+ setAnimationDuration
+ setAnimationDelay
+ setAnimationCurve
+ setAnimationRepeatCount
+ setAnimationRepeatAutoreverses
+ setAnimationBeginsFromCurrentState
+ setAnimationTransition:forView:cache
+ areAnimationsEnabled
イベントのハンドリング
– hitTest:withEvent
– pointInside:withEvent
multipleTouchEnabled property
exclusiveTouch property
– endEditing
UIApplicationクラス
アプリケーションクラス
解説
継承 | UIResponder : NSObject |
準拠 | NSObject (NSObject) |
フレームワーク | /System/Library/Frameworks/UIKit.framework |
使用可能 | iOS 2.0 以降 |
定義 | UIApplication.h |
概要
UIApplicationクラスは集中管理のポイントとiOSでのアプリケーションの実行調整を提供します。
すべてのアプリケーションはただ一つのUIApplication(またはそのサブクラス)のインスタンスを持たなければなりません。
アプリケーションが起動するとき、UIApplication関数が呼ばれます。
他のタスクの間で、この関数はシングルトンUIApplicationオブジェクトを作ります。
その後、+sharedApplicationクラスメソッドを起動してこのオブジェクトにアクセスすることができます。
UIAppicationオブジェクトの主な役割は、ユーザーイベントが到着したときイベントを振り分けます。
サブクラス化の注意
UIApplicationのサブクラスが -sendEvent: や -sendAction:to:from:forEvent: の実装がカスタムイベントやアクションをオーバーライドするか決定しなければならない。
使用可能
iOS 2.0以降
メソッドとプロパティ
アプリケーションのインスタンスを得る
+ sharedApplication
シングルトンアプリケーションインスタンスを返します。
デフォルトのインターフェースの向きの管理
イベントハンドリングのコントロール
– sendEvent:
イベントを送信します。
– sendAction:to:from:forEvent:
– beginIgnoringInteractionEvents
– endIgnoringInteractionEvents
– isIgnoringInteractionEvents
applicationSupportsShakeToEdit property
proximitySensingEnabled property iOS3.0で使用中止
URLリソースのオープン
– openURL:
指定したURLを開きます。
– canOpenURL
与えられたURLリソースがアプリケーションで開くことができるかを返します。
リモート通知の登録
– registerForRemoteNotificationTypes:
– unregisterForRemoteNotifications
– enabledRemoteNotificationTypes
アプリケーションアクティビティの管理
idleTimerDisabled property
自動スリープするか
バックグラウンドでの動作の管理
applicationState property
backgroundTimeRemaining property
– beginBackgroundTaskWithExpirationHandler:
– endBackgroundTask:
– setKeepAliveTimeout:handler:
– clearKeepAliveTimeout
Performing State Restoration Asynchronously
ローカル通知の登録
– scheduleLocalNotification:
– presentLocalNotificationNow:
– cancelLocalNotification:
– cancelAllLocalNotifications
scheduledLocalNotifications property
Determining the Availability of Protected Content
protectedDataAvailable property
リモート・コントロールイベントの登録
– beginReceivingRemoteControlEvents
– endReceivingRemoteControlEvents
ステータスバー操作の管理
– setStatusBarOrientation:animated:
statusBarOrientation property
statusBarOrientationAnimationDuration property
アプリケーションアピアランスの管理
– setStatusBarHidden:animated:
statusBarHidden property
– setStatusBarStyle:animated:
statusBarStyle property
statusBarFrame property
networkActivityIndicatorVisible property
applicationIconBadgeNumber property
スプリングボードでのアイコンバッチ番号
デリゲートのセットとゲット
delegate property
通知
UIApplicationDidBecomeActiveNotification
アプリケーションがアクティブになる通知
UIApplicationDidChangeStatusBarFrameNotification
ステータスバーのサイズが変更になった時に通知。向きが変わった時など
UIApplicationDidFinishLaunchingNotification
アプリケーションが起動しようとする通知
UIApplicationDidReceiveMemoryWarningNotification
メモリ不足の警告を通知
UIApplicationSignificantTimeChangeNotification
時間に変更があった場合の通知
UIApplicationWillChangeStatusBarOrientationNotification
デバイスの向きが変わろうとするときに通知
UIApplicationDidChangeStatusBarOrientationNotification
デバイスの向きが変わった後に通知
UIApplicationWillChangeStatusBarFrameNotification
ステータスバーのサイズが変更される直前に通知
UIApplicationWillResignActiveNotification
アプリケーションがアクティブでなくなろうとするときに通知
UIApplicationWillTerminateNotification
アプリケーションが終了しようとする通知