Skip to content

Commit

Permalink
Added methods to register ViewController for disabling library #117, #…
Browse files Browse the repository at this point in the history
…139 and enabling toolbar previous/next for CustomView #154, #179.

Former-commit-id: bda4c62
  • Loading branch information
hackiftekhar committed Mar 21, 2015
1 parent c8c7008 commit 634cc34
Show file tree
Hide file tree
Showing 32 changed files with 241 additions and 219 deletions.
6 changes: 3 additions & 3 deletions IQKeyBoardManager/Categories/IQNSArray+Sort.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,21 +23,21 @@

#import <Foundation/NSArray.h>

/*!
/**
@category NSArray (IQ_NSArray_Sort)
@abstract UIView.subviews sorting category.
*/
@interface NSArray (IQ_NSArray_Sort)

/*!
/**
@method sortedArrayByTag
@return Returns the array by sorting the UIView's by their tag property.
*/
- (NSArray*)sortedArrayByTag;

/*!
/**
@method sortedArrayByTag
@return Returns the array by sorting the UIView's by their tag property.
Expand Down
50 changes: 18 additions & 32 deletions IQKeyBoardManager/Categories/IQUIView+Hierarchy.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,105 +26,91 @@

@class UICollectionView, UIScrollView, UITableView, NSArray;

/*!
/**
@category UIView (IQ_UIView_Hierarchy)
@abstract UIView hierarchy category.
*/
@interface UIView (IQ_UIView_Hierarchy)

/*!
/**
@property isAskingCanBecomeFirstResponder
@abstract Returns YES if IQKeyboardManager asking for `canBecomeFirstResponder. Useful when doing custom work in `textFieldShouldBeginEditing:` delegate.
*/
@property (nonatomic, readonly) BOOL isAskingCanBecomeFirstResponder;

/*!
/**
@property viewController
@abstract Returns the UIViewController object that manages the receiver.
*/
@property (nonatomic, readonly, strong) UIViewController *viewController;

/*!
/**
@property topMostController
@abstract Returns the topMost UIViewController object in hierarchy.
*/
@property (nonatomic, readonly, strong) UIViewController *topMostController;

/*!
@property superScrollView
/**
@method superviewOfClassType:
@abstract Returns the UIScrollView object if any found in view's upper hierarchy.
@return Returns the superView of provided class type.
*/
@property (nonatomic, readonly, strong) UIScrollView *superScrollView;
-(UIView*)superviewOfClassType:(Class)classType;

/*!
@property superTableView
@abstract Returns the UITableView object if any found in view's upper hierarchy.
*/
@property (nonatomic, readonly, strong) UITableView *superTableView;

/*!
@property superCollectionView
@abstract Returns the UICollectionView object if any found in view's upper hierarchy.
*/
@property (nonatomic, readonly, strong) UICollectionView *superCollectionView NS_AVAILABLE_IOS(6_0);

/*!
/**
@property responderSiblings
@abstract returns all siblings of the receiver which canBecomeFirstResponder.
*/
@property (nonatomic, readonly, copy) NSArray *responderSiblings;

/*!
/**
@property deepResponderViews
@abstract returns all deep subViews of the receiver which canBecomeFirstResponder.
*/
@property (nonatomic, readonly, copy) NSArray *deepResponderViews;

/*!
/**
@property isSearchBarTextField
@abstract returns YES if the receiver object is UISearchBarTextField, otherwise return NO.
*/
@property (nonatomic, getter=isSearchBarTextField, readonly) BOOL searchBarTextField;

/*!
/**
@property isAlertViewTextField
@abstract returns YES if the receiver object is UIAlertSheetTextField, otherwise return NO.
*/
@property (nonatomic, getter=isAlertViewTextField, readonly) BOOL alertViewTextField;

/*!
/**
@method convertTransformToView
@return returns current view transform with respect to the 'toView'.
*/
-(CGAffineTransform)convertTransformToView:(UIView*)toView;

/*!
/**
@property subHierarchy
@abstract Returns a string that represent the information about it's subview's hierarchy. You can use this method to debug the subview's positions.
*/
@property (nonatomic, readonly, copy) NSString *subHierarchy;

/*!
/**
@property superHierarchy
@abstract Returns an string that represent the information about it's upper hierarchy. You can use this method to debug the superview's positions.
*/
@property (nonatomic, readonly, copy) NSString *superHierarchy;

/*!
/**
@property debugHierarchy
@abstract Returns an string that represent the information about it's frame positions. You can use this method to debug self positions.
Expand All @@ -134,7 +120,7 @@
@end


/*!
/**
@category UIView (IQ_UIView_Frame)
@abstract UIView frame category.
Expand All @@ -154,7 +140,7 @@

@interface NSObject (IQ_Logging)

/*!
/**
@property _IQDescription
@abstract Short description for logging purpose.
Expand Down
41 changes: 6 additions & 35 deletions IQKeyBoardManager/Categories/IQUIView+Hierarchy.m
Original file line number Diff line number Diff line change
Expand Up @@ -119,47 +119,18 @@ -(UIViewController *)topMostController
return (UIViewController*)matchController;
}

- (UITableView*)superTableView
-(UIView*)superviewOfClassType:(Class)classType
{
UIView *superview = self.superview;

while (superview)
{
if ([superview isKindOfClass:[UITableView class]])
if ([superview isKindOfClass:classType] &&
([superview isKindOfClass:UITableViewCellScrollViewClass] == NO) &&
([superview isKindOfClass:UITableViewWrapperViewClass] == NO) &&
([superview isKindOfClass:UIQueuingScrollViewClass] == NO))
{
return (UITableView*)superview;
}
else superview = superview.superview;
}

return nil;
}

-(UICollectionView *)superCollectionView
{
UIView *superview = self.superview;

while (superview)
{
if ([superview isKindOfClass:[UICollectionView class]])
{
return (UICollectionView*)superview;
}
else superview = superview.superview;
}

return nil;
}

- (UIScrollView*)superScrollView
{
UIView *superview = self.superview;

while (superview)
{
if ([superview isKindOfClass:[UIScrollView class]] && ([superview isKindOfClass:UITableViewCellScrollViewClass] == NO) && ([superview isKindOfClass:UITableViewWrapperViewClass] == NO) && ([superview isKindOfClass:UIQueuingScrollViewClass] == NO))
{
return (UIScrollView*)superview;
return superview;
}
else superview = superview.superview;
}
Expand Down
6 changes: 3 additions & 3 deletions IQKeyBoardManager/Categories/IQUIWindow+Hierarchy.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,21 +25,21 @@

@class UIViewController;

/*!
/**
@category UIWindow (IQ_UIWindow_Hierarchy)
@abstract UIWindow hierarchy category.
*/
@interface UIWindow (IQ_UIWindow_Hierarchy)

/*!
/**
@method topMostController
@return Returns the current Top Most ViewController in hierarchy.
*/
@property (nonatomic, readonly, strong) UIViewController *topMostController;

/*!
/**
@method currentViewController
@return Returns the topViewController in stack of topMostController.
Expand Down
14 changes: 11 additions & 3 deletions IQKeyBoardManager/Constants/IQKeyboardManagerConstants.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@

/* Set IQKEYBOARDMANAGER_DEBUG=1 in preprocessor macros under build settings to enable debugging.*/

/*!
/**
@enum IQAutoToolbarManageBehaviour
@abstract AutoToolbar manage settings.
Expand All @@ -41,15 +41,23 @@
*/

#ifndef NS_ENUM
#define NS_ENUM(_type, _name) enum _name : _type _name; enum _name : _type
#endif

typedef enum IQAutoToolbarManageBehaviour {
IQAutoToolbarBySubviews,
IQAutoToolbarByTag,
IQAutoToolbarByPosition,
}IQAutoToolbarManageBehaviour;

#else

typedef NS_ENUM(NSInteger, IQAutoToolbarManageBehaviour) {
IQAutoToolbarBySubviews,
IQAutoToolbarByTag,
IQAutoToolbarByPosition,
};

#endif

#define IQLocalizedString(key, comment) [[NSBundle bundleWithPath:[[NSBundle mainBundle] pathForResource:@"IQKeyboardManager" ofType:@"bundle"]] localizedStringForKey:(key) value:@"" table:@"IQKeyboardManager"]

#endif
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
#endif


/*! https://github.com/kif-framework/KIF/blob/master/Additions/LoadableCategory.h
/** https://github.com/kif-framework/KIF/blob/master/Additions/LoadableCategory.h
@discussion To load categories in the current file loadable without using "-load-all" flag. When we try to create framework or library the compilers skips linking files that contain only categories. So use this macro to add a dummy class, which causes the linker to add the file. You will also need to add "-ObjC" to the "Other Linker Flags" build setting in any project that uses the framework.
Expand Down
Loading

0 comments on commit 634cc34

Please sign in to comment.