Fixed #184 added shouldRestoreScrollViewContentOffset, #185 added new methods in IQUIView+IQKeyboardToolbar

This commit is contained in:
hackiftekhar
2015-03-26 00:11:58 +05:30
parent 024d233785
commit 8777297963
12 changed files with 429 additions and 40 deletions

Binary file not shown.

View File

@@ -188,6 +188,15 @@ extern NSInteger const kIQPreviousNextButtonToolbarTag;
/*******************************************/
//UIScrollView handling
/**
@property shouldRestoreScrollViewContentOffset
@abstract Restore scrollViewContentOffset when resigning from scrollView. Default is NO.
*/
@property(nonatomic, assign) BOOL shouldRestoreScrollViewContentOffset;
//UISound handling
@@ -221,24 +230,30 @@ extern NSInteger const kIQPreviousNextButtonToolbarTag;
/**
@method disableInViewControllerClass:
@method removeDisableInViewControllerClass:
@param disabledClass: Class in which library should not adjust view to show textField.
*/
-(void)disableInViewControllerClass:(Class)disabledClass;
-(void)removeDisableInViewControllerClass:(Class)disabledClass;
/**
@method disableToolbarInViewControllerClass
@method disableToolbarInViewControllerClass:
@method removeDisableToolbarInViewControllerClass:
@param toolbarDisabledClass: Class in which library should not add toolbar over textField.
*/
-(void)disableToolbarInViewControllerClass:(Class)toolbarDisabledClass;
-(void)removeDisableToolbarInViewControllerClass:(Class)toolbarDisabledClass;
/**
@method considerToolbarPreviousNextInViewClass
@method considerToolbarPreviousNextInViewClass:
@method removeConsiderToolbarPreviousNextInViewClass:
@param toolbarPreviousNextConsideredClass: Custom UIView subclass Class in which library should consider all inner textField as siblings and add next/previous accordingly.
*/
-(void)considerToolbarPreviousNextInViewClass:(Class)toolbarPreviousNextConsideredClass;
-(void)removeConsiderToolbarPreviousNextInViewClass:(Class)toolbarPreviousNextConsideredClass;
/*******************************************/

View File

@@ -233,6 +233,7 @@ void _IQShowLog(NSString *logString);
[self setPreventShowingBottomBlankSpace:YES];
[self setShouldShowTextFieldPlaceholder:YES];
[self setShouldAdoptDefaultKeyboardAnimation:YES];
[self setShouldRestoreScrollViewContentOffset:NO];
[self setToolbarManageBehaviour:IQAutoToolbarBySubviews];
//Initializing disabled classes Set.
@@ -464,8 +465,15 @@ void _IQShowLog(NSString *logString);
{
_IQShowLog([NSString stringWithFormat:@"Restoring %@ contentInset to : %@ and contentOffset to : %@",[_lastScrollView _IQDescription],NSStringFromUIEdgeInsets(_startingContentInsets),NSStringFromCGPoint(_startingContentOffset)]);
[_lastScrollView setContentInset:_startingContentInsets];
[_lastScrollView setContentOffset:_startingContentOffset animated:YES];
[UIView animateWithDuration:_animationDuration delay:0 options:(_animationCurve|UIViewAnimationOptionBeginFromCurrentState) animations:^{
[_lastScrollView setContentInset:_startingContentInsets];
} completion:NULL];
if (_shouldRestoreScrollViewContentOffset)
{
[_lastScrollView setContentOffset:_startingContentOffset animated:YES];
}
_startingContentInsets = UIEdgeInsetsZero;
_startingContentOffset = CGPointZero;
_lastScrollView = nil;
@@ -475,8 +483,15 @@ void _IQShowLog(NSString *logString);
{
_IQShowLog([NSString stringWithFormat:@"Restoring %@ contentInset to : %@ and contentOffset to : %@",[_lastScrollView _IQDescription],NSStringFromUIEdgeInsets(_startingContentInsets),NSStringFromCGPoint(_startingContentOffset)]);
[_lastScrollView setContentInset:_startingContentInsets];
[_lastScrollView setContentOffset:_startingContentOffset animated:YES];
[UIView animateWithDuration:_animationDuration delay:0 options:(_animationCurve|UIViewAnimationOptionBeginFromCurrentState) animations:^{
[_lastScrollView setContentInset:_startingContentInsets];
} completion:NULL];
if (_shouldRestoreScrollViewContentOffset)
{
[_lastScrollView setContentOffset:_startingContentOffset animated:YES];
}
_lastScrollView = superScrollView;
_startingContentInsets = superScrollView.contentInset;
_startingContentOffset = superScrollView.contentOffset;
@@ -567,7 +582,10 @@ void _IQShowLog(NSString *logString);
_IQShowLog([NSString stringWithFormat:@"%@ old ContentInset : %@",[_lastScrollView _IQDescription], NSStringFromUIEdgeInsets(_lastScrollView.contentInset)]);
_lastScrollView.contentInset = movedInsets;
[UIView animateWithDuration:_animationDuration delay:0 options:(_animationCurve|UIViewAnimationOptionBeginFromCurrentState) animations:^{
_lastScrollView.contentInset = movedInsets;
} completion:NULL];
if (_lastScrollView.contentSize.height<_lastScrollView.frame.size.height)
{
CGSize contentSize = _lastScrollView.contentSize;
@@ -892,26 +910,14 @@ void _IQShowLog(NSString *logString);
{
[UIView animateWithDuration:_animationDuration delay:0 options:(_animationCurve|UIViewAnimationOptionBeginFromCurrentState) animations:^{
_lastScrollView.contentInset = _startingContentInsets;
_lastScrollView.contentOffset = _startingContentOffset;
if (_shouldRestoreScrollViewContentOffset)
{
_lastScrollView.contentOffset = _startingContentOffset;
}
_IQShowLog([NSString stringWithFormat:@"Restoring %@ contentInset to : %@ and contentOffset to : %@",[_lastScrollView _IQDescription],NSStringFromUIEdgeInsets(_startingContentInsets),NSStringFromCGPoint(_startingContentOffset)]);
// TODO: restore scrollView state
// This is temporary solution. Have to implement the save and restore scrollView state
UIScrollView *superscrollView = _lastScrollView;
while ((superscrollView = (UIScrollView*)[superscrollView superviewOfClassType:[UIScrollView class]]))
{
CGSize contentSize = CGSizeMake(MAX(superscrollView.contentSize.width, superscrollView.IQ_width), MAX(superscrollView.contentSize.height, superscrollView.IQ_height));
CGFloat minimumY = contentSize.height-superscrollView.IQ_height;
if (minimumY<superscrollView.contentOffset.y)
{
superscrollView.contentOffset = CGPointMake(superscrollView.contentOffset.x, minimumY);
_IQShowLog([NSString stringWithFormat:@"Restoring %@ contentOffset to : %@",[superscrollView _IQDescription],NSStringFromCGPoint(superscrollView.contentOffset)]);
}
}
} completion:NULL];
}
@@ -1502,16 +1508,31 @@ void _IQShowLog(NSString *logString);
[_disabledClasses addObject:disabledClass];
}
-(void)removeDisableInViewControllerClass:(Class)disabledClass
{
[_disabledClasses removeObject:disabledClass];
}
-(void)disableToolbarInViewControllerClass:(Class)toolbarDisabledClass
{
[_disabledToolbarClasses addObject:toolbarDisabledClass];
}
-(void)removeDisableToolbarInViewControllerClass:(Class)toolbarDisabledClass
{
[_disabledToolbarClasses removeObject:toolbarDisabledClass];
}
-(void)considerToolbarPreviousNextInViewClass:(Class)toolbarPreviousNextConsideredClass
{
[_toolbarPreviousNextConsideredClass addObject:toolbarPreviousNextConsideredClass];
}
-(void)removeConsiderToolbarPreviousNextInViewClass:(Class)toolbarPreviousNextConsideredClass
{
[_toolbarPreviousNextConsideredClass removeObject:toolbarPreviousNextConsideredClass];
}
@end

View File

@@ -74,6 +74,11 @@
/**
@method addDoneOnKeyboardWithTarget:action:
@method addDoneOnKeyboardWithTarget:action:titleText:
@method addDoneOnKeyboardWithTarget:action:shouldShowPlaceholder:
@method addRightButtonOnKeyboardWithText:target:action:
@method addRightButtonOnKeyboardWithText:target:action:titleText:
@method addRightButtonOnKeyboardWithText:target:action:shouldShowPlaceholder:
@abstract Helper functions to add Done button on keyboard.
@@ -85,15 +90,20 @@
@param titleText: text to show as title in IQToolbar'.
*/
- (void)addRightButtonOnKeyboardWithText:(NSString*)text target:(id)target action:(SEL)action;
- (void)addRightButtonOnKeyboardWithText:(NSString*)text target:(id)target action:(SEL)action shouldShowPlaceholder:(BOOL)showPlaceholder;
- (void)addRightButtonOnKeyboardWithText:(NSString*)text target:(id)target action:(SEL)action titleText:(NSString*)titleText;
- (void)addDoneOnKeyboardWithTarget:(id)target action:(SEL)action;
- (void)addDoneOnKeyboardWithTarget:(id)target action:(SEL)action shouldShowPlaceholder:(BOOL)showPlaceholder;
- (void)addDoneOnKeyboardWithTarget:(id)target action:(SEL)action titleText:(NSString*)titleText;
- (void)addDoneOnKeyboardWithTarget:(id)target action:(SEL)action shouldShowPlaceholder:(BOOL)showPlaceholder;
- (void)addRightButtonOnKeyboardWithText:(NSString*)text target:(id)target action:(SEL)action;
- (void)addRightButtonOnKeyboardWithText:(NSString*)text target:(id)target action:(SEL)action titleText:(NSString*)titleText;
- (void)addRightButtonOnKeyboardWithText:(NSString*)text target:(id)target action:(SEL)action shouldShowPlaceholder:(BOOL)showPlaceholder;
/**
@method addCancelDoneOnKeyboardWithTarget:cancelAction:doneAction:
@method addCancelDoneOnKeyboardWithTarget:cancelAction:doneAction:titleText:
@method addCancelDoneOnKeyboardWithTarget:cancelAction:doneAction:shouldShowPlaceholder:
@method addLeftRightOnKeyboardWithTarget:leftButtonTitle:rightButtonTitle:leftButtonAction:rightButtonAction
@method addLeftRightOnKeyboardWithTarget:leftButtonTitle:rightButtonTitle:leftButtonAction:rightButtonAction:titleText:
@method addLeftRightOnKeyboardWithTarget:leftButtonTitle:rightButtonTitle:leftButtonAction:rightButtonAction:shouldShowPlaceholder:
@abstract Helper function to add Cancel and Done button on keyboard.
@@ -107,15 +117,20 @@
@param titleText: text to show as title in IQToolbar'.
*/
- (void)addRightLeftOnKeyboardWithTarget:(id)target leftButtonTitle:(NSString*)leftTitle rightButtonTitle:(NSString*)rightTitle rightButtonAction:(SEL)rightAction leftButtonAction:(SEL)leftAction;
- (void)addRightLeftOnKeyboardWithTarget:(id)target leftButtonTitle:(NSString*)leftTitle rightButtonTitle:(NSString*)rightTitle rightButtonAction:(SEL)rightAction leftButtonAction:(SEL)leftAction shouldShowPlaceholder:(BOOL)showPlaceholder;
- (void)addRightLeftOnKeyboardWithTarget:(id)target leftButtonTitle:(NSString*)leftTitle rightButtonTitle:(NSString*)rightTitle rightButtonAction:(SEL)rightAction leftButtonAction:(SEL)leftAction titleText:(NSString*)titleText;
- (void)addCancelDoneOnKeyboardWithTarget:(id)target cancelAction:(SEL)cancelAction doneAction:(SEL)doneAction;
- (void)addCancelDoneOnKeyboardWithTarget:(id)target cancelAction:(SEL)cancelAction doneAction:(SEL)doneAction shouldShowPlaceholder:(BOOL)showPlaceholder;
- (void)addCancelDoneOnKeyboardWithTarget:(id)target cancelAction:(SEL)cancelAction doneAction:(SEL)doneAction titleText:(NSString*)titleText;
- (void)addCancelDoneOnKeyboardWithTarget:(id)target cancelAction:(SEL)cancelAction doneAction:(SEL)doneAction shouldShowPlaceholder:(BOOL)showPlaceholder;
- (void)addLeftRightOnKeyboardWithTarget:(id)target leftButtonTitle:(NSString*)leftTitle rightButtonTitle:(NSString*)rightTitle leftButtonAction:(SEL)leftAction rightButtonAction:(SEL)rightAction;
- (void)addLeftRightOnKeyboardWithTarget:(id)target leftButtonTitle:(NSString*)leftTitle rightButtonTitle:(NSString*)rightTitle leftButtonAction:(SEL)leftAction rightButtonAction:(SEL)rightAction titleText:(NSString*)titleText;
- (void)addLeftRightOnKeyboardWithTarget:(id)target leftButtonTitle:(NSString*)leftTitle rightButtonTitle:(NSString*)rightTitle leftButtonAction:(SEL)leftAction rightButtonAction:(SEL)rightAction shouldShowPlaceholder:(BOOL)showPlaceholder;
/**
@method addPreviousNextDoneOnKeyboardWithTarget:previousAction:nextAction:doneAction
@method addPreviousNextDoneOnKeyboardWithTarget:previousAction:nextAction:doneAction:titleText:
@method addPreviousNextDoneOnKeyboardWithTarget:previousAction:nextAction:doneAction:shouldShowPlaceholder:
@method addPreviousNextRightOnKeyboardWithTarget:rightButtonTitle:previousAction:nextAction:rightButtonAction
@method addPreviousNextRightOnKeyboardWithTarget:rightButtonTitle:previousAction:nextAction:rightButtonAction:titleText:
@method addPreviousNextRightOnKeyboardWithTarget:rightButtonTitle:previousAction:nextAction:rightButtonAction:shouldShowPlaceholder:
@abstract Helper function to add SegmentedNextPrevious and Done button on keyboard.
@@ -132,8 +147,11 @@
@param titleText: text to show as title in IQToolbar'.
*/
- (void)addPreviousNextDoneOnKeyboardWithTarget:(id)target previousAction:(SEL)previousAction nextAction:(SEL)nextAction doneAction:(SEL)doneAction;
- (void)addPreviousNextDoneOnKeyboardWithTarget:(id)target previousAction:(SEL)previousAction nextAction:(SEL)nextAction doneAction:(SEL)doneAction shouldShowPlaceholder:(BOOL)showPlaceholder;
- (void)addPreviousNextDoneOnKeyboardWithTarget:(id)target previousAction:(SEL)previousAction nextAction:(SEL)nextAction doneAction:(SEL)doneAction titleText:(NSString*)titleText;
- (void)addPreviousNextDoneOnKeyboardWithTarget:(id)target previousAction:(SEL)previousAction nextAction:(SEL)nextAction doneAction:(SEL)doneAction shouldShowPlaceholder:(BOOL)showPlaceholder;
- (void)addPreviousNextRightOnKeyboardWithTarget:(id)target rightButtonTitle:(NSString*)rightButtonTitle previousAction:(SEL)previousAction nextAction:(SEL)nextAction rightButtonAction:(SEL)rightButtonAction;
- (void)addPreviousNextRightOnKeyboardWithTarget:(id)target rightButtonTitle:(NSString*)rightButtonTitle previousAction:(SEL)previousAction nextAction:(SEL)nextAction rightButtonAction:(SEL)rightButtonAction titleText:(NSString*)titleText;
- (void)addPreviousNextRightOnKeyboardWithTarget:(id)target rightButtonTitle:(NSString*)rightButtonTitle previousAction:(SEL)previousAction nextAction:(SEL)nextAction rightButtonAction:(SEL)rightButtonAction shouldShowPlaceholder:(BOOL)showPlaceholder;
/**
@method setEnablePrevious:next:

View File

@@ -257,7 +257,7 @@ IQ_LoadCategory(IQUIViewToolbar)
[self addDoneOnKeyboardWithTarget:target action:action titleText:nil];
}
- (void)addRightLeftOnKeyboardWithTarget:(id)target leftButtonTitle:(NSString*)leftTitle rightButtonTitle:(NSString*)rightTitle rightButtonAction:(SEL)rightAction leftButtonAction:(SEL)leftAction titleText:(NSString*)titleText
- (void)addLeftRightOnKeyboardWithTarget:(id)target leftButtonTitle:(NSString*)leftTitle rightButtonTitle:(NSString*)rightTitle leftButtonAction:(SEL)leftAction rightButtonAction:(SEL)rightAction titleText:(NSString*)titleText
{
// If can't set InputAccessoryView. Then return
if (![self respondsToSelector:@selector(setInputAccessoryView:)]) return;
@@ -321,18 +321,18 @@ IQ_LoadCategory(IQUIViewToolbar)
[(UITextField*)self setInputAccessoryView:toolbar];
}
- (void)addRightLeftOnKeyboardWithTarget:(id)target leftButtonTitle:(NSString*)leftTitle rightButtonTitle:(NSString*)rightTitle rightButtonAction:(SEL)rightAction leftButtonAction:(SEL)leftAction shouldShowPlaceholder:(BOOL)showPlaceholder
- (void)addLeftRightOnKeyboardWithTarget:(id)target leftButtonTitle:(NSString*)leftTitle rightButtonTitle:(NSString*)rightTitle leftButtonAction:(SEL)leftAction rightButtonAction:(SEL)rightAction shouldShowPlaceholder:(BOOL)showPlaceholder
{
NSString *title;
if (showPlaceholder && [self respondsToSelector:@selector(placeholder)]) title = [(UITextField*)self placeholder];
[self addRightLeftOnKeyboardWithTarget:target leftButtonTitle:leftTitle rightButtonTitle:rightTitle rightButtonAction:rightAction leftButtonAction:leftAction titleText:title];
[self addLeftRightOnKeyboardWithTarget:target leftButtonTitle:leftTitle rightButtonTitle:rightTitle leftButtonAction:leftAction rightButtonAction:rightAction titleText:title];
}
- (void)addRightLeftOnKeyboardWithTarget:(id)target leftButtonTitle:(NSString*)leftTitle rightButtonTitle:(NSString*)rightTitle rightButtonAction:(SEL)rightAction leftButtonAction:(SEL)leftAction
- (void)addLeftRightOnKeyboardWithTarget:(id)target leftButtonTitle:(NSString*)leftTitle rightButtonTitle:(NSString*)rightTitle leftButtonAction:(SEL)leftAction rightButtonAction:(SEL)rightAction
{
[self addRightLeftOnKeyboardWithTarget:target leftButtonTitle:leftTitle rightButtonTitle:rightTitle rightButtonAction:rightAction leftButtonAction:leftAction titleText:nil];
[self addLeftRightOnKeyboardWithTarget:target leftButtonTitle:leftTitle rightButtonTitle:rightTitle leftButtonAction:leftAction rightButtonAction:rightAction titleText:nil];
}
- (void)addCancelDoneOnKeyboardWithTarget:(id)target cancelAction:(SEL)cancelAction doneAction:(SEL)doneAction titleText:(NSString*)titleText
@@ -511,6 +511,103 @@ IQ_LoadCategory(IQUIViewToolbar)
[self addPreviousNextDoneOnKeyboardWithTarget:target previousAction:previousAction nextAction:nextAction doneAction:doneAction titleText:nil];
}
- (void)addPreviousNextRightOnKeyboardWithTarget:(id)target rightButtonTitle:(NSString*)rightButtonTitle previousAction:(SEL)previousAction nextAction:(SEL)nextAction rightButtonAction:(SEL)rightButtonAction titleText:(NSString*)titleText
{
//If can't set InputAccessoryView. Then return
if (![self respondsToSelector:@selector(setInputAccessoryView:)]) return;
// Creating a toolBar for phoneNumber keyboard
IQToolbar *toolbar = [[IQToolbar alloc] init];
if ([self respondsToSelector:@selector(keyboardAppearance)])
{
switch ([(UITextField*)self keyboardAppearance])
{
case UIKeyboardAppearanceAlert: toolbar.barStyle = UIBarStyleBlack; break;
default: toolbar.barStyle = UIBarStyleDefault; break;
}
}
NSMutableArray *items = [[NSMutableArray alloc] init];
// Create a done button to show on keyboard to resign it. Adding a selector to resign it.
IQBarButtonItem *doneButton =[[IQBarButtonItem alloc] initWithTitle:titleText style:UIBarButtonItemStyleDone target:target action:rightButtonAction];
if (IQ_IS_IOS7_OR_GREATER)
{
// UIBarButtonItem *prev = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:105 target:target action:previousAction];
// UIBarButtonItem *next = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:106 target:target action:nextAction];
IQBarButtonItem *prev = [[IQBarButtonItem alloc] initWithImage:[UIImage imageNamed:@"IQKeyboardManager.bundle/IQButtonBarArrowLeft"] style:UIBarButtonItemStylePlain target:target action:previousAction];
IQBarButtonItem *fixed =[[IQBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemFixedSpace target:nil action:nil];
[fixed setWidth:23];
IQBarButtonItem *next = [[IQBarButtonItem alloc] initWithImage:[UIImage imageNamed:@"IQKeyboardManager.bundle/IQButtonBarArrowRight"] style:UIBarButtonItemStylePlain target:target action:nextAction];
[items addObject:prev];
[items addObject:fixed];
[items addObject:next];
}
else
{
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
// Create a next/previous button to switch between TextFieldViews.
IQSegmentedNextPrevious *segControl = [[IQSegmentedNextPrevious alloc] initWithTarget:target previousAction:previousAction nextAction:nextAction];
#pragma GCC diagnostic pop
IQBarButtonItem *segButton = [[IQBarButtonItem alloc] initWithCustomView:segControl];
[items addObject:segButton];
}
if ([titleText length] && self.shouldHideTitle == NO)
{
CGRect buttonFrame;
if (IQ_IS_IOS7_OR_GREATER)
{
/*
72.5 next/previous maximum x.
50 done button frame.
8+8 distance maintenance
*/
buttonFrame = CGRectMake(0, 0, toolbar.frame.size.width-72.5-50.0-16, 44);
}
else
{
/*
135 next/previous maximum x.
57 done button frame.
8+8 distance maintenance
*/
buttonFrame = CGRectMake(0, 0, toolbar.frame.size.width-135-57.0-16, 44);
}
IQTitleBarButtonItem *title = [[IQTitleBarButtonItem alloc] initWithFrame:buttonFrame title:titleText];
[items addObject:title];
}
IQBarButtonItem *nilButton =[[IQBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemFlexibleSpace target:nil action:nil];
[items addObject:nilButton];
[items addObject:doneButton];
// Adding button to toolBar.
[toolbar setItems:items];
// Setting toolbar to keyboard.
[(UITextField*)self setInputAccessoryView:toolbar];
}
- (void)addPreviousNextRightOnKeyboardWithTarget:(id)target rightButtonTitle:(NSString*)rightButtonTitle previousAction:(SEL)previousAction nextAction:(SEL)nextAction rightButtonAction:(SEL)rightButtonAction shouldShowPlaceholder:(BOOL)showPlaceholder
{
NSString *title;
if (showPlaceholder && [self respondsToSelector:@selector(placeholder)]) title = [(UITextField*)self placeholder];
[self addPreviousNextRightOnKeyboardWithTarget:target rightButtonTitle:rightButtonTitle previousAction:previousAction nextAction:nextAction rightButtonAction:rightButtonAction titleText:title];
}
- (void)addPreviousNextRightOnKeyboardWithTarget:(id)target rightButtonTitle:(NSString*)rightButtonTitle previousAction:(SEL)previousAction nextAction:(SEL)nextAction rightButtonAction:(SEL)rightButtonAction
{
[self addPreviousNextRightOnKeyboardWithTarget:target rightButtonTitle:rightButtonTitle previousAction:previousAction nextAction:nextAction rightButtonAction:rightButtonAction titleText:nil];
}
-(void)setEnablePrevious:(BOOL)isPreviousEnabled next:(BOOL)isNextEnabled
{

Binary file not shown.

View File

@@ -0,0 +1,34 @@
//
// IQKeyboardManager_Tests.m
// IQKeyboardManager Tests
//
// Created by Indresh on 22/03/15.
// Copyright (c) 2015 Iftekhar. All rights reserved.
//
#import <UIKit/UIKit.h>
#import <XCTest/XCTest.h>
#import "IQKeyboardManager.h"
@interface IQKeyboardManager_Tests : XCTestCase
@end
@implementation IQKeyboardManager_Tests
- (void) setUp {
NSLog(@"%@ setUp", self.name);
}
- (void) tearDown {
NSLog(@"%@ tearDown", self.name);
}
- (void)testInitiateLibrary {
IQKeyboardManager *kbManager = [IQKeyboardManager sharedManager];
XCTAssertNotNil(kbManager, @"Did not initiate IQKeyboardManager");
}
@end

View File

@@ -0,0 +1,24 @@
<?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>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key>
<string>com.iftekhar.IQKeyboardManager-Tests</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>$(PRODUCT_NAME)</string>
<key>CFBundlePackageType</key>
<string>BNDL</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>1</string>
</dict>
</plist>

View File

@@ -89,6 +89,7 @@
C0B63BA41781FAB1008D3B64 /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C0B63BA31781FAB1008D3B64 /* CoreGraphics.framework */; };
C0B63BAC1781FAB1008D3B64 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = C0B63BAB1781FAB1008D3B64 /* main.m */; };
C0B63BB01781FAB1008D3B64 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = C0B63BAF1781FAB1008D3B64 /* AppDelegate.m */; };
C0D7810E1ABF0AB6005FB0AA /* IQKeyboardManager_Tests.m in Sources */ = {isa = PBXBuildFile; fileRef = C0D7810D1ABF0AB6005FB0AA /* IQKeyboardManager_Tests.m */; };
C0DDEB6119FCD56300FAB29F /* IQNSArray+Sort.swift in Sources */ = {isa = PBXBuildFile; fileRef = C0DDEB4E19FCD56300FAB29F /* IQNSArray+Sort.swift */; };
C0DDEB6219FCD56300FAB29F /* IQUIView+Hierarchy.swift in Sources */ = {isa = PBXBuildFile; fileRef = C0DDEB4F19FCD56300FAB29F /* IQUIView+Hierarchy.swift */; };
C0DDEB6319FCD56300FAB29F /* IQUIWindow+Hierarchy.swift in Sources */ = {isa = PBXBuildFile; fileRef = C0DDEB5019FCD56300FAB29F /* IQUIWindow+Hierarchy.swift */; };
@@ -115,6 +116,16 @@
DDAA29F21A320057002C0ED8 /* TableViewInContainerViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = DDAA29F11A320057002C0ED8 /* TableViewInContainerViewController.m */; };
/* End PBXBuildFile section */
/* Begin PBXContainerItemProxy section */
C0D7810F1ABF0AB6005FB0AA /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = C0B63B921781FAB0008D3B64 /* Project object */;
proxyType = 1;
remoteGlobalIDString = C0B63B9A1781FAB1008D3B64;
remoteInfo = IQKeyboardManager;
};
/* End PBXContainerItemProxy section */
/* Begin PBXFileReference section */
53CF2B7D1903D02200E3FDEA /* NavigationBarViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NavigationBarViewController.h; sourceTree = "<group>"; };
53CF2B7E1903D02200E3FDEA /* NavigationBarViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = NavigationBarViewController.m; sourceTree = "<group>"; };
@@ -212,6 +223,9 @@
C0B63BAD1781FAB1008D3B64 /* IQKeyboardManager-Prefix.pch */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "IQKeyboardManager-Prefix.pch"; sourceTree = "<group>"; };
C0B63BAE1781FAB1008D3B64 /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = "<group>"; };
C0B63BAF1781FAB1008D3B64 /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = "<group>"; };
C0D781091ABF0AB6005FB0AA /* IQKeyboardManager Tests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = "IQKeyboardManager Tests.xctest"; sourceTree = BUILT_PRODUCTS_DIR; };
C0D7810C1ABF0AB6005FB0AA /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
C0D7810D1ABF0AB6005FB0AA /* IQKeyboardManager_Tests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = IQKeyboardManager_Tests.m; sourceTree = "<group>"; };
C0DD7EA019D0A0C5007604CF /* AppDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
C0DD7EA119D0A0C5007604CF /* ViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = "<group>"; };
C0DDEB4E19FCD56300FAB29F /* IQNSArray+Sort.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "IQNSArray+Sort.swift"; sourceTree = "<group>"; };
@@ -269,6 +283,13 @@
);
runOnlyForDeploymentPostprocessing = 0;
};
C0D781061ABF0AB6005FB0AA /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXFrameworksBuildPhase section */
/* Begin PBXGroup section */
@@ -462,6 +483,7 @@
C0B63BA51781FAB1008D3B64 /* KeyboardTextFieldDemo */,
C0DE7A3019D49D3400B6A582 /* Resources */,
9D0BB87518BB232B00667349 /* KeyboardManager */,
C0D7810A1ABF0AB6005FB0AA /* IQKeyboardManager Tests */,
C0B63B9E1781FAB1008D3B64 /* Frameworks */,
C0B63B9C1781FAB1008D3B64 /* Products */,
);
@@ -473,6 +495,7 @@
C0B63B9B1781FAB1008D3B64 /* IQKeyboardManager.app */,
9D0BB87318BB232B00667349 /* KeyboardManager.framework */,
C0ACB0F519CF104B0057B571 /* IQKeyboardManager Swift.app */,
C0D781091ABF0AB6005FB0AA /* IQKeyboardManager Tests.xctest */,
);
name = Products;
sourceTree = "<group>";
@@ -546,6 +569,23 @@
name = "Supporting Files";
sourceTree = "<group>";
};
C0D7810A1ABF0AB6005FB0AA /* IQKeyboardManager Tests */ = {
isa = PBXGroup;
children = (
C0D7810D1ABF0AB6005FB0AA /* IQKeyboardManager_Tests.m */,
C0D7810B1ABF0AB6005FB0AA /* Supporting Files */,
);
path = "IQKeyboardManager Tests";
sourceTree = "<group>";
};
C0D7810B1ABF0AB6005FB0AA /* Supporting Files */ = {
isa = PBXGroup;
children = (
C0D7810C1ABF0AB6005FB0AA /* Info.plist */,
);
name = "Supporting Files";
sourceTree = "<group>";
};
C0DD7E9F19D0A0AE007604CF /* KeyboardTextFieldDemoSwift */ = {
isa = PBXGroup;
children = (
@@ -712,6 +752,24 @@
productReference = C0B63B9B1781FAB1008D3B64 /* IQKeyboardManager.app */;
productType = "com.apple.product-type.application";
};
C0D781081ABF0AB6005FB0AA /* IQKeyboardManager Tests */ = {
isa = PBXNativeTarget;
buildConfigurationList = C0D781131ABF0AB6005FB0AA /* Build configuration list for PBXNativeTarget "IQKeyboardManager Tests" */;
buildPhases = (
C0D781051ABF0AB6005FB0AA /* Sources */,
C0D781061ABF0AB6005FB0AA /* Frameworks */,
C0D781071ABF0AB6005FB0AA /* Resources */,
);
buildRules = (
);
dependencies = (
C0D781101ABF0AB6005FB0AA /* PBXTargetDependency */,
);
name = "IQKeyboardManager Tests";
productName = "IQKeyboardManager Tests";
productReference = C0D781091ABF0AB6005FB0AA /* IQKeyboardManager Tests.xctest */;
productType = "com.apple.product-type.bundle.unit-test";
};
/* End PBXNativeTarget section */
/* Begin PBXProject section */
@@ -727,6 +785,10 @@
C0B63B9A1781FAB1008D3B64 = {
DevelopmentTeam = 7UUTF6T5P9;
};
C0D781081ABF0AB6005FB0AA = {
CreatedOnToolsVersion = 6.2;
TestTargetID = C0B63B9A1781FAB1008D3B64;
};
};
};
buildConfigurationList = C0B63B951781FAB0008D3B64 /* Build configuration list for PBXProject "IQKeyboardManager" */;
@@ -746,6 +808,7 @@
C0B63B9A1781FAB1008D3B64 /* IQKeyboardManager */,
9D0BB87218BB232B00667349 /* KeyboardManager */,
C0ACB0F419CF104B0057B571 /* IQKeyboardManager Swift */,
C0D781081ABF0AB6005FB0AA /* IQKeyboardManager Tests */,
);
};
/* End PBXProject section */
@@ -793,6 +856,13 @@
);
runOnlyForDeploymentPostprocessing = 0;
};
C0D781071ABF0AB6005FB0AA /* Resources */ = {
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXResourcesBuildPhase section */
/* Begin PBXShellScriptBuildPhase section */
@@ -897,8 +967,24 @@
);
runOnlyForDeploymentPostprocessing = 0;
};
C0D781051ABF0AB6005FB0AA /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
C0D7810E1ABF0AB6005FB0AA /* IQKeyboardManager_Tests.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXSourcesBuildPhase section */
/* Begin PBXTargetDependency section */
C0D781101ABF0AB6005FB0AA /* PBXTargetDependency */ = {
isa = PBXTargetDependency;
target = C0B63B9A1781FAB1008D3B64 /* IQKeyboardManager */;
targetProxy = C0D7810F1ABF0AB6005FB0AA /* PBXContainerItemProxy */;
};
/* End PBXTargetDependency section */
/* Begin PBXVariantGroup section */
9D0BB87818BB232B00667349 /* InfoPlist.strings */ = {
isa = PBXVariantGroup;
@@ -1154,6 +1240,60 @@
};
name = Release;
};
C0D781111ABF0AB6005FB0AA /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
BUNDLE_LOADER = "$(TEST_HOST)";
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
FRAMEWORK_SEARCH_PATHS = (
"$(SDKROOT)/Developer/Library/Frameworks",
"$(inherited)",
);
GCC_PREPROCESSOR_DEFINITIONS = (
"DEBUG=1",
"$(inherited)",
);
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
INFOPLIST_FILE = "IQKeyboardManager Tests/Info.plist";
IPHONEOS_DEPLOYMENT_TARGET = 8.2;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
MTL_ENABLE_DEBUG_INFO = YES;
PRODUCT_NAME = "$(TARGET_NAME)";
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/IQKeyboardManager.app/IQKeyboardManager";
};
name = Debug;
};
C0D781121ABF0AB6005FB0AA /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
BUNDLE_LOADER = "$(TEST_HOST)";
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
COPY_PHASE_STRIP = NO;
ENABLE_NS_ASSERTIONS = NO;
FRAMEWORK_SEARCH_PATHS = (
"$(SDKROOT)/Developer/Library/Frameworks",
"$(inherited)",
);
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
INFOPLIST_FILE = "IQKeyboardManager Tests/Info.plist";
IPHONEOS_DEPLOYMENT_TARGET = 8.2;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
MTL_ENABLE_DEBUG_INFO = NO;
PRODUCT_NAME = "$(TARGET_NAME)";
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/IQKeyboardManager.app/IQKeyboardManager";
};
name = Release;
};
/* End XCBuildConfiguration section */
/* Begin XCConfigurationList section */
@@ -1193,6 +1333,15 @@
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
C0D781131ABF0AB6005FB0AA /* Build configuration list for PBXNativeTarget "IQKeyboardManager Tests" */ = {
isa = XCConfigurationList;
buildConfigurations = (
C0D781111ABF0AB6005FB0AA /* Debug */,
C0D781121ABF0AB6005FB0AA /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
/* End XCConfigurationList section */
};
rootObject = C0B63B921781FAB0008D3B64 /* Project object */;

View File

@@ -20,6 +20,20 @@
ReferencedContainer = "container:IQKeyboardManager.xcodeproj">
</BuildableReference>
</BuildActionEntry>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "NO"
buildForArchiving = "NO"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "C0D781081ABF0AB6005FB0AA"
BuildableName = "IQKeyboardManager Tests.xctest"
BlueprintName = "IQKeyboardManager Tests"
ReferencedContainer = "container:IQKeyboardManager.xcodeproj">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
</BuildAction>
<TestAction
@@ -28,6 +42,16 @@
shouldUseLaunchSchemeArgsEnv = "YES"
buildConfiguration = "Debug">
<Testables>
<TestableReference
skipped = "NO">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "C0D781081ABF0AB6005FB0AA"
BuildableName = "IQKeyboardManager Tests.xctest"
BlueprintName = "IQKeyboardManager Tests"
ReferencedContainer = "container:IQKeyboardManager.xcodeproj">
</BuildableReference>
</TestableReference>
</Testables>
<MacroExpansion>
<BuildableReference
@@ -48,7 +72,8 @@
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
allowLocationSimulation = "YES">
<BuildableProductRunnable>
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "C0B63B9A1781FAB1008D3B64"
@@ -66,7 +91,8 @@
useCustomWorkingDirectory = "NO"
buildConfiguration = "Release"
debugDocumentVersioning = "YES">
<BuildableProductRunnable>
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "C0B63B9A1781FAB1008D3B64"

View File

@@ -57,6 +57,11 @@
<key>primary</key>
<true/>
</dict>
<key>C0D781081ABF0AB6005FB0AA</key>
<dict>
<key>primary</key>
<true/>
</dict>
</dict>
</dict>
</plist>