Your SlideShare is downloading. ×
0
iPhone/iPad


              Blog: http://tiny4.org/blog
                     Twitter: @Tinyfool
        Mail/Gtalk: tinyfo...
UIView
•
•
•              UIResponder

•
    •   view
View

•     Interface Builder            view            UIView
    - (void)addSubview:(UIView *)view;
    - (void)removeF...
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:(UIEven...
- (void)drawRect:(CGRect)rect


•   -[UIView drawRect:]

    •                      backgroundColor

•           drawRect:...
•   drawRect:                               !

•
•          View
    - (void)setNeedsDisplay;

•
    - (void)setNumberOfSi...
CoreGraphics                                 Quartz 2D
•   UIKit
      UIRectFill(CGRect rect);
      UIRectFrame(CGRect r...
•
•                                   PDF

•        drawRect:

    •                 path   line

    •     drawRect:
    ...
CG

•           CG             UIKit
    •   UIColor *redColor = [UIColor redColor];
        [redColor set];

    •   UIFo...
•   -[NSString drawAtPoint:(CGPoint)point withFont:
    (UIFont *)font]
UIImage
•       UIImage:

    •
        •   +[UIImage imageNamed:(NSString
            *)name]

    •
        •   -[UIImag...
•   - [UIImage drawAtPoint:(CGPoint)point]

•   - [UIImage drawInRect:(CGRect)rect]

•   - [UIImage drawAsPatternInRect:(C...
•
•
•
    •   CGGraphicsContext

    •
    •
•   NSData *UIImagePNGRepresentation (UIImage * image);

•   NSData *UIImageJPGRepresentation (UIImage * image);
•
•   UITouch UIEvent

•
•
UITouch

@property(nonatomic,readonly) NSTimeInterval	timestamp;
@property(nonatomic,readonly) UITouchPhase phase;
@proper...
UIEvent
                                 touch




@property(nonatomic,readonly) NSTimeInterval
timestamp;

- (NSSet *)all...
UIEvent
- (NSSet *)allTouches;
- (NSSet *)touchesForWindow:(UIWindow *)window;
- (NSSet *)touchesForView:(UIView *)view;
UIResponder
- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event;
- (void)touchesMoved:(NSSet *)touches withEv...
UIResponder
touchesBegan:withEvent:
touchesMoved:withEvent:
touchesEnded:withEvent:
touchesCancelled




touchesCancelled:(NSSet*)touches withEvent:(UIEvent*)event
iPhone/iPad开发讲座 第五讲 定制视图和多点触摸
iPhone/iPad开发讲座 第五讲 定制视图和多点触摸
iPhone/iPad开发讲座 第五讲 定制视图和多点触摸
Upcoming SlideShare
Loading in...5
×

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

7,049

Published on

2 Comments
22 Likes
Statistics
Notes
No Downloads
Views
Total Views
7,049
On Slideshare
0
From Embeds
0
Number of Embeds
3
Actions
Shares
0
Downloads
992
Comments
2
Likes
22
Embeds 0
No embeds

No notes for slide
































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

    1. 1. iPhone/iPad Blog: http://tiny4.org/blog Twitter: @Tinyfool Mail/Gtalk: tinyfool@gmail.com
    2. 2. UIView • • • UIResponder • • view
    3. 3. 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;
    4. 4. View • CGPoint • {x,y} • CGSize • {width,height} • CGRect
    5. 5. CGPoint,CGSize,CGRect
    6. 6. CGPoint,CGSize,CGRect
    7. 7. UIView • •y
    8. 8. frame bounds
    9. 9. • 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;
    10. 10. - (void)drawRect:(CGRect)rect • -[UIView drawRect:] • backgroundColor • drawRect: • rect • drawRect:
    11. 11. • drawRect: ! • • View - (void)setNeedsDisplay; • - (void)setNumberOfSides:(int)sides { numberOfSides = sides; [polygonView setNeedsDisplay];
    12. 12. CoreGraphics Quartz 2D • UIKit UIRectFill(CGRect rect); UIRectFrame(CGRect rect); • CoreGraphics: API • CG C Base API Objective-C • CG Quartz 2D
    13. 13. • • PDF • drawRect: • path line • drawRect: (CGContextRef)UIGraphicsGetCurrentContext(void); • CG • drawRect:
    14. 14. CG • CG UIKit • UIColor *redColor = [UIColor redColor]; [redColor set]; • UIFont *font = [UIFont systemFontOfSize:14.0]; [myLabel setFont:font];
    15. 15. • -[NSString drawAtPoint:(CGPoint)point withFont: (UIFont *)font]
    16. 16. UIImage • UIImage: • • +[UIImage imageNamed:(NSString *)name] • • -[UIImage initWithContentsOfFile: (NSString *)path] •
    17. 17. • - [UIImage drawAtPoint:(CGPoint)point] • - [UIImage drawInRect:(CGRect)rect] • - [UIImage drawAsPatternInRect:(CGRect)rect]
    18. 18. • • • • CGGraphicsContext • •
    19. 19. • NSData *UIImagePNGRepresentation (UIImage * image); • NSData *UIImageJPGRepresentation (UIImage * image);
    20. 20. • • UITouch UIEvent • •
    21. 21. 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;
    22. 22. UIEvent touch @property(nonatomic,readonly) NSTimeInterval timestamp; - (NSSet *)allTouches; - (NSSet *)touchesForWindow:(UIWindow *)window; - (NSSet *)touchesForView:(UIView *)view;
    23. 23. UIEvent - (NSSet *)allTouches; - (NSSet *)touchesForWindow:(UIWindow *)window; - (NSSet *)touchesForView:(UIView *)view;
    24. 24. 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;
    25. 25. UIResponder
    26. 26. touchesBegan:withEvent:
    27. 27. touchesMoved:withEvent:
    28. 28. touchesEnded:withEvent:
    29. 29. touchesCancelled touchesCancelled:(NSSet*)touches withEvent:(UIEvent*)event
    1. A particular slide catching your eye?

      Clipping is a handy way to collect important slides you want to go back to later.

    ×