moved Classes out of the demo application
This commit is contained in:
parent
a5e6bcc8b3
commit
c4b4108b8b
37 changed files with 409 additions and 3181 deletions
|
@ -1,195 +0,0 @@
|
|||
//
|
||||
// JPImagePickerController.h
|
||||
// JPImagePickerController
|
||||
//
|
||||
// Created by Jeena on 11.11.09.
|
||||
// Copyright 2009 Jeena Paradies.
|
||||
// Licence: MIT-Licence
|
||||
//
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
#import "JPImagePickerOverviewController.h"
|
||||
|
||||
@class JPImagePickerController, JPImagePickerOverviewController;
|
||||
|
||||
/*!
|
||||
@enum JPImagePickerControllerThumbnailSize
|
||||
@abstract Specifies the thumbnail width and height.
|
||||
@constant kJPImagePickerControllerThumbnailSizeWidth Thumbnail width 75 px.
|
||||
@constant kJPImagePickerControllerThumbnailSizeHeight Thumbnail height 75 px.
|
||||
*/
|
||||
enum JPImagePickerControllerThumbnailSize {
|
||||
kJPImagePickerControllerThumbnailSizeWidth = 75,
|
||||
kJPImagePickerControllerThumbnailSizeHeight = 75
|
||||
};
|
||||
|
||||
/*!
|
||||
@enum JPImagePickerControllerPreviewImageSize
|
||||
@abstract Specifies the preview image width and height.
|
||||
@constant kJPImagePickerControllerPreviewImageSizeWidth Preview image width 320 px.
|
||||
@constant kJPImagePickerControllerPreviewImageSizeHeight Preview image height 420 px.
|
||||
*/
|
||||
enum JPImagePickerControllerPreviewImageSize {
|
||||
kJPImagePickerControllerPreviewImageSizeWidth = 320,
|
||||
kJPImagePickerControllerPreviewImageSizeHeight = 420
|
||||
};
|
||||
|
||||
#pragma mark -
|
||||
|
||||
/*!
|
||||
@protocol JPImagePickerControllerDelegate
|
||||
@abstract Delegate protocol for the JPImagePickerController
|
||||
@discussion You have to implement this delegate in order to
|
||||
use the JPImagePickerController. This delegate is responsible
|
||||
for dismissing the picker on cancel or finished picking.
|
||||
*/
|
||||
|
||||
@protocol JPImagePickerControllerDelegate <NSObject>
|
||||
@optional
|
||||
|
||||
/*!
|
||||
@method imagePickerDidCancel:
|
||||
@abstract Called when picker did cancel
|
||||
@discussion This method is called when the user canceled picking.
|
||||
The delegate is responsible to dismiss the picker here.
|
||||
@param picker The picker which called this method.
|
||||
*/
|
||||
- (void)imagePickerDidCancel:(JPImagePickerController *)picker;
|
||||
|
||||
/*!
|
||||
@method imagePicker:didFinishPickingWithImageNumber:
|
||||
@abstract Called when the user picked a image.
|
||||
@discussion This method is called when the user die finish picking.
|
||||
The delegate is responsible to dismiss the picker here.
|
||||
@param picker The picker which called this method.
|
||||
@param imageNumber The number which image the user picked.
|
||||
*/
|
||||
- (void)imagePicker:(JPImagePickerController *)picker didFinishPickingWithImageNumber:(NSInteger)imageNumber;
|
||||
|
||||
@end
|
||||
|
||||
|
||||
|
||||
/*!
|
||||
@protocol JPImagePickerControllerDataSource
|
||||
@abstract The data source protocol for JPImagePickerController
|
||||
@discussion The JPImagePickerController asks this data source for all
|
||||
data which it wants to display.
|
||||
*/
|
||||
|
||||
@protocol JPImagePickerControllerDataSource <NSObject>
|
||||
@optional
|
||||
|
||||
/*!
|
||||
@method numberOfImagesInImagePicker:
|
||||
@abstract Should return the number of images.
|
||||
@discussion This method should return the number of images which the
|
||||
picker should display.
|
||||
@param picker The picker which called this method.
|
||||
*/
|
||||
- (NSInteger)numberOfImagesInImagePicker:(JPImagePickerController *)picker;
|
||||
|
||||
/*!
|
||||
@method imagePicker:thumbnailForImageNumber:
|
||||
@abstract Asks the data source for a thumbnail to insert in a particular location
|
||||
the image picker.
|
||||
@discussion This method should return a UIImage thumbnail for a image at the
|
||||
image number position. The image should have the width of kJPImagePickerControllerThumbnailWidth
|
||||
and height of kJPImagePickerControllerThumbnailWidth. If it is not that size the
|
||||
image picker will resize it so it fits.
|
||||
@param picker A picker-object requesting the thumbnail.
|
||||
@param imageNumber A image number locating the image in the picker.
|
||||
*/
|
||||
- (UIImage *)imagePicker:(JPImagePickerController *)picker thumbnailForImageNumber:(NSInteger)imageNumber;
|
||||
|
||||
/*!
|
||||
@method imagePicker:imageForImageNumber:
|
||||
@abstract Asks the data source for a image to show in a preview.
|
||||
@discussion This method should return a UIImage image for the preview at
|
||||
the image number position. The image should have the width of kJPImagePickerControllerPreviewImageWidth
|
||||
and height of kJPImagePickerControllerPreviewImageWidth. If it is not that size the
|
||||
image picker will resize it so it fits.
|
||||
@param picker A picker-object requesting the image.
|
||||
@param imageNumber A image number locating the image in the picker.
|
||||
*/
|
||||
- (UIImage *)imagePicker:(JPImagePickerController *)picker imageForImageNumber:(NSInteger)imageNumber;
|
||||
|
||||
@end
|
||||
|
||||
#pragma mark -
|
||||
|
||||
/*!
|
||||
@class JPImagePickerController
|
||||
@abstract A image picker view controller.
|
||||
@discussion A class which represents a image picker controller like apples UIImagePickerController
|
||||
but lets you use a external dataSource for the images.
|
||||
@updated 2009-11-14
|
||||
*/
|
||||
|
||||
@interface JPImagePickerController : UIViewController {
|
||||
IBOutlet UINavigationController *modalNavigationController;
|
||||
JPImagePickerOverviewController *overviewController;
|
||||
UIStatusBarStyle originalStatusBarStyle;
|
||||
id<JPImagePickerControllerDelegate> delegate;
|
||||
id<JPImagePickerControllerDataSource> dataSource;
|
||||
NSString *imagePickerTitle;
|
||||
}
|
||||
|
||||
/*!
|
||||
@property modalNavigationController
|
||||
@abstract The additional navigation controller.
|
||||
@discussion We need it to be able to view a navigation when the user
|
||||
picks a image.
|
||||
*/
|
||||
@property (nonatomic, retain) IBOutlet UINavigationController *modalNavigationController;
|
||||
|
||||
/*!
|
||||
@property overviewController
|
||||
@abstract Controller for the scrollView.
|
||||
@discussion This controller holds the scrollView with all the buttons which
|
||||
represent the images.
|
||||
*/
|
||||
@property (nonatomic, retain) JPImagePickerOverviewController *overviewController;
|
||||
|
||||
/*!
|
||||
@property overviewController
|
||||
@abstract Original StatusBarStyle at the beginning.
|
||||
@discussion This property saves the UIStatusBarStyle at the beginning, so that
|
||||
we'll be able to change it back when we dismiss the image picker.
|
||||
*/
|
||||
@property (nonatomic, readonly) UIStatusBarStyle originalStatusBarStyle;
|
||||
|
||||
/*!
|
||||
@property delegate
|
||||
@abstract The image picker's delegate object.
|
||||
@discussion The delegate receives notifications when the user picks an image,
|
||||
or exits the picker interface. The delegate also decides when to dismiss
|
||||
the picker interface, so you must provide a delegate to use a picker.
|
||||
If this property is nil, the picker is dismissed immediately if you try
|
||||
to show it.
|
||||
*/
|
||||
@property (nonatomic, retain) id<JPImagePickerControllerDelegate> delegate;
|
||||
|
||||
/*!
|
||||
@property dataSource
|
||||
@abstract The data source for the picker view.
|
||||
@discussion The data source must adopt the JPImagePickerControllerDataSource protocol
|
||||
and implement the required methods to return the number of components and the
|
||||
number of rows in each component.
|
||||
*/
|
||||
@property (nonatomic, retain) id<JPImagePickerControllerDataSource> dataSource;
|
||||
|
||||
/*!
|
||||
@property imagePickerTitle
|
||||
@abstract The image picker title.
|
||||
@discussion You can set the title for the image overview here.
|
||||
*/
|
||||
@property (nonatomic, retain) NSString *imagePickerTitle;
|
||||
|
||||
/*!
|
||||
@method cancelPicking:
|
||||
@param sender The button which sends the action.
|
||||
*/
|
||||
- (void)cancelPicking:(id)sender;
|
||||
|
||||
@end
|
|
@ -1,103 +0,0 @@
|
|||
//
|
||||
// JPImagePickerController.m
|
||||
// JPImagePickerController
|
||||
//
|
||||
// Created by Jeena on 11.11.09.
|
||||
// Copyright 2009 Jeena Paradies.
|
||||
// Licence: MIT-Licence
|
||||
//
|
||||
|
||||
#import "JPImagePickerController.h"
|
||||
|
||||
|
||||
@implementation JPImagePickerController
|
||||
|
||||
@synthesize overviewController, modalNavigationController, delegate, dataSource, originalStatusBarStyle;
|
||||
|
||||
/*
|
||||
// The designated initializer. Override if you create the controller programmatically and want to perform customization that is not appropriate for viewDidLoad.
|
||||
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil {
|
||||
if (self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil]) {
|
||||
// Custom initialization
|
||||
}
|
||||
return self;
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
// Implement viewDidLoad to do additional setup after loading the view, typically from a nib.
|
||||
- (void)viewDidLoad {
|
||||
[super viewDidLoad];
|
||||
|
||||
originalStatusBarStyle = [UIApplication sharedApplication].statusBarStyle;
|
||||
[[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleBlackTranslucent animated:YES];
|
||||
|
||||
overviewController = [[JPImagePickerOverviewController alloc] initWithImagePickerController:self];
|
||||
modalNavigationController = [[UINavigationController alloc] initWithRootViewController:overviewController];
|
||||
modalNavigationController.view.frame = self.view.bounds;
|
||||
modalNavigationController.navigationBar.barStyle = UIBarStyleBlackTranslucent;
|
||||
modalNavigationController.navigationBar.translucent = YES;
|
||||
[self.view addSubview:modalNavigationController.view];
|
||||
}
|
||||
|
||||
- (void)setImagePickerTitle:(NSString *)newTitle {
|
||||
imagePickerTitle = newTitle;
|
||||
[overviewController setImagePickerTitle:newTitle];
|
||||
}
|
||||
|
||||
- (NSString *)imagePickerTitle {
|
||||
return imagePickerTitle;
|
||||
}
|
||||
|
||||
-(void)viewWillAppear:(BOOL)animated {
|
||||
[super viewWillAppear:animated];
|
||||
if (delegate == nil) {
|
||||
[self.navigationController dismissModalViewControllerAnimated:YES];
|
||||
}
|
||||
[modalNavigationController viewWillAppear:animated];
|
||||
}
|
||||
|
||||
-(void)viewWillDisappear:(BOOL)animated {
|
||||
[super viewWillDisappear:animated];
|
||||
[modalNavigationController viewWillDisappear:animated];
|
||||
}
|
||||
-(void)viewDidAppear:(BOOL)animated {
|
||||
[super viewDidAppear:animated];
|
||||
[modalNavigationController viewDidAppear:animated];
|
||||
}
|
||||
-(void)viewDidDisappear:(BOOL)animated {
|
||||
[super viewDidDisappear:animated];
|
||||
[modalNavigationController viewDidDisappear:animated];
|
||||
}
|
||||
|
||||
/*
|
||||
// Override to allow orientations other than the default portrait orientation.
|
||||
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
|
||||
// Return YES for supported orientations
|
||||
return (interfaceOrientation == UIInterfaceOrientationPortrait);
|
||||
}
|
||||
*/
|
||||
|
||||
- (void)cancelPicking:(id)sender {
|
||||
[delegate imagePickerDidCancel:self];
|
||||
}
|
||||
|
||||
- (void)didReceiveMemoryWarning {
|
||||
// Releases the view if it doesn't have a superview.
|
||||
[super didReceiveMemoryWarning];
|
||||
|
||||
// Release any cached data, images, etc that aren't in use.
|
||||
}
|
||||
|
||||
- (void)viewDidUnload {
|
||||
// Release any retained subviews of the main view.
|
||||
// e.g. self.myOutlet = nil;
|
||||
}
|
||||
|
||||
|
||||
- (void)dealloc {
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
|
||||
@end
|
|
@ -1,35 +0,0 @@
|
|||
//
|
||||
// JPImagePickerDetailController.h
|
||||
// JPImagePickerController
|
||||
//
|
||||
// Created by Jeena on 11.11.09.
|
||||
// Copyright 2009 Jeena Paradies.
|
||||
// Licence: MIT-Licence
|
||||
//
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
#import "JPImagePickerController.h"
|
||||
#import "JPImagePickerOverviewController.h"
|
||||
#import "UIImageResizing.h"
|
||||
|
||||
@protocol JPImagePickerControllerDelegate;
|
||||
@protocol JPImagePickerControllerDataSource;
|
||||
@class JPImagePickerOverviewController;
|
||||
|
||||
@interface JPImagePickerDetailController : UIViewController {
|
||||
JPImagePickerOverviewController *overviewController;
|
||||
IBOutlet UIImageView *previewImageView;
|
||||
NSInteger imageNumber;
|
||||
UIStatusBarStyle originalStatusBarStyle;
|
||||
}
|
||||
|
||||
@property (nonatomic, retain) IBOutlet UIImageView *previewImageView;
|
||||
@property (nonatomic, retain, readonly) JPImagePickerOverviewController *overviewController;
|
||||
@property (nonatomic) NSInteger imageNumber;
|
||||
|
||||
- (id)initWithOverviewController:(JPImagePickerOverviewController *)newOverviewController;
|
||||
- (void)prepareForImageNumber:(NSInteger)newImageNumber;
|
||||
- (IBAction)cancelPreview:(id)sender;
|
||||
- (IBAction)finishedPicking:(id)sender;
|
||||
|
||||
@end
|
|
@ -1,103 +0,0 @@
|
|||
//
|
||||
// JPImagePickerDetailController.m
|
||||
// JPImagePickerController
|
||||
//
|
||||
// Created by Jeena on 11.11.09.
|
||||
// Copyright 2009 Jeena Paradies.
|
||||
// Licence: MIT-Licence
|
||||
//
|
||||
|
||||
#import "JPImagePickerDetailController.h"
|
||||
|
||||
|
||||
@implementation JPImagePickerDetailController
|
||||
|
||||
@synthesize previewImageView, overviewController, imageNumber;
|
||||
|
||||
- (id)initWithOverviewController:(JPImagePickerOverviewController *)newOverviewController {
|
||||
if (self = [super initWithNibName:@"JPImagePickerDetailController" bundle:nil]) {
|
||||
// Custom initialization
|
||||
overviewController = newOverviewController;
|
||||
imageNumber = -1;
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
|
||||
// Implement viewDidLoad to do additional setup after loading the view, typically from a nib.
|
||||
- (void)viewDidLoad {
|
||||
[super viewDidLoad];
|
||||
}
|
||||
|
||||
|
||||
- (void)viewWillAppear:(BOOL)animated {
|
||||
originalStatusBarStyle = [UIApplication sharedApplication].statusBarStyle;
|
||||
[[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleBlackOpaque animated:YES];
|
||||
[super viewWillAppear:animated];
|
||||
[self.navigationController setNavigationBarHidden:YES animated:YES];
|
||||
[self prepareForImageNumber:imageNumber];
|
||||
}
|
||||
|
||||
/*
|
||||
- (void)viewDidAppear:(BOOL)animated {
|
||||
[super viewDidAppear:animated];
|
||||
}
|
||||
*/
|
||||
- (void)viewWillDisappear:(BOOL)animated {
|
||||
[super viewWillDisappear:animated];
|
||||
[self.navigationController setNavigationBarHidden:NO animated:YES];
|
||||
}
|
||||
|
||||
/*
|
||||
- (void)viewDidDisappear:(BOOL)animated {
|
||||
[super viewDidDisappear:animated];
|
||||
}
|
||||
*/
|
||||
|
||||
/*
|
||||
// Override to allow orientations other than the default portrait orientation.
|
||||
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
|
||||
// Return YES for supported orientations
|
||||
return (interfaceOrientation == UIInterfaceOrientationPortrait);
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
- (void)prepareForImageNumber:(NSInteger)newImageNumber {
|
||||
imageNumber = newImageNumber;
|
||||
previewImageView.image = [[overviewController.imagePickerController.dataSource
|
||||
imagePicker:overviewController.imagePickerController
|
||||
imageForImageNumber:imageNumber]
|
||||
scaleToSize:CGSizeMake(kJPImagePickerControllerPreviewImageSizeHeight, kJPImagePickerControllerPreviewImageSizeHeight)
|
||||
onlyIfNeeded:YES];
|
||||
}
|
||||
|
||||
- (IBAction)cancelPreview:(id)sender {
|
||||
[[UIApplication sharedApplication] setStatusBarStyle:originalStatusBarStyle animated:YES];
|
||||
[self.navigationController popViewControllerAnimated:YES];
|
||||
}
|
||||
|
||||
- (IBAction)finishedPicking:(id)sender {
|
||||
[[UIApplication sharedApplication] setStatusBarStyle:overviewController.imagePickerController.originalStatusBarStyle animated:YES];
|
||||
[overviewController.imagePickerController.delegate imagePicker:overviewController.imagePickerController didFinishPickingWithImageNumber:imageNumber];
|
||||
}
|
||||
|
||||
- (void)didReceiveMemoryWarning {
|
||||
// Releases the view if it doesn't have a superview.
|
||||
[super didReceiveMemoryWarning];
|
||||
|
||||
// Release any cached data, images, etc that aren't in use.
|
||||
}
|
||||
|
||||
- (void)viewDidUnload {
|
||||
// Release any retained subviews of the main view.
|
||||
// e.g. self.myOutlet = nil;
|
||||
}
|
||||
|
||||
|
||||
- (void)dealloc {
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
|
||||
@end
|
|
@ -1,488 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<archive type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="7.10">
|
||||
<data>
|
||||
<int key="IBDocument.SystemTarget">784</int>
|
||||
<string key="IBDocument.SystemVersion">10C540</string>
|
||||
<string key="IBDocument.InterfaceBuilderVersion">740</string>
|
||||
<string key="IBDocument.AppKitVersion">1038.25</string>
|
||||
<string key="IBDocument.HIToolboxVersion">458.00</string>
|
||||
<object class="NSMutableDictionary" key="IBDocument.PluginVersions">
|
||||
<string key="NS.key.0">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
|
||||
<string key="NS.object.0">62</string>
|
||||
</object>
|
||||
<object class="NSMutableArray" key="IBDocument.EditedObjectIDs">
|
||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||
<integer value="4"/>
|
||||
</object>
|
||||
<object class="NSArray" key="IBDocument.PluginDependencies">
|
||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||
<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
|
||||
</object>
|
||||
<object class="NSMutableDictionary" key="IBDocument.Metadata">
|
||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||
<object class="NSArray" key="dict.sortedKeys" id="0">
|
||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||
</object>
|
||||
<object class="NSMutableArray" key="dict.values">
|
||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||
</object>
|
||||
</object>
|
||||
<object class="NSMutableArray" key="IBDocument.RootObjects" id="1000">
|
||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||
<object class="IBProxyObject" id="372490531">
|
||||
<string key="IBProxiedObjectIdentifier">IBFilesOwner</string>
|
||||
</object>
|
||||
<object class="IBProxyObject" id="975951072">
|
||||
<string key="IBProxiedObjectIdentifier">IBFirstResponder</string>
|
||||
</object>
|
||||
<object class="IBUIView" id="655272210">
|
||||
<reference key="NSNextResponder"/>
|
||||
<int key="NSvFlags">292</int>
|
||||
<object class="NSMutableArray" key="NSSubviews">
|
||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||
<object class="IBUIToolbar" id="194791387">
|
||||
<reference key="NSNextResponder" ref="655272210"/>
|
||||
<int key="NSvFlags">266</int>
|
||||
<string key="NSFrame">{{0, 436}, {320, 44}}</string>
|
||||
<reference key="NSSuperview" ref="655272210"/>
|
||||
<bool key="IBUIOpaque">NO</bool>
|
||||
<bool key="IBUIClearsContextBeforeDrawing">NO</bool>
|
||||
<int key="IBUIBarStyle">2</int>
|
||||
<object class="NSMutableArray" key="IBUIItems">
|
||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||
<object class="IBUIBarButtonItem" id="80159321">
|
||||
<int key="IBUIStyle">1</int>
|
||||
<reference key="IBUIToolbar" ref="194791387"/>
|
||||
<int key="IBUISystemItemIdentifier">1</int>
|
||||
</object>
|
||||
<object class="IBUIBarButtonItem" id="243887214">
|
||||
<reference key="IBUIToolbar" ref="194791387"/>
|
||||
<int key="IBUISystemItemIdentifier">5</int>
|
||||
</object>
|
||||
<object class="IBUIBarButtonItem" id="379350294">
|
||||
<string key="IBUITitle">Choose</string>
|
||||
<int key="IBUIStyle">2</int>
|
||||
<reference key="IBUIToolbar" ref="194791387"/>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
<object class="IBUIImageView" id="701591828">
|
||||
<reference key="NSNextResponder" ref="655272210"/>
|
||||
<int key="NSvFlags">274</int>
|
||||
<string key="NSFrameSize">{320, 436}</string>
|
||||
<reference key="NSSuperview" ref="655272210"/>
|
||||
<bool key="IBUIClearsContextBeforeDrawing">NO</bool>
|
||||
<int key="IBUIContentMode">4</int>
|
||||
<bool key="IBUIUserInteractionEnabled">NO</bool>
|
||||
</object>
|
||||
</object>
|
||||
<string key="NSFrameSize">{320, 480}</string>
|
||||
<reference key="NSSuperview"/>
|
||||
<object class="NSColor" key="IBUIBackgroundColor">
|
||||
<int key="NSColorSpace">2</int>
|
||||
<bytes key="NSRGB">MCAwLjAwNzg0MzEzNzcxOSAwLjAwNzg0MzEzNzcxOQA</bytes>
|
||||
</object>
|
||||
<bool key="IBUIClearsContextBeforeDrawing">NO</bool>
|
||||
<object class="IBUISimulatedStatusBarMetrics" key="IBUISimulatedStatusBarMetrics">
|
||||
<int key="IBUIStatusBarStyle">1</int>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
<object class="IBObjectContainer" key="IBDocument.Objects">
|
||||
<object class="NSMutableArray" key="connectionRecords">
|
||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||
<object class="IBConnectionRecord">
|
||||
<object class="IBCocoaTouchOutletConnection" key="connection">
|
||||
<string key="label">view</string>
|
||||
<reference key="source" ref="372490531"/>
|
||||
<reference key="destination" ref="655272210"/>
|
||||
</object>
|
||||
<int key="connectionID">10</int>
|
||||
</object>
|
||||
<object class="IBConnectionRecord">
|
||||
<object class="IBCocoaTouchOutletConnection" key="connection">
|
||||
<string key="label">previewImageView</string>
|
||||
<reference key="source" ref="372490531"/>
|
||||
<reference key="destination" ref="701591828"/>
|
||||
</object>
|
||||
<int key="connectionID">11</int>
|
||||
</object>
|
||||
<object class="IBConnectionRecord">
|
||||
<object class="IBCocoaTouchEventConnection" key="connection">
|
||||
<string key="label">cancelPreview:</string>
|
||||
<reference key="source" ref="80159321"/>
|
||||
<reference key="destination" ref="372490531"/>
|
||||
</object>
|
||||
<int key="connectionID">12</int>
|
||||
</object>
|
||||
<object class="IBConnectionRecord">
|
||||
<object class="IBCocoaTouchEventConnection" key="connection">
|
||||
<string key="label">finishedPicking:</string>
|
||||
<reference key="source" ref="379350294"/>
|
||||
<reference key="destination" ref="372490531"/>
|
||||
</object>
|
||||
<int key="connectionID">13</int>
|
||||
</object>
|
||||
</object>
|
||||
<object class="IBMutableOrderedSet" key="objectRecords">
|
||||
<object class="NSArray" key="orderedObjects">
|
||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||
<object class="IBObjectRecord">
|
||||
<int key="objectID">0</int>
|
||||
<reference key="object" ref="0"/>
|
||||
<reference key="children" ref="1000"/>
|
||||
<nil key="parent"/>
|
||||
</object>
|
||||
<object class="IBObjectRecord">
|
||||
<int key="objectID">-1</int>
|
||||
<reference key="object" ref="372490531"/>
|
||||
<reference key="parent" ref="0"/>
|
||||
<string key="objectName">File's Owner</string>
|
||||
</object>
|
||||
<object class="IBObjectRecord">
|
||||
<int key="objectID">-2</int>
|
||||
<reference key="object" ref="975951072"/>
|
||||
<reference key="parent" ref="0"/>
|
||||
</object>
|
||||
<object class="IBObjectRecord">
|
||||
<int key="objectID">4</int>
|
||||
<reference key="object" ref="655272210"/>
|
||||
<object class="NSMutableArray" key="children">
|
||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||
<reference ref="701591828"/>
|
||||
<reference ref="194791387"/>
|
||||
</object>
|
||||
<reference key="parent" ref="0"/>
|
||||
<string key="objectName">Preview</string>
|
||||
</object>
|
||||
<object class="IBObjectRecord">
|
||||
<int key="objectID">5</int>
|
||||
<reference key="object" ref="701591828"/>
|
||||
<reference key="parent" ref="655272210"/>
|
||||
</object>
|
||||
<object class="IBObjectRecord">
|
||||
<int key="objectID">6</int>
|
||||
<reference key="object" ref="194791387"/>
|
||||
<object class="NSMutableArray" key="children">
|
||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||
<reference ref="243887214"/>
|
||||
<reference ref="379350294"/>
|
||||
<reference ref="80159321"/>
|
||||
</object>
|
||||
<reference key="parent" ref="655272210"/>
|
||||
</object>
|
||||
<object class="IBObjectRecord">
|
||||
<int key="objectID">7</int>
|
||||
<reference key="object" ref="243887214"/>
|
||||
<reference key="parent" ref="194791387"/>
|
||||
</object>
|
||||
<object class="IBObjectRecord">
|
||||
<int key="objectID">8</int>
|
||||
<reference key="object" ref="379350294"/>
|
||||
<reference key="parent" ref="194791387"/>
|
||||
</object>
|
||||
<object class="IBObjectRecord">
|
||||
<int key="objectID">9</int>
|
||||
<reference key="object" ref="80159321"/>
|
||||
<reference key="parent" ref="194791387"/>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
<object class="NSMutableDictionary" key="flattenedProperties">
|
||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||
<object class="NSArray" key="dict.sortedKeys">
|
||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||
<string>-1.CustomClassName</string>
|
||||
<string>-2.CustomClassName</string>
|
||||
<string>4.IBEditorWindowLastContentRect</string>
|
||||
<string>4.IBPluginDependency</string>
|
||||
<string>5.IBPluginDependency</string>
|
||||
<string>6.IBPluginDependency</string>
|
||||
<string>7.IBPluginDependency</string>
|
||||
<string>8.IBPluginDependency</string>
|
||||
<string>9.IBPluginDependency</string>
|
||||
</object>
|
||||
<object class="NSMutableArray" key="dict.values">
|
||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||
<string>JPImagePickerDetailController</string>
|
||||
<string>UIResponder</string>
|
||||
<string>{{179, 638}, {320, 480}}</string>
|
||||
<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
|
||||
<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
|
||||
<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
|
||||
<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
|
||||
<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
|
||||
<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
|
||||
</object>
|
||||
</object>
|
||||
<object class="NSMutableDictionary" key="unlocalizedProperties">
|
||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||
<reference key="dict.sortedKeys" ref="0"/>
|
||||
<object class="NSMutableArray" key="dict.values">
|
||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||
</object>
|
||||
</object>
|
||||
<nil key="activeLocalization"/>
|
||||
<object class="NSMutableDictionary" key="localizations">
|
||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||
<reference key="dict.sortedKeys" ref="0"/>
|
||||
<object class="NSMutableArray" key="dict.values">
|
||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||
</object>
|
||||
</object>
|
||||
<nil key="sourceID"/>
|
||||
<int key="maxID">13</int>
|
||||
</object>
|
||||
<object class="IBClassDescriber" key="IBDocument.Classes">
|
||||
<object class="NSMutableArray" key="referencedPartialClassDescriptions">
|
||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||
<object class="IBPartialClassDescription">
|
||||
<string key="className">JPImagePickerDetailController</string>
|
||||
<string key="superclassName">UIViewController</string>
|
||||
<object class="NSMutableDictionary" key="actions">
|
||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||
<object class="NSArray" key="dict.sortedKeys">
|
||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||
<string>cancelPreview:</string>
|
||||
<string>finishedPicking:</string>
|
||||
</object>
|
||||
<object class="NSMutableArray" key="dict.values">
|
||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||
<string>id</string>
|
||||
<string>id</string>
|
||||
</object>
|
||||
</object>
|
||||
<object class="NSMutableDictionary" key="outlets">
|
||||
<string key="NS.key.0">previewImageView</string>
|
||||
<string key="NS.object.0">UIImageView</string>
|
||||
</object>
|
||||
<object class="IBClassDescriptionSource" key="sourceIdentifier">
|
||||
<string key="majorKey">IBProjectSource</string>
|
||||
<string key="minorKey">Classes/JPImagePickerDetailController.h</string>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
<object class="NSMutableArray" key="referencedPartialClassDescriptionsV3.2+">
|
||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||
<object class="IBPartialClassDescription">
|
||||
<string key="className">NSObject</string>
|
||||
<object class="IBClassDescriptionSource" key="sourceIdentifier">
|
||||
<string key="majorKey">IBFrameworkSource</string>
|
||||
<string key="minorKey">Foundation.framework/Headers/NSError.h</string>
|
||||
</object>
|
||||
</object>
|
||||
<object class="IBPartialClassDescription">
|
||||
<string key="className">NSObject</string>
|
||||
<object class="IBClassDescriptionSource" key="sourceIdentifier">
|
||||
<string key="majorKey">IBFrameworkSource</string>
|
||||
<string key="minorKey">Foundation.framework/Headers/NSFileManager.h</string>
|
||||
</object>
|
||||
</object>
|
||||
<object class="IBPartialClassDescription">
|
||||
<string key="className">NSObject</string>
|
||||
<object class="IBClassDescriptionSource" key="sourceIdentifier">
|
||||
<string key="majorKey">IBFrameworkSource</string>
|
||||
<string key="minorKey">Foundation.framework/Headers/NSKeyValueCoding.h</string>
|
||||
</object>
|
||||
</object>
|
||||
<object class="IBPartialClassDescription">
|
||||
<string key="className">NSObject</string>
|
||||
<object class="IBClassDescriptionSource" key="sourceIdentifier">
|
||||
<string key="majorKey">IBFrameworkSource</string>
|
||||
<string key="minorKey">Foundation.framework/Headers/NSKeyValueObserving.h</string>
|
||||
</object>
|
||||
</object>
|
||||
<object class="IBPartialClassDescription">
|
||||
<string key="className">NSObject</string>
|
||||
<object class="IBClassDescriptionSource" key="sourceIdentifier">
|
||||
<string key="majorKey">IBFrameworkSource</string>
|
||||
<string key="minorKey">Foundation.framework/Headers/NSKeyedArchiver.h</string>
|
||||
</object>
|
||||
</object>
|
||||
<object class="IBPartialClassDescription">
|
||||
<string key="className">NSObject</string>
|
||||
<object class="IBClassDescriptionSource" key="sourceIdentifier">
|
||||
<string key="majorKey">IBFrameworkSource</string>
|
||||
<string key="minorKey">Foundation.framework/Headers/NSNetServices.h</string>
|
||||
</object>
|
||||
</object>
|
||||
<object class="IBPartialClassDescription">
|
||||
<string key="className">NSObject</string>
|
||||
<object class="IBClassDescriptionSource" key="sourceIdentifier">
|
||||
<string key="majorKey">IBFrameworkSource</string>
|
||||
<string key="minorKey">Foundation.framework/Headers/NSObject.h</string>
|
||||
</object>
|
||||
</object>
|
||||
<object class="IBPartialClassDescription">
|
||||
<string key="className">NSObject</string>
|
||||
<object class="IBClassDescriptionSource" key="sourceIdentifier">
|
||||
<string key="majorKey">IBFrameworkSource</string>
|
||||
<string key="minorKey">Foundation.framework/Headers/NSPort.h</string>
|
||||
</object>
|
||||
</object>
|
||||
<object class="IBPartialClassDescription">
|
||||
<string key="className">NSObject</string>
|
||||
<object class="IBClassDescriptionSource" key="sourceIdentifier">
|
||||
<string key="majorKey">IBFrameworkSource</string>
|
||||
<string key="minorKey">Foundation.framework/Headers/NSRunLoop.h</string>
|
||||
</object>
|
||||
</object>
|
||||
<object class="IBPartialClassDescription">
|
||||
<string key="className">NSObject</string>
|
||||
<object class="IBClassDescriptionSource" key="sourceIdentifier">
|
||||
<string key="majorKey">IBFrameworkSource</string>
|
||||
<string key="minorKey">Foundation.framework/Headers/NSStream.h</string>
|
||||
</object>
|
||||
</object>
|
||||
<object class="IBPartialClassDescription">
|
||||
<string key="className">NSObject</string>
|
||||
<object class="IBClassDescriptionSource" key="sourceIdentifier">
|
||||
<string key="majorKey">IBFrameworkSource</string>
|
||||
<string key="minorKey">Foundation.framework/Headers/NSThread.h</string>
|
||||
</object>
|
||||
</object>
|
||||
<object class="IBPartialClassDescription">
|
||||
<string key="className">NSObject</string>
|
||||
<object class="IBClassDescriptionSource" key="sourceIdentifier">
|
||||
<string key="majorKey">IBFrameworkSource</string>
|
||||
<string key="minorKey">Foundation.framework/Headers/NSURL.h</string>
|
||||
</object>
|
||||
</object>
|
||||
<object class="IBPartialClassDescription">
|
||||
<string key="className">NSObject</string>
|
||||
<object class="IBClassDescriptionSource" key="sourceIdentifier">
|
||||
<string key="majorKey">IBFrameworkSource</string>
|
||||
<string key="minorKey">Foundation.framework/Headers/NSURLConnection.h</string>
|
||||
</object>
|
||||
</object>
|
||||
<object class="IBPartialClassDescription">
|
||||
<string key="className">NSObject</string>
|
||||
<object class="IBClassDescriptionSource" key="sourceIdentifier">
|
||||
<string key="majorKey">IBFrameworkSource</string>
|
||||
<string key="minorKey">Foundation.framework/Headers/NSXMLParser.h</string>
|
||||
</object>
|
||||
</object>
|
||||
<object class="IBPartialClassDescription">
|
||||
<string key="className">NSObject</string>
|
||||
<object class="IBClassDescriptionSource" key="sourceIdentifier">
|
||||
<string key="majorKey">IBFrameworkSource</string>
|
||||
<string key="minorKey">UIKit.framework/Headers/UIAccessibility.h</string>
|
||||
</object>
|
||||
</object>
|
||||
<object class="IBPartialClassDescription">
|
||||
<string key="className">NSObject</string>
|
||||
<object class="IBClassDescriptionSource" key="sourceIdentifier">
|
||||
<string key="majorKey">IBFrameworkSource</string>
|
||||
<string key="minorKey">UIKit.framework/Headers/UINibLoading.h</string>
|
||||
</object>
|
||||
</object>
|
||||
<object class="IBPartialClassDescription">
|
||||
<string key="className">NSObject</string>
|
||||
<object class="IBClassDescriptionSource" key="sourceIdentifier" id="737514611">
|
||||
<string key="majorKey">IBFrameworkSource</string>
|
||||
<string key="minorKey">UIKit.framework/Headers/UIResponder.h</string>
|
||||
</object>
|
||||
</object>
|
||||
<object class="IBPartialClassDescription">
|
||||
<string key="className">UIBarButtonItem</string>
|
||||
<string key="superclassName">UIBarItem</string>
|
||||
<object class="IBClassDescriptionSource" key="sourceIdentifier">
|
||||
<string key="majorKey">IBFrameworkSource</string>
|
||||
<string key="minorKey">UIKit.framework/Headers/UIBarButtonItem.h</string>
|
||||
</object>
|
||||
</object>
|
||||
<object class="IBPartialClassDescription">
|
||||
<string key="className">UIBarItem</string>
|
||||
<string key="superclassName">NSObject</string>
|
||||
<object class="IBClassDescriptionSource" key="sourceIdentifier">
|
||||
<string key="majorKey">IBFrameworkSource</string>
|
||||
<string key="minorKey">UIKit.framework/Headers/UIBarItem.h</string>
|
||||
</object>
|
||||
</object>
|
||||
<object class="IBPartialClassDescription">
|
||||
<string key="className">UIImageView</string>
|
||||
<string key="superclassName">UIView</string>
|
||||
<object class="IBClassDescriptionSource" key="sourceIdentifier">
|
||||
<string key="majorKey">IBFrameworkSource</string>
|
||||
<string key="minorKey">UIKit.framework/Headers/UIImageView.h</string>
|
||||
</object>
|
||||
</object>
|
||||
<object class="IBPartialClassDescription">
|
||||
<string key="className">UIResponder</string>
|
||||
<string key="superclassName">NSObject</string>
|
||||
<reference key="sourceIdentifier" ref="737514611"/>
|
||||
</object>
|
||||
<object class="IBPartialClassDescription">
|
||||
<string key="className">UISearchBar</string>
|
||||
<string key="superclassName">UIView</string>
|
||||
<object class="IBClassDescriptionSource" key="sourceIdentifier">
|
||||
<string key="majorKey">IBFrameworkSource</string>
|
||||
<string key="minorKey">UIKit.framework/Headers/UISearchBar.h</string>
|
||||
</object>
|
||||
</object>
|
||||
<object class="IBPartialClassDescription">
|
||||
<string key="className">UISearchDisplayController</string>
|
||||
<string key="superclassName">NSObject</string>
|
||||
<object class="IBClassDescriptionSource" key="sourceIdentifier">
|
||||
<string key="majorKey">IBFrameworkSource</string>
|
||||
<string key="minorKey">UIKit.framework/Headers/UISearchDisplayController.h</string>
|
||||
</object>
|
||||
</object>
|
||||
<object class="IBPartialClassDescription">
|
||||
<string key="className">UIToolbar</string>
|
||||
<string key="superclassName">UIView</string>
|
||||
<object class="IBClassDescriptionSource" key="sourceIdentifier">
|
||||
<string key="majorKey">IBFrameworkSource</string>
|
||||
<string key="minorKey">UIKit.framework/Headers/UIToolbar.h</string>
|
||||
</object>
|
||||
</object>
|
||||
<object class="IBPartialClassDescription">
|
||||
<string key="className">UIView</string>
|
||||
<object class="IBClassDescriptionSource" key="sourceIdentifier">
|
||||
<string key="majorKey">IBFrameworkSource</string>
|
||||
<string key="minorKey">UIKit.framework/Headers/UITextField.h</string>
|
||||
</object>
|
||||
</object>
|
||||
<object class="IBPartialClassDescription">
|
||||
<string key="className">UIView</string>
|
||||
<string key="superclassName">UIResponder</string>
|
||||
<object class="IBClassDescriptionSource" key="sourceIdentifier">
|
||||
<string key="majorKey">IBFrameworkSource</string>
|
||||
<string key="minorKey">UIKit.framework/Headers/UIView.h</string>
|
||||
</object>
|
||||
</object>
|
||||
<object class="IBPartialClassDescription">
|
||||
<string key="className">UIViewController</string>
|
||||
<object class="IBClassDescriptionSource" key="sourceIdentifier">
|
||||
<string key="majorKey">IBFrameworkSource</string>
|
||||
<string key="minorKey">UIKit.framework/Headers/UINavigationController.h</string>
|
||||
</object>
|
||||
</object>
|
||||
<object class="IBPartialClassDescription">
|
||||
<string key="className">UIViewController</string>
|
||||
<object class="IBClassDescriptionSource" key="sourceIdentifier">
|
||||
<string key="majorKey">IBFrameworkSource</string>
|
||||
<string key="minorKey">UIKit.framework/Headers/UITabBarController.h</string>
|
||||
</object>
|
||||
</object>
|
||||
<object class="IBPartialClassDescription">
|
||||
<string key="className">UIViewController</string>
|
||||
<string key="superclassName">UIResponder</string>
|
||||
<object class="IBClassDescriptionSource" key="sourceIdentifier">
|
||||
<string key="majorKey">IBFrameworkSource</string>
|
||||
<string key="minorKey">UIKit.framework/Headers/UIViewController.h</string>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
<int key="IBDocument.localizationMode">0</int>
|
||||
<object class="NSMutableDictionary" key="IBDocument.PluginDeclaredDevelopmentDependencies">
|
||||
<string key="NS.key.0">com.apple.InterfaceBuilder.CocoaTouchPlugin.InterfaceBuilder3</string>
|
||||
<integer value="3000" key="NS.object.0"/>
|
||||
</object>
|
||||
<bool key="IBDocument.PluginDeclaredDependenciesTrackSystemTargetVersion">YES</bool>
|
||||
<string key="IBDocument.LastKnownRelativeProjectPath">../Emoticard.xcodeproj</string>
|
||||
<int key="IBDocument.defaultPropertyAccessControl">3</int>
|
||||
<string key="IBCocoaTouchPluginVersion">3.1</string>
|
||||
</data>
|
||||
</archive>
|
|
@ -1,35 +0,0 @@
|
|||
//
|
||||
// JPImagePickerOverviewController.h
|
||||
// JPImagePickerController
|
||||
//
|
||||
// Created by Jeena on 11.11.09.
|
||||
// Copyright 2009 Jeena Paradies.
|
||||
// Licence: MIT-Licence
|
||||
//
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
#import "JPImagePickerController.h"
|
||||
#import "JPImagePickerDetailController.h"
|
||||
#import "UIImageResizing.h"
|
||||
|
||||
@class JPImagePickerController, JPImagePickerDetailController;
|
||||
@protocol JPImagePickerControllerDelegate, JPImagePickerControllerDataSource;
|
||||
|
||||
@interface JPImagePickerOverviewController : UIViewController {
|
||||
JPImagePickerController *imagePickerController;
|
||||
JPImagePickerDetailController *detailController;
|
||||
IBOutlet UIScrollView *scrollView;
|
||||
}
|
||||
|
||||
@property (nonatomic, retain, readonly) JPImagePickerController *imagePickerController;
|
||||
@property (nonatomic, retain) JPImagePickerDetailController *detailController;
|
||||
@property (nonatomic, retain) IBOutlet UIScrollView *scrollView;
|
||||
|
||||
|
||||
- (id)initWithImagePickerController:(JPImagePickerController *)newImagePickerController;
|
||||
- (void)setImagePickerTitle:(NSString *)newTitle;
|
||||
- (NSString *)imagePickerTitle;
|
||||
- (IBAction)cancelPicking:(id)sender;
|
||||
- (void)buttonTouched:(UIButton *)sender;
|
||||
|
||||
@end
|
|
@ -1,128 +0,0 @@
|
|||
//
|
||||
// JPImagePickerOverviewController.m
|
||||
// JPImagePickerController
|
||||
//
|
||||
// Created by Jeena on 11.11.09.
|
||||
// Copyright 2009 Jeena Paradies.
|
||||
// Licence: MIT-Licence
|
||||
//
|
||||
|
||||
#import "JPImagePickerOverviewController.h"
|
||||
|
||||
|
||||
@implementation JPImagePickerOverviewController
|
||||
|
||||
@synthesize imagePickerController, detailController, scrollView;
|
||||
|
||||
#define PADDING_TOP 44
|
||||
#define PADDING 4
|
||||
#define THUMBNAIL_COLS 4
|
||||
|
||||
- (id)initWithImagePickerController:(JPImagePickerController *)newImagePickerController {
|
||||
if (self = [super initWithNibName:@"JPImagePickerOverviewController" bundle:nil]) {
|
||||
// Custom initialization
|
||||
imagePickerController = newImagePickerController;
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
|
||||
// Implement viewDidLoad to do additional setup after loading the view, typically from a nib.
|
||||
- (void)viewDidLoad {
|
||||
[super viewDidLoad];
|
||||
|
||||
[self setImagePickerTitle:imagePickerController.imagePickerTitle];
|
||||
|
||||
UIBarButtonItem *cancelButton = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemCancel
|
||||
target:self
|
||||
action:@selector(cancelPicking:)];
|
||||
self.navigationItem.rightBarButtonItem = cancelButton;
|
||||
[cancelButton release];
|
||||
|
||||
|
||||
UIButton *button;
|
||||
UIImage *thumbnail;
|
||||
int images_count = [imagePickerController.dataSource numberOfImagesInImagePicker:imagePickerController];
|
||||
|
||||
for (int i=0; i<images_count; i++) {
|
||||
thumbnail = [[imagePickerController.dataSource imagePicker:imagePickerController thumbnailForImageNumber:(NSInteger)i]
|
||||
scaleAndCropToSize:CGSizeMake(kJPImagePickerControllerThumbnailSizeWidth, kJPImagePickerControllerThumbnailSizeHeight)
|
||||
onlyIfNeeded:NO];
|
||||
|
||||
button = [UIButton buttonWithType:UIButtonTypeCustom];
|
||||
[button setImage:thumbnail forState:UIControlStateNormal];
|
||||
button.showsTouchWhenHighlighted = YES;
|
||||
button.userInteractionEnabled = YES;
|
||||
[button addTarget:self action:@selector(buttonTouched:) forControlEvents:UIControlEventTouchUpInside];
|
||||
button.tag = i;
|
||||
button.frame = CGRectMake(kJPImagePickerControllerThumbnailSizeWidth * (i % THUMBNAIL_COLS) + PADDING * (i % THUMBNAIL_COLS) + PADDING,
|
||||
kJPImagePickerControllerThumbnailSizeHeight * (i / THUMBNAIL_COLS) + PADDING * (i / THUMBNAIL_COLS) + PADDING + PADDING_TOP,
|
||||
kJPImagePickerControllerThumbnailSizeWidth,
|
||||
kJPImagePickerControllerThumbnailSizeHeight);
|
||||
|
||||
[scrollView addSubview:button];
|
||||
}
|
||||
|
||||
int rows = images_count / THUMBNAIL_COLS;
|
||||
if (((float)images_count / THUMBNAIL_COLS) - rows != 0) {
|
||||
rows++;
|
||||
}
|
||||
int height = kJPImagePickerControllerThumbnailSizeHeight * rows + PADDING * rows + PADDING + PADDING_TOP;
|
||||
|
||||
scrollView.contentSize = CGSizeMake(self.view.frame.size.width, height);
|
||||
scrollView.clipsToBounds = YES;
|
||||
|
||||
}
|
||||
|
||||
- (void)setImagePickerTitle:(NSString *)newTitle {
|
||||
self.navigationItem.title = newTitle;
|
||||
}
|
||||
|
||||
- (NSString *)imagePickerTitle {
|
||||
return self.navigationItem.title;
|
||||
}
|
||||
|
||||
/*
|
||||
// Override to allow orientations other than the default portrait orientation.
|
||||
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
|
||||
// Return YES for supported orientations
|
||||
return (interfaceOrientation == UIInterfaceOrientationPortrait);
|
||||
}
|
||||
*/
|
||||
|
||||
- (IBAction)cancelPicking:(id)sender {
|
||||
[[UIApplication sharedApplication] setStatusBarStyle:imagePickerController.originalStatusBarStyle animated:YES];
|
||||
[imagePickerController.delegate imagePickerDidCancel:imagePickerController];
|
||||
}
|
||||
|
||||
|
||||
- (void)buttonTouched:(UIButton *)sender {
|
||||
if (detailController == nil) {
|
||||
detailController = [[JPImagePickerDetailController alloc] initWithOverviewController:self];
|
||||
}
|
||||
[detailController prepareForImageNumber:(NSInteger)sender.tag];
|
||||
[imagePickerController.modalNavigationController pushViewController:detailController animated:YES];
|
||||
}
|
||||
|
||||
- (void)didReceiveMemoryWarning {
|
||||
// Releases the view if it doesn't have a superview.
|
||||
[super didReceiveMemoryWarning];
|
||||
|
||||
// Release any cached data, images, etc that aren't in use.
|
||||
}
|
||||
|
||||
- (void)viewDidUnload {
|
||||
// Release any retained subviews of the main view.
|
||||
// e.g. self.myOutlet = nil;
|
||||
}
|
||||
|
||||
|
||||
- (void)dealloc {
|
||||
[imagePickerController release];
|
||||
[detailController release];
|
||||
[scrollView release];
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
|
||||
@end
|
|
@ -1,405 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<archive type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="7.10">
|
||||
<data>
|
||||
<int key="IBDocument.SystemTarget">784</int>
|
||||
<string key="IBDocument.SystemVersion">10C540</string>
|
||||
<string key="IBDocument.InterfaceBuilderVersion">740</string>
|
||||
<string key="IBDocument.AppKitVersion">1038.25</string>
|
||||
<string key="IBDocument.HIToolboxVersion">458.00</string>
|
||||
<object class="NSMutableDictionary" key="IBDocument.PluginVersions">
|
||||
<string key="NS.key.0">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
|
||||
<string key="NS.object.0">62</string>
|
||||
</object>
|
||||
<object class="NSMutableArray" key="IBDocument.EditedObjectIDs">
|
||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||
<integer value="1"/>
|
||||
</object>
|
||||
<object class="NSArray" key="IBDocument.PluginDependencies">
|
||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||
<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
|
||||
</object>
|
||||
<object class="NSMutableDictionary" key="IBDocument.Metadata">
|
||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||
<object class="NSArray" key="dict.sortedKeys" id="0">
|
||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||
</object>
|
||||
<object class="NSMutableArray" key="dict.values">
|
||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||
</object>
|
||||
</object>
|
||||
<object class="NSMutableArray" key="IBDocument.RootObjects" id="1000">
|
||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||
<object class="IBProxyObject" id="372490531">
|
||||
<string key="IBProxiedObjectIdentifier">IBFilesOwner</string>
|
||||
</object>
|
||||
<object class="IBProxyObject" id="975951072">
|
||||
<string key="IBProxiedObjectIdentifier">IBFirstResponder</string>
|
||||
</object>
|
||||
<object class="IBUIView" id="191373211">
|
||||
<reference key="NSNextResponder"/>
|
||||
<int key="NSvFlags">264</int>
|
||||
<object class="NSMutableArray" key="NSSubviews">
|
||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||
<object class="IBUIScrollView" id="2529775">
|
||||
<reference key="NSNextResponder" ref="191373211"/>
|
||||
<int key="NSvFlags">274</int>
|
||||
<string key="NSFrameSize">{320, 480}</string>
|
||||
<reference key="NSSuperview" ref="191373211"/>
|
||||
<bool key="IBUIClipsSubviews">YES</bool>
|
||||
<bool key="IBUIMultipleTouchEnabled">YES</bool>
|
||||
<bool key="IBUIBouncesZoom">NO</bool>
|
||||
</object>
|
||||
</object>
|
||||
<string key="NSFrameSize">{320, 480}</string>
|
||||
<reference key="NSSuperview"/>
|
||||
<object class="NSColor" key="IBUIBackgroundColor">
|
||||
<int key="NSColorSpace">3</int>
|
||||
<bytes key="NSWhite">MQA</bytes>
|
||||
<object class="NSColorSpace" key="NSCustomColorSpace">
|
||||
<int key="NSID">2</int>
|
||||
</object>
|
||||
</object>
|
||||
<object class="IBUISimulatedStatusBarMetrics" key="IBUISimulatedStatusBarMetrics">
|
||||
<int key="IBUIStatusBarStyle">1</int>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
<object class="IBObjectContainer" key="IBDocument.Objects">
|
||||
<object class="NSMutableArray" key="connectionRecords">
|
||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||
<object class="IBConnectionRecord">
|
||||
<object class="IBCocoaTouchOutletConnection" key="connection">
|
||||
<string key="label">view</string>
|
||||
<reference key="source" ref="372490531"/>
|
||||
<reference key="destination" ref="191373211"/>
|
||||
</object>
|
||||
<int key="connectionID">3</int>
|
||||
</object>
|
||||
<object class="IBConnectionRecord">
|
||||
<object class="IBCocoaTouchOutletConnection" key="connection">
|
||||
<string key="label">scrollView</string>
|
||||
<reference key="source" ref="372490531"/>
|
||||
<reference key="destination" ref="2529775"/>
|
||||
</object>
|
||||
<int key="connectionID">5</int>
|
||||
</object>
|
||||
</object>
|
||||
<object class="IBMutableOrderedSet" key="objectRecords">
|
||||
<object class="NSArray" key="orderedObjects">
|
||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||
<object class="IBObjectRecord">
|
||||
<int key="objectID">0</int>
|
||||
<reference key="object" ref="0"/>
|
||||
<reference key="children" ref="1000"/>
|
||||
<nil key="parent"/>
|
||||
</object>
|
||||
<object class="IBObjectRecord">
|
||||
<int key="objectID">1</int>
|
||||
<reference key="object" ref="191373211"/>
|
||||
<object class="NSMutableArray" key="children">
|
||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||
<reference ref="2529775"/>
|
||||
</object>
|
||||
<reference key="parent" ref="0"/>
|
||||
<string key="objectName">ScrollView</string>
|
||||
</object>
|
||||
<object class="IBObjectRecord">
|
||||
<int key="objectID">-1</int>
|
||||
<reference key="object" ref="372490531"/>
|
||||
<reference key="parent" ref="0"/>
|
||||
<string key="objectName">File's Owner</string>
|
||||
</object>
|
||||
<object class="IBObjectRecord">
|
||||
<int key="objectID">-2</int>
|
||||
<reference key="object" ref="975951072"/>
|
||||
<reference key="parent" ref="0"/>
|
||||
</object>
|
||||
<object class="IBObjectRecord">
|
||||
<int key="objectID">4</int>
|
||||
<reference key="object" ref="2529775"/>
|
||||
<reference key="parent" ref="191373211"/>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
<object class="NSMutableDictionary" key="flattenedProperties">
|
||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||
<object class="NSArray" key="dict.sortedKeys">
|
||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||
<string>-1.CustomClassName</string>
|
||||
<string>-2.CustomClassName</string>
|
||||
<string>1.IBEditorWindowLastContentRect</string>
|
||||
<string>1.IBPluginDependency</string>
|
||||
<string>4.IBPluginDependency</string>
|
||||
</object>
|
||||
<object class="NSMutableArray" key="dict.values">
|
||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||
<string>JPImagePickerOverviewController</string>
|
||||
<string>UIResponder</string>
|
||||
<string>{{556, 412}, {320, 480}}</string>
|
||||
<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
|
||||
<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
|
||||
</object>
|
||||
</object>
|
||||
<object class="NSMutableDictionary" key="unlocalizedProperties">
|
||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||
<reference key="dict.sortedKeys" ref="0"/>
|
||||
<object class="NSMutableArray" key="dict.values">
|
||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||
</object>
|
||||
</object>
|
||||
<nil key="activeLocalization"/>
|
||||
<object class="NSMutableDictionary" key="localizations">
|
||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||
<reference key="dict.sortedKeys" ref="0"/>
|
||||
<object class="NSMutableArray" key="dict.values">
|
||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||
</object>
|
||||
</object>
|
||||
<nil key="sourceID"/>
|
||||
<int key="maxID">5</int>
|
||||
</object>
|
||||
<object class="IBClassDescriber" key="IBDocument.Classes">
|
||||
<object class="NSMutableArray" key="referencedPartialClassDescriptions">
|
||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||
<object class="IBPartialClassDescription">
|
||||
<string key="className">JPImagePickerOverviewController</string>
|
||||
<string key="superclassName">UIViewController</string>
|
||||
<object class="NSMutableDictionary" key="actions">
|
||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||
<object class="NSArray" key="dict.sortedKeys">
|
||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||
<string>buttonTouched:</string>
|
||||
<string>cancelPicking:</string>
|
||||
</object>
|
||||
<object class="NSMutableArray" key="dict.values">
|
||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||
<string>UIButton</string>
|
||||
<string>id</string>
|
||||
</object>
|
||||
</object>
|
||||
<object class="NSMutableDictionary" key="outlets">
|
||||
<string key="NS.key.0">scrollView</string>
|
||||
<string key="NS.object.0">UIScrollView</string>
|
||||
</object>
|
||||
<object class="IBClassDescriptionSource" key="sourceIdentifier">
|
||||
<string key="majorKey">IBProjectSource</string>
|
||||
<string key="minorKey">Classes/JPImagePickerOverviewController.h</string>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
<object class="NSMutableArray" key="referencedPartialClassDescriptionsV3.2+">
|
||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||
<object class="IBPartialClassDescription">
|
||||
<string key="className">NSObject</string>
|
||||
<object class="IBClassDescriptionSource" key="sourceIdentifier">
|
||||
<string key="majorKey">IBFrameworkSource</string>
|
||||
<string key="minorKey">Foundation.framework/Headers/NSError.h</string>
|
||||
</object>
|
||||
</object>
|
||||
<object class="IBPartialClassDescription">
|
||||
<string key="className">NSObject</string>
|
||||
<object class="IBClassDescriptionSource" key="sourceIdentifier">
|
||||
<string key="majorKey">IBFrameworkSource</string>
|
||||
<string key="minorKey">Foundation.framework/Headers/NSFileManager.h</string>
|
||||
</object>
|
||||
</object>
|
||||
<object class="IBPartialClassDescription">
|
||||
<string key="className">NSObject</string>
|
||||
<object class="IBClassDescriptionSource" key="sourceIdentifier">
|
||||
<string key="majorKey">IBFrameworkSource</string>
|
||||
<string key="minorKey">Foundation.framework/Headers/NSKeyValueCoding.h</string>
|
||||
</object>
|
||||
</object>
|
||||
<object class="IBPartialClassDescription">
|
||||
<string key="className">NSObject</string>
|
||||
<object class="IBClassDescriptionSource" key="sourceIdentifier">
|
||||
<string key="majorKey">IBFrameworkSource</string>
|
||||
<string key="minorKey">Foundation.framework/Headers/NSKeyValueObserving.h</string>
|
||||
</object>
|
||||
</object>
|
||||
<object class="IBPartialClassDescription">
|
||||
<string key="className">NSObject</string>
|
||||
<object class="IBClassDescriptionSource" key="sourceIdentifier">
|
||||
<string key="majorKey">IBFrameworkSource</string>
|
||||
<string key="minorKey">Foundation.framework/Headers/NSKeyedArchiver.h</string>
|
||||
</object>
|
||||
</object>
|
||||
<object class="IBPartialClassDescription">
|
||||
<string key="className">NSObject</string>
|
||||
<object class="IBClassDescriptionSource" key="sourceIdentifier">
|
||||
<string key="majorKey">IBFrameworkSource</string>
|
||||
<string key="minorKey">Foundation.framework/Headers/NSNetServices.h</string>
|
||||
</object>
|
||||
</object>
|
||||
<object class="IBPartialClassDescription">
|
||||
<string key="className">NSObject</string>
|
||||
<object class="IBClassDescriptionSource" key="sourceIdentifier">
|
||||
<string key="majorKey">IBFrameworkSource</string>
|
||||
<string key="minorKey">Foundation.framework/Headers/NSObject.h</string>
|
||||
</object>
|
||||
</object>
|
||||
<object class="IBPartialClassDescription">
|
||||
<string key="className">NSObject</string>
|
||||
<object class="IBClassDescriptionSource" key="sourceIdentifier">
|
||||
<string key="majorKey">IBFrameworkSource</string>
|
||||
<string key="minorKey">Foundation.framework/Headers/NSPort.h</string>
|
||||
</object>
|
||||
</object>
|
||||
<object class="IBPartialClassDescription">
|
||||
<string key="className">NSObject</string>
|
||||
<object class="IBClassDescriptionSource" key="sourceIdentifier">
|
||||
<string key="majorKey">IBFrameworkSource</string>
|
||||
<string key="minorKey">Foundation.framework/Headers/NSRunLoop.h</string>
|
||||
</object>
|
||||
</object>
|
||||
<object class="IBPartialClassDescription">
|
||||
<string key="className">NSObject</string>
|
||||
<object class="IBClassDescriptionSource" key="sourceIdentifier">
|
||||
<string key="majorKey">IBFrameworkSource</string>
|
||||
<string key="minorKey">Foundation.framework/Headers/NSStream.h</string>
|
||||
</object>
|
||||
</object>
|
||||
<object class="IBPartialClassDescription">
|
||||
<string key="className">NSObject</string>
|
||||
<object class="IBClassDescriptionSource" key="sourceIdentifier">
|
||||
<string key="majorKey">IBFrameworkSource</string>
|
||||
<string key="minorKey">Foundation.framework/Headers/NSThread.h</string>
|
||||
</object>
|
||||
</object>
|
||||
<object class="IBPartialClassDescription">
|
||||
<string key="className">NSObject</string>
|
||||
<object class="IBClassDescriptionSource" key="sourceIdentifier">
|
||||
<string key="majorKey">IBFrameworkSource</string>
|
||||
<string key="minorKey">Foundation.framework/Headers/NSURL.h</string>
|
||||
</object>
|
||||
</object>
|
||||
<object class="IBPartialClassDescription">
|
||||
<string key="className">NSObject</string>
|
||||
<object class="IBClassDescriptionSource" key="sourceIdentifier">
|
||||
<string key="majorKey">IBFrameworkSource</string>
|
||||
<string key="minorKey">Foundation.framework/Headers/NSURLConnection.h</string>
|
||||
</object>
|
||||
</object>
|
||||
<object class="IBPartialClassDescription">
|
||||
<string key="className">NSObject</string>
|
||||
<object class="IBClassDescriptionSource" key="sourceIdentifier">
|
||||
<string key="majorKey">IBFrameworkSource</string>
|
||||
<string key="minorKey">Foundation.framework/Headers/NSXMLParser.h</string>
|
||||
</object>
|
||||
</object>
|
||||
<object class="IBPartialClassDescription">
|
||||
<string key="className">NSObject</string>
|
||||
<object class="IBClassDescriptionSource" key="sourceIdentifier">
|
||||
<string key="majorKey">IBFrameworkSource</string>
|
||||
<string key="minorKey">UIKit.framework/Headers/UIAccessibility.h</string>
|
||||
</object>
|
||||
</object>
|
||||
<object class="IBPartialClassDescription">
|
||||
<string key="className">NSObject</string>
|
||||
<object class="IBClassDescriptionSource" key="sourceIdentifier">
|
||||
<string key="majorKey">IBFrameworkSource</string>
|
||||
<string key="minorKey">UIKit.framework/Headers/UINibLoading.h</string>
|
||||
</object>
|
||||
</object>
|
||||
<object class="IBPartialClassDescription">
|
||||
<string key="className">NSObject</string>
|
||||
<object class="IBClassDescriptionSource" key="sourceIdentifier" id="1039679019">
|
||||
<string key="majorKey">IBFrameworkSource</string>
|
||||
<string key="minorKey">UIKit.framework/Headers/UIResponder.h</string>
|
||||
</object>
|
||||
</object>
|
||||
<object class="IBPartialClassDescription">
|
||||
<string key="className">UIButton</string>
|
||||
<string key="superclassName">UIControl</string>
|
||||
<object class="IBClassDescriptionSource" key="sourceIdentifier">
|
||||
<string key="majorKey">IBFrameworkSource</string>
|
||||
<string key="minorKey">UIKit.framework/Headers/UIButton.h</string>
|
||||
</object>
|
||||
</object>
|
||||
<object class="IBPartialClassDescription">
|
||||
<string key="className">UIControl</string>
|
||||
<string key="superclassName">UIView</string>
|
||||
<object class="IBClassDescriptionSource" key="sourceIdentifier">
|
||||
<string key="majorKey">IBFrameworkSource</string>
|
||||
<string key="minorKey">UIKit.framework/Headers/UIControl.h</string>
|
||||
</object>
|
||||
</object>
|
||||
<object class="IBPartialClassDescription">
|
||||
<string key="className">UIResponder</string>
|
||||
<string key="superclassName">NSObject</string>
|
||||
<reference key="sourceIdentifier" ref="1039679019"/>
|
||||
</object>
|
||||
<object class="IBPartialClassDescription">
|
||||
<string key="className">UIScrollView</string>
|
||||
<string key="superclassName">UIView</string>
|
||||
<object class="IBClassDescriptionSource" key="sourceIdentifier">
|
||||
<string key="majorKey">IBFrameworkSource</string>
|
||||
<string key="minorKey">UIKit.framework/Headers/UIScrollView.h</string>
|
||||
</object>
|
||||
</object>
|
||||
<object class="IBPartialClassDescription">
|
||||
<string key="className">UISearchBar</string>
|
||||
<string key="superclassName">UIView</string>
|
||||
<object class="IBClassDescriptionSource" key="sourceIdentifier">
|
||||
<string key="majorKey">IBFrameworkSource</string>
|
||||
<string key="minorKey">UIKit.framework/Headers/UISearchBar.h</string>
|
||||
</object>
|
||||
</object>
|
||||
<object class="IBPartialClassDescription">
|
||||
<string key="className">UISearchDisplayController</string>
|
||||
<string key="superclassName">NSObject</string>
|
||||
<object class="IBClassDescriptionSource" key="sourceIdentifier">
|
||||
<string key="majorKey">IBFrameworkSource</string>
|
||||
<string key="minorKey">UIKit.framework/Headers/UISearchDisplayController.h</string>
|
||||
</object>
|
||||
</object>
|
||||
<object class="IBPartialClassDescription">
|
||||
<string key="className">UIView</string>
|
||||
<object class="IBClassDescriptionSource" key="sourceIdentifier">
|
||||
<string key="majorKey">IBFrameworkSource</string>
|
||||
<string key="minorKey">UIKit.framework/Headers/UITextField.h</string>
|
||||
</object>
|
||||
</object>
|
||||
<object class="IBPartialClassDescription">
|
||||
<string key="className">UIView</string>
|
||||
<string key="superclassName">UIResponder</string>
|
||||
<object class="IBClassDescriptionSource" key="sourceIdentifier">
|
||||
<string key="majorKey">IBFrameworkSource</string>
|
||||
<string key="minorKey">UIKit.framework/Headers/UIView.h</string>
|
||||
</object>
|
||||
</object>
|
||||
<object class="IBPartialClassDescription">
|
||||
<string key="className">UIViewController</string>
|
||||
<object class="IBClassDescriptionSource" key="sourceIdentifier">
|
||||
<string key="majorKey">IBFrameworkSource</string>
|
||||
<string key="minorKey">UIKit.framework/Headers/UINavigationController.h</string>
|
||||
</object>
|
||||
</object>
|
||||
<object class="IBPartialClassDescription">
|
||||
<string key="className">UIViewController</string>
|
||||
<object class="IBClassDescriptionSource" key="sourceIdentifier">
|
||||
<string key="majorKey">IBFrameworkSource</string>
|
||||
<string key="minorKey">UIKit.framework/Headers/UITabBarController.h</string>
|
||||
</object>
|
||||
</object>
|
||||
<object class="IBPartialClassDescription">
|
||||
<string key="className">UIViewController</string>
|
||||
<string key="superclassName">UIResponder</string>
|
||||
<object class="IBClassDescriptionSource" key="sourceIdentifier">
|
||||
<string key="majorKey">IBFrameworkSource</string>
|
||||
<string key="minorKey">UIKit.framework/Headers/UIViewController.h</string>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
<int key="IBDocument.localizationMode">0</int>
|
||||
<object class="NSMutableDictionary" key="IBDocument.PluginDeclaredDevelopmentDependencies">
|
||||
<string key="NS.key.0">com.apple.InterfaceBuilder.CocoaTouchPlugin.InterfaceBuilder3</string>
|
||||
<integer value="3000" key="NS.object.0"/>
|
||||
</object>
|
||||
<bool key="IBDocument.PluginDeclaredDependenciesTrackSystemTargetVersion">YES</bool>
|
||||
<string key="IBDocument.LastKnownRelativeProjectPath">../Emoticard.xcodeproj</string>
|
||||
<int key="IBDocument.defaultPropertyAccessControl">3</int>
|
||||
<string key="IBCocoaTouchPluginVersion">3.1</string>
|
||||
</data>
|
||||
</archive>
|
|
@ -1,27 +0,0 @@
|
|||
//
|
||||
// UIImageResizing.h
|
||||
// JPImagePickerController
|
||||
//
|
||||
// Created by Jeena on 07.11.09.
|
||||
// Copyright 2009 Jeena Paradies.
|
||||
// Licence: MIT-Licence
|
||||
//
|
||||
// Most of this code is from http://stackoverflow.com/questions/603907/uiimage-resize-then-crop
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
|
||||
@interface UIImage (Resize)
|
||||
|
||||
+ (UIImage *)image:(UIImage *)sourceImage scaleAndCroppForSize:(CGSize)targetSize;
|
||||
- (UIImage *)scaleAndCropToSize:(CGSize)newSize;
|
||||
- (UIImage *)scaleAndCropToSize:(CGSize)targetSize onlyIfNeeded:(BOOL)onlyIfNeeded;
|
||||
|
||||
+ (UIImage *)image:(UIImage *)image scaleToSize:(CGSize)newSize;
|
||||
- (UIImage *)scaleToSize:(CGSize)newSize;
|
||||
- (UIImage *)scaleToSize:(CGSize)targetSize onlyIfNeeded:(BOOL)onlyIfNeeded;
|
||||
|
||||
+ (BOOL)image:(UIImage *)sourceImage needsToScale:(CGSize)targetSize;
|
||||
- (BOOL)needsToScale:(CGSize)targetSize;
|
||||
|
||||
@end
|
|
@ -1,150 +0,0 @@
|
|||
//
|
||||
// UIImageResizing.m
|
||||
// JPImagePickerController
|
||||
//
|
||||
// Created by Jeena on 07.11.09.
|
||||
// Copyright 2009 Jeena Paradies.
|
||||
// Licence: MIT-Licence
|
||||
//
|
||||
|
||||
#import "UIImageResizing.h"
|
||||
|
||||
|
||||
@implementation UIImage (Resizing)
|
||||
|
||||
+ (UIImage *)image:(UIImage *)sourceImage scaleAndCroppForSize:(CGSize)targetSize {
|
||||
|
||||
UIImage *newImage = nil;
|
||||
CGSize imageSize = sourceImage.size;
|
||||
CGFloat width = imageSize.width;
|
||||
CGFloat height = imageSize.height;
|
||||
CGFloat targetWidth = targetSize.width;
|
||||
CGFloat targetHeight = targetSize.height;
|
||||
CGFloat scaleFactor = 0.0;
|
||||
CGFloat scaledWidth = targetWidth;
|
||||
CGFloat scaledHeight = targetHeight;
|
||||
CGPoint thumbnailPoint = CGPointMake(0.0,0.0);
|
||||
|
||||
if (CGSizeEqualToSize(imageSize, targetSize) == NO)
|
||||
{
|
||||
CGFloat widthFactor = targetWidth / width;
|
||||
CGFloat heightFactor = targetHeight / height;
|
||||
|
||||
if (widthFactor >= heightFactor) {
|
||||
scaleFactor = widthFactor; // scale to fit height
|
||||
} else {
|
||||
scaleFactor = heightFactor; // scale to fit width
|
||||
}
|
||||
|
||||
scaledWidth = width * scaleFactor;
|
||||
scaledHeight = height * scaleFactor;
|
||||
|
||||
// center the image
|
||||
if (widthFactor >= heightFactor) {
|
||||
thumbnailPoint.y = (targetHeight - scaledHeight) * 0.5;
|
||||
} else if (widthFactor < heightFactor) {
|
||||
thumbnailPoint.x = (targetWidth - scaledWidth) * 0.5;
|
||||
}
|
||||
}
|
||||
|
||||
UIGraphicsBeginImageContext(targetSize); // this will crop
|
||||
|
||||
CGRect thumbnailRect = CGRectZero;
|
||||
thumbnailRect.origin = thumbnailPoint;
|
||||
thumbnailRect.size.width = scaledWidth;
|
||||
thumbnailRect.size.height = scaledHeight;
|
||||
|
||||
[sourceImage drawInRect:thumbnailRect];
|
||||
|
||||
newImage = UIGraphicsGetImageFromCurrentImageContext();
|
||||
if(newImage == nil)
|
||||
NSLog(@"could not scale image");
|
||||
|
||||
//pop the context to get back to the default
|
||||
UIGraphicsEndImageContext();
|
||||
|
||||
return newImage;
|
||||
}
|
||||
|
||||
- (UIImage *)scaleAndCropToSize:(CGSize)targetSize {
|
||||
return [UIImage image:self scaleAndCroppForSize:(CGSize)targetSize];
|
||||
}
|
||||
|
||||
- (UIImage *)scaleAndCropToSize:(CGSize)targetSize onlyIfNeeded:(BOOL)onlyIfNeeded {
|
||||
|
||||
UIImage *image;
|
||||
|
||||
if (!onlyIfNeeded || [self needsToScale:targetSize]) {
|
||||
image = [self scaleAndCropToSize:targetSize];
|
||||
} else {
|
||||
image = self;
|
||||
}
|
||||
|
||||
return image;
|
||||
}
|
||||
|
||||
+ (UIImage *)image:(UIImage *)sourceImage scaleToSize:(CGSize)targetSize {
|
||||
|
||||
CGFloat scaleFactor = 0.0;
|
||||
CGFloat scaledWidth = targetSize.width;
|
||||
CGFloat scaledHeight = targetSize.height;
|
||||
|
||||
CGFloat widthFactor = targetSize.width / sourceImage.size.width;
|
||||
CGFloat heightFactor = targetSize.height / sourceImage.size.height;
|
||||
|
||||
if (widthFactor < heightFactor) {
|
||||
scaleFactor = widthFactor; // scale to fit height
|
||||
} else {
|
||||
scaleFactor = heightFactor; // scale to fit width
|
||||
}
|
||||
|
||||
scaledWidth = sourceImage.size.width * scaleFactor;
|
||||
scaledHeight = sourceImage.size.height * scaleFactor;
|
||||
|
||||
CGSize propperSize = CGSizeMake(scaledWidth, scaledHeight);
|
||||
|
||||
UIGraphicsBeginImageContext( propperSize );
|
||||
[sourceImage drawInRect:CGRectMake(0, 0, propperSize.width, propperSize.height)];
|
||||
UIImage* newImage = UIGraphicsGetImageFromCurrentImageContext();
|
||||
UIGraphicsEndImageContext();
|
||||
|
||||
return newImage;
|
||||
}
|
||||
|
||||
- (UIImage *)scaleToSize:(CGSize)newSize {
|
||||
return [UIImage image:self scaleToSize:newSize];
|
||||
}
|
||||
|
||||
- (UIImage *)scaleToSize:(CGSize)targetSize onlyIfNeeded:(BOOL)onlyIfNeeded {
|
||||
|
||||
UIImage *image;
|
||||
|
||||
if (!onlyIfNeeded || [self needsToScale:targetSize]) {
|
||||
image = [self scaleToSize:targetSize];
|
||||
} else {
|
||||
image = self;
|
||||
}
|
||||
|
||||
return image;
|
||||
}
|
||||
|
||||
+ (BOOL)image:(UIImage *)sourceImage needsToScale:(CGSize)targetSize {
|
||||
BOOL needsToScale = NO;
|
||||
|
||||
if (sourceImage.size.width > targetSize.width) {
|
||||
needsToScale = YES;
|
||||
}
|
||||
|
||||
if (sourceImage.size.height > targetSize.height) {
|
||||
needsToScale = YES;
|
||||
}
|
||||
|
||||
return needsToScale;
|
||||
}
|
||||
|
||||
- (BOOL)needsToScale:(CGSize)targetSize {
|
||||
return [UIImage image:self needsToScale:targetSize];
|
||||
}
|
||||
|
||||
|
||||
@end
|
Reference in a new issue