iOS                                    DIY         shaokun@kudelabs.com      http://t.sina.com.cn/shaokunwu
•                Three20    • Facebook      iPhone    •    • Facebook, Flickr, Tweetie, Gowalla...    • https://github.com...
•••• DIY
••••
UIImagePickerControllerDelegate
• Camera •   UIImagePickerControllerSourceTypeCamera• Photo Library
• UIImagePickerControllerDelegate“In software engineering, the delegation pattern is a design pattern in object-orientedpr...
YourController.h
YourController.m
Original, Large, Medium, Small, Thumbnail...
Why?•                       1600 * 1200                                        Type        RAM•   32-bit                  ...
•           Categories                UIImage    •   @Interface UIImage (Resize)•   by Trevor Harmon•   http://vocaro.com/...
UIImage converted to NSData, Documents Directory
• UIImage                              NSData    •   NSData *imageData = UIImagePNGRepresentation(image);    •   NSData *i...
(void)saveImageToFile
•   SaveImageToFile•    •   NSInvocationOperation    •   NSOperationQueue    •   [NSOperationQueue sharedOperationQueue];
@interface NSOperationQueue (SharedQueue)
Grid View & Browser
GridView.hGridView.m
•   GridView *gridView = [[GridView new] initWithCols:4 size:75 margin:4];•   [gridView addSubView:imageView];
•    •   UIScrollView           UIImageView    •            UIImageView     x
•    •   UIScrollView                UIImageView    •        UIScrollView        •   maximumZoomScale, minimumZoomScale, z...
UIScrollView inside UIScrollView
Thank You!
iOS 图片浏览器 DIY
iOS 图片浏览器 DIY
Upcoming SlideShare
Loading in …5
×

iOS 图片浏览器 DIY

2,539
-1

Published on

Make your own Photos App as iPhone's.
For DEMO project, please check out https://github.com/shaokun/iOSPhotosDIY

Published in: Technology
0 Comments
5 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total Views
2,539
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
37
Comments
0
Likes
5
Embeds 0
No embeds

No notes for slide
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • iOS 图片浏览器 DIY

    1. 1. iOS DIY shaokun@kudelabs.com http://t.sina.com.cn/shaokunwu
    2. 2. • Three20 • Facebook iPhone • • Facebook, Flickr, Tweetie, Gowalla... • https://github.com/facebook/three20
    3. 3. •••• DIY
    4. 4. ••••
    5. 5. UIImagePickerControllerDelegate
    6. 6. • Camera • UIImagePickerControllerSourceTypeCamera• Photo Library
    7. 7. • UIImagePickerControllerDelegate“In software engineering, the delegation pattern is a design pattern in object-orientedprogramming where an object, instead of performing one of its stated tasks, delegatesthat task to an associated helper object.” -- wikipedia • - imagePickerController:didFinishPickingMediaWithInfo: • - imagePickerControllerDidCancel: • - imagePickerController:didFinishPickingImage:editingInfo: Deprecated in iOS 3.0
    8. 8. YourController.h
    9. 9. YourController.m
    10. 10. Original, Large, Medium, Small, Thumbnail...
    11. 11. Why?• 1600 * 1200 Type RAM• 32-bit iPhone 128 MB • width * height * (32 / 8) = iPhone 3G 128 MB • 1600 * 1200 * 4 = iPhone 3GS 256 MB 7,680,000 = ~8 MB• Application iPhone 4 512 MB (10~20 MB?)
    12. 12. • Categories UIImage • @Interface UIImage (Resize)• by Trevor Harmon• http://vocaro.com/trevor/blog/2009/10/12/resize-a-uiimage- the-right-way/
    13. 13. UIImage converted to NSData, Documents Directory
    14. 14. • UIImage NSData • NSData *imageData = UIImagePNGRepresentation(image); • NSData *imageData = UIImageJPEGRepresentation(image);• Application Documents • iOS 3.1.3 build Documents
    15. 15. (void)saveImageToFile
    16. 16. • SaveImageToFile• • NSInvocationOperation • NSOperationQueue • [NSOperationQueue sharedOperationQueue];
    17. 17. @interface NSOperationQueue (SharedQueue)
    18. 18. Grid View & Browser
    19. 19. GridView.hGridView.m
    20. 20. • GridView *gridView = [[GridView new] initWithCols:4 size:75 margin:4];• [gridView addSubView:imageView];
    21. 21. • • UIScrollView UIImageView • UIImageView x
    22. 22. • • UIScrollView UIImageView • UIScrollView • maximumZoomScale, minimumZoomScale, zoomScale • Implement UIScrollViewDelegate UIImageView • - (UIView *)viewForZoomingInScrollView:(UIScrollView *)scrollView
    23. 23. UIScrollView inside UIScrollView
    24. 24. Thank You!
    1. A particular slide catching your eye?

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

    ×