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