iPhone/iPad开发讲座 第五讲 定制视图和多点触摸
Upcoming SlideShare
Loading in...5
×
 

iPhone/iPad开发讲座 第五讲 定制视图和多点触摸

on

  • 7,609 views

 

Statistics

Views

Total Views
7,609
Views on SlideShare
7,316
Embed Views
293

Actions

Likes
22
Downloads
983
Comments
2

8 Embeds 293

http://www.alibuybuy.com 113
http://woshao.com 89
http://www.20ju.com 52
http://www.kkenet.com 28
http://kkenet.com 5
http://blog.tianya.cn 4
http://www.slideshare.net 1
http://www.readcolor.com 1
More...

Accessibility

Categories

Upload Details

Uploaded via as Apple Keynote

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
  • 开的多,怎么没人讨论呢?
    Are you sure you want to
    Your message goes here
    Processing…
  • kjhjkhjhkjkkhkj
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />

iPhone/iPad开发讲座 第五讲 定制视图和多点触摸 iPhone/iPad开发讲座 第五讲 定制视图和多点触摸 Presentation Transcript

  • iPhone/iPad Blog: http://tiny4.org/blog Twitter: @Tinyfool Mail/Gtalk: tinyfool@gmail.com
  • UIView • • • UIResponder • • view
  • View • Interface Builder view UIView - (void)addSubview:(UIView *)view; - (void)removeFromSuperview; • view - (void)insertSubview:(UIView *)view atIndex:(int)index; - (void)insertSubview:(UIView *)view belowSubview:(UIView *)view; - (void)insertSubview:(UIView *)view aboveSubview:(UIView *)view; - (void)exchangeSubviewAtIndex:(int)index withSubviewAtIndex: (int)otherIndex;
  • View • CGPoint • {x,y} • CGSize • {width,height} • CGRect
  • CGPoint,CGSize,CGRect
  • CGPoint,CGSize,CGRect
  • UIView • •y
  • frame bounds
  • • UIView • - (void)drawRect:(CGRect)rect; • - (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event; - (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event; - (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event; - (void)touchesCancelled:(NSSet *)touches withEvent:(UIEvent *)event;
  • - (void)drawRect:(CGRect)rect • -[UIView drawRect:] • backgroundColor • drawRect: • rect • drawRect:
  • • drawRect: ! • • View - (void)setNeedsDisplay; • - (void)setNumberOfSides:(int)sides { numberOfSides = sides; [polygonView setNeedsDisplay];
  • CoreGraphics Quartz 2D • UIKit UIRectFill(CGRect rect); UIRectFrame(CGRect rect); • CoreGraphics: API • CG C Base API Objective-C • CG Quartz 2D
  • • • PDF • drawRect: • path line • drawRect: (CGContextRef)UIGraphicsGetCurrentContext(void); • CG • drawRect:
  • CG • CG UIKit • UIColor *redColor = [UIColor redColor]; [redColor set]; • UIFont *font = [UIFont systemFontOfSize:14.0]; [myLabel setFont:font];
  • • -[NSString drawAtPoint:(CGPoint)point withFont: (UIFont *)font]
  • UIImage • UIImage: • • +[UIImage imageNamed:(NSString *)name] • • -[UIImage initWithContentsOfFile: (NSString *)path] •
  • • - [UIImage drawAtPoint:(CGPoint)point] • - [UIImage drawInRect:(CGRect)rect] • - [UIImage drawAsPatternInRect:(CGRect)rect]
  • • • • • CGGraphicsContext • •
  • • NSData *UIImagePNGRepresentation (UIImage * image); • NSData *UIImageJPGRepresentation (UIImage * image);
  • • • UITouch UIEvent • •
  • UITouch @property(nonatomic,readonly) NSTimeInterval timestamp; @property(nonatomic,readonly) UITouchPhase phase; @property(nonatomic,readonly) NSUInteger tapCount; @property(nonatomic,readonly,retain) UIWindow *window; @property(nonatomic,readonly,retain) UIView *view; - (CGPoint)locationInView:(UIView *)view; - (CGPoint)previousLocationInView:(UIView *)view;
  • UIEvent touch @property(nonatomic,readonly) NSTimeInterval timestamp; - (NSSet *)allTouches; - (NSSet *)touchesForWindow:(UIWindow *)window; - (NSSet *)touchesForView:(UIView *)view;
  • UIEvent - (NSSet *)allTouches; - (NSSet *)touchesForWindow:(UIWindow *)window; - (NSSet *)touchesForView:(UIView *)view;
  • UIResponder - (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event; - (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event; - (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event; - (void)touchesCancelled:(NSSet *)touches withEvent:(UIEvent *)event;
  • UIResponder
  • touchesBegan:withEvent:
  • touchesMoved:withEvent:
  • touchesEnded:withEvent:
  • touchesCancelled touchesCancelled:(NSSet*)touches withEvent:(UIEvent*)event