Skip to content
This repository was archived by the owner on Jul 16, 2019. It is now read-only.

Commit

Permalink
v0.2
Browse files Browse the repository at this point in the history
  • Loading branch information
guillermomuntaner committed Nov 7, 2014
1 parent 001a78a commit b1bb953
Show file tree
Hide file tree
Showing 67 changed files with 544 additions and 543 deletions.
412 changes: 182 additions & 230 deletions Examples/GMPhotoPicker.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

49 changes: 17 additions & 32 deletions Examples/GMPhotoPicker/Base.lproj/Main.storyboard
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="6245" systemVersion="13E28" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" initialViewController="BYZ-38-t0r">
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="6250" systemVersion="14A389" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" initialViewController="BYZ-38-t0r">
<dependencies>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="6238"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="6244"/>
</dependencies>
<scenes>
<!--View Controller-->
Expand All @@ -16,52 +16,37 @@
<rect key="frame" x="0.0" y="0.0" width="600" height="600"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="LwY-y4-Ukl">
<rect key="frame" x="163" y="285" width="276" height="30"/>
<state key="normal" title="UIImagePicker Type:SavedPhotosAlbum">
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="Xik-1Q-ysg">
<rect key="frame" x="20" y="550" width="110" height="30"/>
<state key="normal" title="GMImagePicker">
<color key="titleShadowColor" white="0.5" alpha="1" colorSpace="calibratedWhite"/>
</state>
<connections>
<action selector="launchUIImagePickerControllerSourceTypeSavedPhotosAlbum:" destination="BYZ-38-t0r" eventType="touchUpInside" id="UWs-aB-oQh"/>
<action selector="launchGMImagePicker:" destination="BYZ-38-t0r" eventType="touchUpInside" id="pMR-Xa-6wM"/>
</connections>
</button>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="h1v-NB-0Gh">
<rect key="frame" x="186" y="323" width="229" height="30"/>
<state key="normal" title="UIImagePicker Type:PhotoLibrary">
<color key="titleShadowColor" white="0.5" alpha="1" colorSpace="calibratedWhite"/>
</state>
<connections>
<action selector="launchUIImagePickerControllerSourceTypePhotoLibrary:" destination="BYZ-38-t0r" eventType="touchUpInside" id="qZI-mD-HGo"/>
</connections>
</button>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="Xik-1Q-ysg">
<rect key="frame" x="245" y="228" width="110" height="30"/>
<state key="normal" title="GMImagePicker">
<rect key="frame" x="479" y="550" width="101" height="30"/>
<state key="normal" title="UIImagePicker">
<color key="titleShadowColor" white="0.5" alpha="1" colorSpace="calibratedWhite"/>
</state>
<connections>
<action selector="launchGMImagePicker:" destination="BYZ-38-t0r" eventType="touchUpInside" id="MRt-K3-WlQ"/>
<action selector="launchUIImagePicker:" destination="BYZ-38-t0r" eventType="touchUpInside" id="oL1-Xp-hCt"/>
</connections>
</button>
</subviews>
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/>
<constraints>
<constraint firstAttribute="centerX" secondItem="h1v-NB-0Gh" secondAttribute="centerX" id="7Eu-97-Xmg"/>
<constraint firstAttribute="centerX" secondItem="LwY-y4-Ukl" secondAttribute="centerX" constant="-1" id="EgU-dH-sx6"/>
<constraint firstAttribute="centerY" secondItem="Xik-1Q-ysg" secondAttribute="centerY" constant="57" id="HPe-Hd-tXq"/>
<constraint firstAttribute="centerY" secondItem="h1v-NB-0Gh" secondAttribute="centerY" constant="-38" id="NOc-8T-e5K"/>
<constraint firstAttribute="centerY" secondItem="Xik-1Q-ysg" secondAttribute="centerY" constant="42" id="dik-yK-xMC"/>
<constraint firstAttribute="centerX" secondItem="Xik-1Q-ysg" secondAttribute="centerX" id="seA-wj-IqE"/>
<constraint firstItem="LwY-y4-Ukl" firstAttribute="top" secondItem="Xik-1Q-ysg" secondAttribute="bottom" constant="29" id="t99-sX-NZZ"/>
<constraint firstAttribute="centerY" secondItem="LwY-y4-Ukl" secondAttribute="centerY" id="v7H-aA-vGv"/>
<constraint firstItem="Xik-1Q-ysg" firstAttribute="leading" secondItem="8bC-Xf-vdC" secondAttribute="leading" constant="20" id="LBS-nQ-mgK"/>
<constraint firstAttribute="trailing" secondItem="h1v-NB-0Gh" secondAttribute="trailing" constant="20" id="Vjj-hf-b1t"/>
<constraint firstItem="wfy-db-euE" firstAttribute="top" secondItem="h1v-NB-0Gh" secondAttribute="bottom" constant="20" id="ieW-bb-P1o"/>
<constraint firstItem="wfy-db-euE" firstAttribute="top" secondItem="Xik-1Q-ysg" secondAttribute="bottom" constant="20" id="s88-gU-OMQ"/>
</constraints>
<variation key="default">
<mask key="constraints">
<exclude reference="t99-sX-NZZ"/>
<exclude reference="dik-yK-xMC"/>
</mask>
</variation>
</view>
<connections>
<outlet property="gmImagePickerButton" destination="Xik-1Q-ysg" id="KYK-ai-Gkw"/>
<outlet property="uiImagePickerButton" destination="h1v-NB-0Gh" id="ugB-dp-QQa"/>
</connections>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="dkx-z0-nzr" sceneMemberID="firstResponder"/>
</objects>
Expand Down
Binary file removed Examples/GMPhotoPicker/GMResources/Checkmark.png
Binary file not shown.
Binary file not shown.
Binary file removed Examples/GMPhotoPicker/GMResources/ImageError.png
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
8 changes: 3 additions & 5 deletions Examples/GMPhotoPicker/ViewController.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,9 @@
#import <UIKit/UIKit.h>

@interface ViewController : UIViewController

@property (strong) UIImagePickerController* imagePickerController;

- (IBAction)launchGMImagePicker:(id)sender;
- (IBAction)launchUIImagePickerControllerSourceTypeSavedPhotosAlbum:(id)sender;
- (IBAction)launchUIImagePickerControllerSourceTypePhotoLibrary:(id)sender;
- (IBAction)launchUIImagePicker:(id)sender;
@property (weak, nonatomic) IBOutlet UIButton *gmImagePickerButton;
@property (weak, nonatomic) IBOutlet UIButton *uiImagePickerButton;
@end

80 changes: 24 additions & 56 deletions Examples/GMPhotoPicker/ViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -14,88 +14,56 @@


@interface ViewController () <GMImagePickerControllerDelegate, UINavigationControllerDelegate, UIImagePickerControllerDelegate>

//Multiple picker properties
@property (nonatomic, copy) NSArray *selectedImages;
@property (nonatomic, strong) UIPopoverController *popover;

@end

@implementation ViewController

- (void)viewDidLoad {
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.


}

-(void)viewDidAppear:(BOOL)animated
{
-(void)viewDidAppear:(BOOL)animated{
[super viewDidAppear:animated];

/*UIImagePickerController *cameraUI = [[UIImagePickerController alloc] init];
cameraUI.sourceType = UIImagePickerControllerSourceTypePhotoLibrary;
if([[[UIDevice currentDevice] systemVersion] floatValue]>=8.0)
{
UIPopoverController *popVC= [[UIPopoverController alloc] initWithContentViewController:cameraUI];
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.0 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
[popVC presentPopoverFromRect:CGRectMake(0, 0, 400, 400) inView:self.view permittedArrowDirections:UIPopoverArrowDirectionUp animated:NO];
});
}*/
}
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}

- (IBAction)testButton:(id)sender
{

}


- (IBAction)launchGMImagePicker:(id)sender
{
if (!self.selectedImages)
self.selectedImages = [[NSMutableArray alloc] init];

GMImagePickerController *picker = [[GMImagePickerController alloc] init];
picker.delegate = self;
picker.selectedAssets = [NSMutableArray arrayWithArray:self.selectedImages];
picker.colsInPortrait=3;
picker.colsInLandscape=5;
picker.minimumInteritemSpacing=2.0;
picker.delegate = self;
picker.title = @"Custom title";
picker.customNavigationBarPrompt = @"Custom helper message!";
picker.colsInPortrait = 3;
picker.colsInLandscape = 5;
picker.minimumInteritemSpacing = 2.0;
picker.modalPresentationStyle = UIModalPresentationPopover;

[self presentViewController:picker animated:YES completion:nil];
}

- (IBAction)launchUIImagePickerControllerSourceTypeSavedPhotosAlbum:(id)sender
{
UIImagePickerController *imagePickerController = [[UIImagePickerController alloc] init];
imagePickerController.modalPresentationStyle = UIModalPresentationFullScreen;
imagePickerController.sourceType = UIImagePickerControllerSourceTypeSavedPhotosAlbum;
imagePickerController.delegate = self;
self.imagePickerController = imagePickerController;
self.imagePickerController.modalPresentationStyle = UIModalPresentationPopover;
UIPopoverPresentationController *popPC = self.imagePickerController.popoverPresentationController;
UIPopoverPresentationController *popPC = picker.popoverPresentationController;
popPC.permittedArrowDirections = UIPopoverArrowDirectionAny;
[self showViewController:self.imagePickerController sender:self];
popPC.sourceView = _gmImagePickerButton;
popPC.sourceRect = _gmImagePickerButton.bounds;

[self showViewController:picker sender:sender];
}


- (IBAction)launchUIImagePickerControllerSourceTypePhotoLibrary:(id)sender
- (IBAction)launchUIImagePicker:(id)sender
{
UIImagePickerController *imagePickerController = [[UIImagePickerController alloc] init];
imagePickerController.modalPresentationStyle = UIModalPresentationFullScreen;
imagePickerController.sourceType = UIImagePickerControllerSourceTypePhotoLibrary;
imagePickerController.delegate = self;
self.imagePickerController = imagePickerController;
self.imagePickerController.modalPresentationStyle = UIModalPresentationPopover;
UIPopoverPresentationController *popPC = self.imagePickerController.popoverPresentationController;
UIImagePickerController *picker = [[UIImagePickerController alloc] init];
picker.sourceType = UIImagePickerControllerSourceTypePhotoLibrary;
picker.delegate = self;
picker.modalPresentationStyle = UIModalPresentationPopover;

UIPopoverPresentationController *popPC = picker.popoverPresentationController;
popPC.permittedArrowDirections = UIPopoverArrowDirectionAny;
[self showViewController:self.imagePickerController sender:self];
popPC.sourceView = _uiImagePickerButton;
popPC.sourceRect = _uiImagePickerButton.bounds;

[self showViewController:picker sender:sender];
}


Expand Down
Binary file added GMImagePicker/Base.lproj/GMImagePicker.strings
Binary file not shown.
2 changes: 0 additions & 2 deletions GMImagePicker/GMAlbumsViewCell.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,5 @@
@property (nonatomic, strong) CAGradientLayer *gradient;
//Selection overlay

- (void)bindFetchResults:(PHFetchResult *)assetsFetchResults;
- (void)bindAssetCollection:(PHAssetCollection *)assetCollection;
- (void)setVideoLayout:(BOOL)isVideo;
@end
Loading

0 comments on commit b1bb953

Please sign in to comment.