Skip to content

Commit

Permalink
Merge pull request #45 from ruslanskorb/develop
Browse files Browse the repository at this point in the history
Version bump (1.1.2)
  • Loading branch information
ruslanskorb committed Mar 28, 2015
2 parents f5c3810 + 980fd6e commit 6367e14
Show file tree
Hide file tree
Showing 6 changed files with 81 additions and 9 deletions.
10 changes: 8 additions & 2 deletions Example/RSKImageCropperExample.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
B87A9A2D19A4D39800D12CD4 /* RSKImageCropViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = B87A9A2719A4D39800D12CD4 /* RSKImageCropViewController.m */; };
B87A9A2E19A4D39800D12CD4 /* RSKTouchView.m in Sources */ = {isa = PBXBuildFile; fileRef = B87A9A2919A4D39800D12CD4 /* RSKTouchView.m */; };
B87A9A2F19A4D39800D12CD4 /* UIImage+RSKImageCropper.m in Sources */ = {isa = PBXBuildFile; fileRef = B87A9A2B19A4D39800D12CD4 /* UIImage+RSKImageCropper.m */; };
B8B3824C1AC721A7004C55F0 /* UIApplication+RSKImageCropper.m in Sources */ = {isa = PBXBuildFile; fileRef = B8B3824B1AC721A7004C55F0 /* UIApplication+RSKImageCropper.m */; };
/* End PBXBuildFile section */

/* Begin PBXContainerItemProxy section */
Expand Down Expand Up @@ -72,6 +73,8 @@
B87A9A2919A4D39800D12CD4 /* RSKTouchView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RSKTouchView.m; sourceTree = "<group>"; };
B87A9A2A19A4D39800D12CD4 /* UIImage+RSKImageCropper.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UIImage+RSKImageCropper.h"; sourceTree = "<group>"; };
B87A9A2B19A4D39800D12CD4 /* UIImage+RSKImageCropper.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UIImage+RSKImageCropper.m"; sourceTree = "<group>"; };
B8B3824A1AC721A7004C55F0 /* UIApplication+RSKImageCropper.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UIApplication+RSKImageCropper.h"; sourceTree = "<group>"; };
B8B3824B1AC721A7004C55F0 /* UIApplication+RSKImageCropper.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UIApplication+RSKImageCropper.m"; sourceTree = "<group>"; };
E1A54F64148CAD255A339567 /* Pods-RSKImageCropperExampleTests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-RSKImageCropperExampleTests.release.xcconfig"; path = "Pods/Target Support Files/Pods-RSKImageCropperExampleTests/Pods-RSKImageCropperExampleTests.release.xcconfig"; sourceTree = "<group>"; };
/* End PBXFileReference section */

Expand Down Expand Up @@ -189,15 +192,17 @@
B87A9A2219A4D39800D12CD4 /* RSKImageCropper */ = {
isa = PBXGroup;
children = (
B803F69C1AAB0A1F004141CF /* CGGeometry+RSKImageCropper.h */,
B803F69D1AAB0A1F004141CF /* CGGeometry+RSKImageCropper.m */,
B87A9A2519A4D39800D12CD4 /* RSKImageCropper.h */,
B87A9A2619A4D39800D12CD4 /* RSKImageCropViewController.h */,
B87A9A2719A4D39800D12CD4 /* RSKImageCropViewController.m */,
B87A9A2319A4D39800D12CD4 /* RSKImageScrollView.h */,
B87A9A2419A4D39800D12CD4 /* RSKImageScrollView.m */,
B87A9A2819A4D39800D12CD4 /* RSKTouchView.h */,
B87A9A2919A4D39800D12CD4 /* RSKTouchView.m */,
B803F69C1AAB0A1F004141CF /* CGGeometry+RSKImageCropper.h */,
B803F69D1AAB0A1F004141CF /* CGGeometry+RSKImageCropper.m */,
B8B3824A1AC721A7004C55F0 /* UIApplication+RSKImageCropper.h */,
B8B3824B1AC721A7004C55F0 /* UIApplication+RSKImageCropper.m */,
B87A9A2A19A4D39800D12CD4 /* UIImage+RSKImageCropper.h */,
B87A9A2B19A4D39800D12CD4 /* UIImage+RSKImageCropper.m */,
);
Expand Down Expand Up @@ -354,6 +359,7 @@
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
B8B3824C1AC721A7004C55F0 /* UIApplication+RSKImageCropper.m in Sources */,
B87A9A2C19A4D39800D12CD4 /* RSKImageScrollView.m in Sources */,
B87A9A2E19A4D39800D12CD4 /* RSKTouchView.m in Sources */,
B87A9A2019A4D31100D12CD4 /* RSKExampleViewController.m in Sources */,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>1.1.1</string>
<string>1.1.2</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
Expand Down
2 changes: 1 addition & 1 deletion RSKImageCropper.podspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = 'RSKImageCropper'
s.version = '1.1.1'
s.version = '1.1.2'
s.summary = 'An image cropper for iOS like in the Contacts app with support for landscape orientation.'
s.homepage = 'https://github.com/ruslanskorb/RSKImageCropper'
s.license = { :type => 'MIT', :file => 'LICENSE' }
Expand Down
20 changes: 15 additions & 5 deletions RSKImageCropper/RSKImageCropViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
#import "RSKImageScrollView.h"
#import "UIImage+RSKImageCropper.h"
#import "CGGeometry+RSKImageCropper.h"
#import "UIApplication+RSKImageCropper.h"

static const CGFloat kPortraitCircleMaskRectInnerEdgeInset = 15.0f;
static const CGFloat kPortraitSquareMaskRectInnerEdgeInset = 20.0f;
Expand Down Expand Up @@ -127,8 +128,11 @@ - (void)viewWillAppear:(BOOL)animated
{
[super viewWillAppear:animated];

self.originalStatusBarHidden = [UIApplication sharedApplication].statusBarHidden;
[[UIApplication sharedApplication] setStatusBarHidden:YES];
UIApplication *application = [UIApplication rsk_sharedApplication];
if (application) {
self.originalStatusBarHidden = application.statusBarHidden;
[application setStatusBarHidden:YES];
}

self.originalNavigationControllerNavigationBarHidden = self.navigationController.navigationBarHidden;
[self.navigationController setNavigationBarHidden:YES animated:NO];
Expand All @@ -146,7 +150,11 @@ - (void)viewWillDisappear:(BOOL)animated
{
[super viewWillDisappear:animated];

[[UIApplication sharedApplication] setStatusBarHidden:self.originalStatusBarHidden];
UIApplication *application = [UIApplication rsk_sharedApplication];
if (application) {
[application setStatusBarHidden:self.originalStatusBarHidden];
}

[self.navigationController setNavigationBarHidden:self.originalNavigationControllerNavigationBarHidden animated:animated];
self.navigationController.view.backgroundColor = self.originalNavigationControllerViewBackgroundColor;
}
Expand Down Expand Up @@ -451,13 +459,15 @@ - (void)handleRotation:(UIRotationGestureRecognizer *)gestureRecognizer
}
}

#pragma mark - Private
#pragma mark - Public

- (BOOL)isPortraitInterfaceOrientation
{
return UIInterfaceOrientationIsPortrait([UIApplication sharedApplication].statusBarOrientation);
return CGRectGetHeight(self.view.frame) > CGRectGetWidth(self.view.frame);
}

#pragma mark - Private

- (void)reset:(BOOL)animated
{
if (animated) {
Expand Down
23 changes: 23 additions & 0 deletions RSKImageCropper/UIApplication+RSKImageCropper.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
//
// UIApplication+RSKImageCropper.h
// RSKImageCropperExample
//
// Created by Ruslan Skorb on 3/28/15.
// Copyright (c) 2015 Ruslan Skorb. All rights reserved.
//

#import <UIKit/UIKit.h>

/**
The category `RSKImageCropper` of the class `UIApplication` provides the method `rsk_sharedApplication` which returns `nil` in an application extension, otherwise it returns the singleton app instance.
*/
@interface UIApplication (RSKImageCropper)

/**
Returns `nil` in an application extension, otherwise returns the singleton app instance.
@return `nil` in an application extension, otherwise the app instance is created in the `UIApplicationMain` function.
*/
+ (UIApplication *)rsk_sharedApplication;

@end
33 changes: 33 additions & 0 deletions RSKImageCropper/UIApplication+RSKImageCropper.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
//
// UIApplication+RSKImageCropper.m
// RSKImageCropperExample
//
// Created by Ruslan Skorb on 3/28/15.
// Copyright (c) 2015 Ruslan Skorb. All rights reserved.
//

#import "UIApplication+RSKImageCropper.h"
#import <objc/runtime.h>

@implementation UIApplication (RSKImageCropper)

+ (void)load
{
// When you build an extension based on an Xcode template, you get an extension bundle that ends in .appex.
// https://developer.apple.com/library/ios/documentation/General/Conceptual/ExtensibilityPG/ExtensionCreation.html
if (![[[NSBundle mainBundle] bundlePath] hasSuffix:@".appex"]) {
Method sharedApplicationMethod = class_getClassMethod([UIApplication class], @selector(sharedApplication));
if (sharedApplicationMethod != NULL) {
IMP sharedApplicationMethodImplementation = method_getImplementation(sharedApplicationMethod);
Method rsk_sharedApplicationMethod = class_getClassMethod([UIApplication class], @selector(rsk_sharedApplication));
method_setImplementation(rsk_sharedApplicationMethod, sharedApplicationMethodImplementation);
}
}
}

+ (UIApplication *)rsk_sharedApplication
{
return nil;
}

@end

0 comments on commit 6367e14

Please sign in to comment.