-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Keyboard avoiding count algorithm changed
- Loading branch information
Evgeniy Kirpichenko
authored and
Evgeniy Kirpichenko
committed
Dec 7, 2012
1 parent
c34e6bb
commit e88280e
Showing
16 changed files
with
512 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,3 +4,5 @@ DerivedData | |
.DS* | ||
*.xcworkspace | ||
xcuserdata | ||
Pods | ||
Podfile.lock |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
// | ||
// CGRectTransform.h | ||
// EKKeyboardAvoidingScrollView | ||
// | ||
// Created by Evgeniy Kirpichenko on 12/7/12. | ||
// Copyright (c) 2012 Evgeniy Kirpichenko. All rights reserved. | ||
// | ||
|
||
// | ||
|
||
#import <UIKit/UIKit.h> | ||
|
||
typedef enum { | ||
CGRectTransformRotateLeft, | ||
CGRectTransformRotateRight, | ||
CGRectTransformExpand | ||
} CGRectTransform; | ||
|
||
CGRect CGRectTransformed(CGRect rect, CGSize viewSize, CGRectTransform transform) | ||
{ | ||
switch (transform) { | ||
case CGRectTransformRotateLeft: | ||
return CGRectMake(rect.origin.y, | ||
viewSize.width - CGRectGetMaxX(rect), | ||
rect.size.height, | ||
rect.size.width); | ||
case CGRectTransformRotateRight: | ||
return CGRectMake(viewSize.height - CGRectGetMaxY(rect), | ||
rect.origin.x, | ||
rect.size.height, | ||
rect.size.width); | ||
case CGRectTransformExpand: | ||
return CGRectMake(viewSize.width - CGRectGetMaxX(rect), | ||
viewSize.height - CGRectGetMaxY(rect), | ||
rect.size.width, | ||
rect.size.height); | ||
default: | ||
return rect; | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,3 +5,4 @@ | |
#ifdef __OBJC__ | ||
#import <Foundation/Foundation.h> | ||
#endif | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file added
BIN
+18.2 KB
Example/EKKeyboardAvoidingScrollViewExample-unit_tests/Default-568h@2x.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+15.7 KB
Example/EKKeyboardAvoidingScrollViewExample-unit_tests/Default@2x.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
45 changes: 45 additions & 0 deletions
45
...ingScrollViewExample-unit_tests/EKKeyboardAvoidingScrollViewExample-unit_tests-Info.plist
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | ||
<plist version="1.0"> | ||
<dict> | ||
<key>CFBundleDevelopmentRegion</key> | ||
<string>en</string> | ||
<key>CFBundleDisplayName</key> | ||
<string>${PRODUCT_NAME}</string> | ||
<key>CFBundleExecutable</key> | ||
<string>${EXECUTABLE_NAME}</string> | ||
<key>CFBundleIdentifier</key> | ||
<string>mls.${PRODUCT_NAME:rfc1034identifier}</string> | ||
<key>CFBundleInfoDictionaryVersion</key> | ||
<string>6.0</string> | ||
<key>CFBundleName</key> | ||
<string>${PRODUCT_NAME}</string> | ||
<key>CFBundlePackageType</key> | ||
<string>APPL</string> | ||
<key>CFBundleShortVersionString</key> | ||
<string>1.0</string> | ||
<key>CFBundleSignature</key> | ||
<string>????</string> | ||
<key>CFBundleVersion</key> | ||
<string>1.0</string> | ||
<key>LSRequiresIPhoneOS</key> | ||
<true/> | ||
<key>UIRequiredDeviceCapabilities</key> | ||
<array> | ||
<string>armv7</string> | ||
</array> | ||
<key>UISupportedInterfaceOrientations</key> | ||
<array> | ||
<string>UIInterfaceOrientationPortrait</string> | ||
<string>UIInterfaceOrientationLandscapeLeft</string> | ||
<string>UIInterfaceOrientationLandscapeRight</string> | ||
</array> | ||
<key>UISupportedInterfaceOrientations~ipad</key> | ||
<array> | ||
<string>UIInterfaceOrientationPortrait</string> | ||
<string>UIInterfaceOrientationPortraitUpsideDown</string> | ||
<string>UIInterfaceOrientationLandscapeLeft</string> | ||
<string>UIInterfaceOrientationLandscapeRight</string> | ||
</array> | ||
</dict> | ||
</plist> |
16 changes: 16 additions & 0 deletions
16
...ingScrollViewExample-unit_tests/EKKeyboardAvoidingScrollViewExample-unit_tests-Prefix.pch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
// | ||
// Prefix header for all source files of the 'EKKeyboardAvoidingScrollViewExample-unit_tests' target in the 'EKKeyboardAvoidingScrollViewExample-unit_tests' project | ||
// | ||
|
||
#import <Availability.h> | ||
|
||
#ifndef __IPHONE_3_0 | ||
#warning "This project uses features only available in iOS SDK 3.0 and later." | ||
#endif | ||
|
||
#ifdef __OBJC__ | ||
#import <UIKit/UIKit.h> | ||
#import <Foundation/Foundation.h> | ||
|
||
#import <Cedar-iOS/SpecHelper.h> | ||
#endif |
45 changes: 45 additions & 0 deletions
45
...ple/EKKeyboardAvoidingScrollViewExample-unit_tests/EKKeyboardAvoidingScrollmanagerSpec.mm
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
#import <UIKit/UIKit.h> | ||
#import <EKKeyboardAvoidingScrollView/CGRectTransform.h> | ||
|
||
using namespace Cedar::Matchers; | ||
using namespace Cedar::Doubles; | ||
|
||
SPEC_BEGIN(CGRectTransforming) | ||
|
||
describe(@"CGRect transformation:", ^{ | ||
context(@"CGRectTransformLeft",^{ | ||
it(@"Rectangle {{10,15},{50,100}} in view with size {320,480} should be transformed to {{15,260},{100,50}}", ^{ | ||
CGRect baseRect = CGRectMake(10, 15, 50, 100); | ||
CGRect transformedRect = CGRectTransformed(baseRect, {320,480}, CGRectTransformRotateLeft); | ||
expect(transformedRect.origin.x).to(equal(15)); | ||
expect(transformedRect.origin.y).to(equal(260)); | ||
expect(transformedRect.size.width).to(equal(100)); | ||
expect(transformedRect.size.height).to(equal(50)); | ||
}); | ||
}); | ||
|
||
context(@"CGRectTransformRight",^{ | ||
it(@"Rectangle {{10,15},{50,100}} in view with size {320,480} should be transformed to {{365,10},{100,50}}", ^{ | ||
CGRect baseRect = CGRectMake(10, 15, 50, 100); | ||
CGRect transformedRect = CGRectTransformed(baseRect, {320,480}, CGRectTransformRotateRight); | ||
expect(transformedRect.origin.x).to(equal(365)); | ||
expect(transformedRect.origin.y).to(equal(10)); | ||
expect(transformedRect.size.width).to(equal(100)); | ||
expect(transformedRect.size.height).to(equal(50)); | ||
}); | ||
}); | ||
|
||
context(@"CGRectTransformExpand",^{ | ||
it(@"Rectangle {{10,15},{50,100}} in view with size {320,480} should be transformed to {{260,365},{50,100}}", ^{ | ||
CGRect baseRect = CGRectMake(10, 15, 50, 100); | ||
CGRect transformedRect = CGRectTransformed(baseRect, {320,480}, CGRectTransformExpand); | ||
expect(transformedRect.origin.x).to(equal(260)); | ||
expect(transformedRect.origin.y).to(equal(365)); | ||
expect(transformedRect.size.width).to(equal(50)); | ||
expect(transformedRect.size.height).to(equal(100)); | ||
}); | ||
}); | ||
}); | ||
|
||
SPEC_END | ||
|
Oops, something went wrong.