CocoaDev

Edit AllPages

Part of the iPhone General/UIKit framework. Subclass of General/UIResponder. So very much like General/NSView.

- (id)initWithFrame:(General/CGRect)rect;

Designated initializer.

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

- (void)drawRect:(General/CGRect)rect;

Since we don’t have a General/UIGraphicsContext class, General/CoreGraphics is our friend now. All those CG calls need a General/CGContextRef, and here’s how you get it:

  General/CGContextRef General/UICurrentContext();

- (void)setNeedsDisplay;

- (void)setNeedsDisplayInRect:(General/CGRect)rect;

- (General/CGRect)frame;

- (General/CGRect)bounds;

- (void)setTapDelegate:(id)delegate;

Sets the tap delegate. See below.

** Swiping! **

typedef enum { kUIViewSwipeUp = 1, kUIViewSwipeDown = 2, kUIViewSwipeLeft = 4, kUIViewSwipeRight = 8 } General/UIViewSwipeDirection;

- (BOOL)canHandleSwipes;

- (int)swipe:(General/UIViewSwipeDirection)num withEvent:(General/GSEvent*)event;

This one is listed in the General/UIView-General/LKLayerDelegate.h header, and the iTetris demo uses it to good effect, but it does nothing for me. Can’t tell why, but I don’t really get layers yet..

- (void)drawLayer:(id)inLayer inContext:(General/CGContextRef)inContext;


iTetris follows some bad practices when it comes to drawing. A General/UIView is transparently backed by an General/LKLayer, and the view uses this method to draw itself internally, so don’t override it! Just use -drawRect: and everything will work as expected. – Lucas Newman —-

** Tap delegate methods **

view:handleTapWithCount:event:

view:handleTapWithCount:event:fingerCount:

viewHandleTouchPause:isDown:

viewDoubleTapDelay:

viewRejectAsTapThrehold:

viewTouchPauseThreshold: