FrontPage > Apple > iOS開発メモ > Cocoa Touch Layer(UIKit) > UIView

UIView (ビュー)

リファレンス

Apple リファレンス

継承

UIResponder > NSObject

関連項目

UIViewController

Creating Instances

initWithFrame

Initializes and returns a newly allocated view object with the specified frame rectangle.

- (id)initWithFrame:(CGRect)frame;

Setting and Getting Attributes

userInteractionEnabled

@property(nonatomic, getter=isUserInteractionEnabled) BOOL userInteractionEnabled

Modifying the Bounds and Frame Rectangles

frame

@property(nonatomic) CGRect frame

bounds

The receiver’s bounds rectangle, which expresses its location and size in its own coordinate system.

@property(nonatomic) CGRect bounds

center

The center of the frame.

@property(nonatomic) CGPoint center

transform

Specifies the transform applied to the receiver, relative to the center of its bounds.

@property(nonatomic) CGAffineTransform transform

Managing the View Hierarchy

superview

The receiver’s superview, or nil if it has none. (read-only)

@property(nonatomic, readonly) UIView *superview

subviews

The receiver’s immediate subviews. (read-only)

@property(nonatomic, readonly, copy) NSArray *subviews

window

The receiver’s window object, or nil if it has none. (read-only)

@property(nonatomic, readonly) UIWindow *window

addSubview

コンテンツ(UIView、UIViewサブクラス)を追加する。(表示設定用処理)

- (void)addSubview:(UIView *)view;

bringSubviewToFront

Moves the specified subview to the front of its siblings.

- (void)bringSubviewToFront:(UIView *)view;

sendSubviewToBack

Moves the specified subview to the back of its siblings.

- (void)sendSubviewToBack:(UIView *)view;

removeFromSuperview

Unlinks the receiver from its superview and its window, and removes it from the responder chain.

- (void)removeFromSuperview;

insertSubview

Inserts a subview at the specified index.

- (void)insertSubview:(UIView *)view atIndex:(NSInteger)index;

insertSubview

Inserts a view above another view in the view hierarchy.

- (void)insertSubview:(UIView *)view aboveSubview:(UIView *)siblingSubview;

insertSubview

Inserts a view below another view in the view hierarchy.

- (void)insertSubview:(UIView *)view belowSubview:(UIView *)siblingSubview;

exchangeSubviewAtIndex

Exchanges the subviews in the receiver at the given indices.

- (void)exchangeSubviewAtIndex:(NSInteger)index1 withSubviewAtIndex:(NSInteger)index2;

isDescendantOfView

Returns a Boolean value indicating whether the receiver is a subview of a given view or whether it is identical to that view.

- (BOOL)isDescendantOfView:(UIView *)view;

Converting Coordinates

convertPoint

Converts a point from the receiver’s coordinate system to that of a given view.

- (CGPoint)convertPoint:(CGPoint)point toView:(UIView *)view;

convertPoint

Converts a point from the coordinate system of a given view to that of the receiver.

- (CGPoint)convertPoint:(CGPoint)point fromView:(UIView *)view;

convertRect

Converts a rectangle from the receiver’s coordinate system to that of another view.

- (CGRect)convertRect:(CGRect)rect toView:(UIView *)view;

convertRect

Converts a rectangle from the coordinate system of another view to that of the receiver.

- (CGRect)convertRect:(CGRect)rect fromView:(UIView *)view;

contentScaleFactor

The scale factor applied to the view.

@property(nonatomic) CGFloat contentScaleFactor

Resizing Subviews

autoresizesSubviews

A Boolean value that determines whether the receiver automatically resizes its subviews when its frame size changes.

@property(nonatomic) BOOL autoresizesSubviews

autoresizingMask

An integer bit mask that determines how the receiver resizes itself when its bounds change.

@property(nonatomic) UIViewAutoresizing autoresizingMask

sizeThatFits

Asks the view to calculate and return the size that best fits its subviews.

- (CGSize)sizeThatFits:(CGSize)size;

sizeToFit

Resizes and moves the receiver view so it just encloses its subviews.

- (void)sizeToFit;

contentMode

A flag used to determine how a view lays out its content when its bounds rectangle changes.

@property(nonatomic) UIViewContentMode contentMode

contentStretch

The rectangle that defines the stretchable and nonstretchable regions of a view.

@property(nonatomic) CGRect contentStretch

Searching for Views

tag

The receiver’s tag, an integer that you can use to identify view objects in your application.

@property(nonatomic) NSInteger tag

viewWithTag

Returns the view with the specified tag.

- (UIView *)viewWithTag:(NSInteger)tag;

Laying out Views

setNeedsLayout

Sets whether subviews need to be rearranged before displaying.

- (void)setNeedsLayout;

layoutIfNeeded

Lays out the subviews if needed.

- (void)layoutIfNeeded;

layoutSubviews

Lays out subviews.

- (void)layoutSubviews;

Displaying

clipsToBounds

A Boolean value that determines whether subviews can be drawn outside the bounds of the receiver.

@property(nonatomic) BOOL clipsToBounds

backgroundColor

The receiver’s background color.

@property(nonatomic, copy) UIColor *backgroundColor

alpha

The receiver’s alpha value.

@property(nonatomic) CGFloat alpha

opaque

A Boolean value that determines whether the receiver is opaque.

@property(nonatomic, getter=isOpaque) BOOL opaque

clearsContextBeforeDrawing

A Boolean value that determines whether the receiver’s bounds should be automatically cleared before drawing.

@property(nonatomic) BOOL clearsContextBeforeDrawing

drawRect

Draws the receiver’s image within the passed-in rectangle.

- (void)drawRect:(CGRect)rect;

setNeedsDisplay

Controls whether the receiver's entire bounds rectangle is marked as needing display.

- (void)setNeedsDisplay;

setNeedsDisplayInRect

Marks the region of the receiver within the specified rectangle as needing display, increasing the receiver’s existing invalid region to include it.

- (void)setNeedsDisplayInRect:(CGRect)rect;

layerClass

Returns the class used to create the layer for instances of this class.

+ (Class)layerClass;

layer

The view’s Core Animation layer used for rendering. (read-only)

@property(nonatomic, readonly, retain) CALayer *layer

hidden

A Boolean value that determines whether the receiver is hidden.

@property(nonatomic, getter=isHidden) BOOL hidden

Animating Views with Blocks

animateWithDuration:animations:

Animate changes to one or more views using the specified duration.

+ (void)animateWithDuration:(NSTimeInterval)duration animations:(void (^)(void))animations

animateWithDuration:animations:completion:

Animate changes to one or more views using the specified duration and completion handler.

+ (void)animateWithDuration:(NSTimeInterval)duration animations:(void (^)(void))animations completion:(void (^)(BOOL finished))completion

animateWithDuration:delay:options:animations:completion:

Animate changes to one or more views using the specified duration, delay, options, and completion handler.

+ (void)animateWithDuration:(NSTimeInterval)duration delay:(NSTimeInterval)delay options:(UIViewAnimationOptions)options animations:(void (^)(void))animations

completion:(void (^)(BOOL finished))completion

transitionWithView

+ (void)transitionWithView:(UIView *)view duration:(NSTimeInterval)duration options:(UIViewAnimationOptions)options animations:(void (^)(void))animations completion:(void (^)(BOOL finished))completion __OSX_AVAILABLE_STARTING(__MAC_NA,__IPHONE_4_0);

transitionFromView

+ (void)transitionFromView:(UIView *)fromView toView:(UIView *)toView duration:(NSTimeInterval)duration options:(UIViewAnimationOptions)options completion:(void (^)(BOOL finished))completion __OSX_AVAILABLE_STARTING(__MAC_NA,__IPHONE_4_0);

Animating Views

beginAnimations

beginAnimations

+ (void)beginAnimations:(NSString *)animationID context:(void *)context

commitAnimations

+ (void)commitAnimations;

setAnimationStartDate

+ (void)setAnimationStartDate:(NSDate *)startDate;

setAnimationsEnabled

+ (void)setAnimationsEnabled:(BOOL)enabled;

setAnimationDelegate

+ (void)setAnimationDelegate:(id)delegate;

setAnimationWillStartSelector

+ (void)setAnimationWillStartSelector:(SEL)selector;

setAnimationDidStopSelector

+ (void)setAnimationDidStopSelector:(SEL)selector;

setAnimationDuration

+ (void)setAnimationDuration:(NSTimeInterval)duration;

setAnimationDelay

+ (void)setAnimationDelay:(NSTimeInterval)delay;

setAnimationCurve

+ (void)setAnimationCurve:(UIViewAnimationCurve)curve;

setAnimationRepeatCount

+ (void)setAnimationRepeatCount:(float)repeatCount;

setAnimationRepeatAutoreverses

+ (void)setAnimationRepeatAutoreverses:(BOOL)repeatAutoreverses;

setAnimationBeginsFromCurrentState

+ (void)setAnimationBeginsFromCurrentState:(BOOL)fromCurrentState;

setAnimationTransition:forView:cache

+ setAnimationTransition:forView:cache:+ (void)setAnimationTransition:(UIViewAnimationTransition)transition forView:(UIView *)view cache:(BOOL)cache;

areAnimationsEnabled

+ (BOOL)areAnimationsEnabled;

Handling Events

hitTest

- (UIView *)hitTest:(CGPoint)point withEvent:(UIEvent *)event;

pointInside

- (BOOL)pointInside:(CGPoint)point withEvent:(UIEvent *)event;

multipleTouchEnabled

multipleTouchEnabled  property

exclusiveTouch

exclusiveTouch  property

endEditing

- endEditing:

Managing Gesture Recognizers

addGestureRecognizer

- (void)addGestureRecognizer:(UIGestureRecognizer*)gestureRecognizer __OSX_AVAILABLE_STARTING(__MAC_NA,__IPHONE_3_2);

removeGestureRecognizer

- (void)removeGestureRecognizer:(UIGestureRecognizer*)gestureRecognizer __OSX_AVAILABLE_STARTING(__MAC_NA,__IPHONE_3_2);

gestureRecognizers

gestureRecognizers  property

Observing Changes

didAddSubview

- (void)didAddSubview:(UIView *)subview;

didMoveToSuperview

- (void)didMoveToSuperview;

didMoveToWindow

- (void)didMoveToWindow;

willMoveToSuperview

- (void)willMoveToSuperview:(UIView *)newSuperview;

willMoveToWindow

- (void)willMoveToWindow:(UIWindow *)newWindow;

willRemoveSubview

- (void)willRemoveSubview:(UIView *)subview;

トップ   編集 凍結 差分 履歴 添付 複製 名前変更 リロード   新規 一覧 検索 最終更新   ヘルプ   最終更新のRSS
Last-modified: 2010-08-23 (月) 14:02:11