最終更新:2013-01-11 (金) 03:06:10 (4095d)
UIView
Top / UIView
画面表示を管理するクラス
Tasks
Initializing a View Object
- initWithFrame?
Configuring a View’s Visual Appearance
- backgroundColor? - property - (UIColor)
- hidden? - property - (BOOL)
- alpha? - property - (CGFloat)
- opaque? - property - (BOOL)
- clipsToBounds? - property - (BOOL)
- clearsContextBeforeDrawing? - property - (BOOL)
- +layerClass?
- layer? - property - (CALayer?)
Configuring the Event-Related Behavior
- userInteractionEnabled? - property - (BOOL)
- multipleTouchEnabled? - property - (BOOL)
- exclusiveTouch? - property - (BOOL)
Configuring the Bounds and Frame Rectangles
- frame? - property - (CGRect)
- bounds? - property - (CGRect)
- center? - property - (CGPoint)
- transform - property - (CGAffineTransform?)
Managing the View Hierarchy
- superview? - property - (UIView)
- subviews? - property - (NSArray)
- window - property - (UIWindow)
- addSubview?
- bringSubviewToFront?
- sendSubviewToBack?
- removeFromSuperview?
- insertSubview:atIndex?
- insertSubview:aboveSubview?
- insertSubview:belowSubview?
- exchangeSubviewAtIndex:withSubviewAtIndex?
- isDescendantOfView?
Configuring the Resizing Behavior
- autoresizingMask? - property - (UIViewAutoresizing?)
- autoresizesSubviews? - property - (BOOL)
- contentMode? - property - (UIViewContentMode?)
- sizeThatFits?
- sizeToFit?
- contentStretch? - property - (CGRect) Deprecated in iOS 6.0
Laying out Subviews
Opting in to Constraint-Based Layout
- +requiresConstraintBasedLayout?
- translatesAutoresizingMaskIntoConstraints?
- setTranslatesAutoresizingMaskIntoConstraints?
Managing Constraints
Measuring in Constraint-Based Layout
- systemLayoutSizeFittingSize?
- intrinsicContentSize?
- invalidateIntrinsicContentSize?
- contentCompressionResistancePriorityForAxis?
- setContentCompressionResistancePriority:forAxis?
- contentHuggingPriorityForAxis?
- setContentHuggingPriority:forAxis?
Aligning Views with Constraint-Based Layout
Triggering Constraint-Based Layout
Debugging Constraint-Based Layout
Drawing and Updating the View
- drawRect?
- setNeedsDisplay
- setNeedsDisplayInRect?
- contentScaleFactor? - property - (CGFloat)
Formatting Printed View Content
Managing Gesture Recognizers
- addGestureRecognizer?
- removeGestureRecognizer?
- gestureRecognizers? - property - (NSArray)
- gestureRecognizerShouldBegin?
Animating Views with Blocks
- +animateWithDuration:delay:options:animations:completion?
- +animateWithDuration:animations:completion?
- +animateWithDuration:animations?
- +transitionWithView:duration:options:animations:completion?
- +transitionFromView:toView:duration:options:completion?
Animating Views
- Use of the methods in this section is discouraged in iOS 4 and later. Use the block-based animation methods instead.
- +beginAnimations:context?
- +commitAnimations?
- +setAnimationStartDate?
- +setAnimationsEnabled?
- +setAnimationDelegate?
- +setAnimationWillStartSelector?
- +setAnimationDidStopSelector?
- +setAnimationDuration?
- +setAnimationDelay?
- +setAnimationCurve?
- +setAnimationRepeatCount?
- +setAnimationRepeatAutoreverses?
- +setAnimationBeginsFromCurrentState?
- +setAnimationTransition:forView:cache?
- +areAnimationsEnabled?
Preserving and Restoring State
- restorationIdentifier? - property - (NSString)
- encodeRestorableStateWithCoder?
- decodeRestorableStateWithCoder?
Identifying the View at Runtime
Converting Between View Coordinate Systems
Hit Testing in a View
Ending a View Editing Session
- endEditing?
Observing View-Related Changes
- didAddSubview?
- willRemoveSubview?
- willMoveToSuperview?
- didMoveToSuperview?
- willMoveToWindow?
- didMoveToWindow?
描画
- UIViewのサブクラスを作成して
- (void)drawRect:(CGRect)rect { // Drawing code // グラフィックコンテキスト取得 CGContextRef context = UIGraphicsGetCurrentContext(); // CoreGraphicsの原点が左下なので原点を合わせる CGContextTranslateCTM(context, 0, rect.size.height); CGContextScaleCTM(context, 1.0, -1.0); // 線の色を R,G,B,A で設定 CGContextSetRGBStrokeColor(context, 0.0, 1.0, 0.0, 1.0); // 線の太さ CGContextSetLineWidth(context, 10); // Pathを作成 CGContextBeginPath(context); // Pathの位置設定 CGContextMoveToPoint(context, 100.0, 100.0); CGContextAddLineToPoint(context, 50.0, 150.0); CGContextAddLineToPoint(context, 100.0, 150.0); // Pathの描画 CGContextDrawPath(context, kCGPathStroke); NSString* str = [NSString stringWithFormat:@"Elapsed time: %f", -elapsedTime]; UIFont *font = [UIFont systemFontOfSize:24]; [[UIColor whiteColor] set];//色 [str drawAtPoint:CGPointMake(0,0) withFont:font]; }
再描画
メモ
- 概念上は、iPhone OSのウインドウとビューは、Mac OS Xの場合と同様に同じ構成体を表しています。しかし、実装の観点では、この2つのプラットフォームはウインドウとビューをまったく異なった方法で実装しています。Mac OS Xでは、NSWindowクラスはNSResponderのサブクラスですが、iPhone OSでは、UIWindowクラスは実際はUIViewのサブクラスです。この継承関係の違いは、ウインドウがCore Animationレイヤを使用して描画サーフェスを実現していることを意味します。UIKitのすべてでウインドウオブジェクトを持つ理由は、オペレーティングシステム内でウインドウのレイヤ化をサポートするためです。
下位クラス
- UIWindow
- UILabel
- UIPickerView
- UIProgressView?
- UIActivityIndicatorView
- UIImageView
- UITabBar?
- UIToolbar?
- UINavigationBar
- UITableViewCell
- UIActionSheet
- UIAlertView
- UIScrollView
- UISearchBar?
- UIWebView
- UIControl
- UIButton
- UIDatePicker?
- UIPageControl
- UISegmentedControl
- UITextField
- UISlider?
- UISwitch?