Skip to content

Commit

Permalink
Simplifying appearance proxy, but it doesn't do anything
Browse files Browse the repository at this point in the history
  • Loading branch information
hackiftekhar committed Sep 22, 2017
1 parent 459e269 commit 94658eb
Show file tree
Hide file tree
Showing 3 changed files with 77 additions and 58 deletions.
38 changes: 36 additions & 2 deletions IQKeyboardManager.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,14 @@
objects = {

/* Begin PBXBuildFile section */
4C1D987E1F752A6400F5C2EA /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4C1D987D1F752A6400F5C2EA /* UIKit.framework */; };
4C1D98801F752A6A00F5C2EA /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4C1D987F1F752A6A00F5C2EA /* Foundation.framework */; };
4C1D98821F752A7600F5C2EA /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4C1D98811F752A7600F5C2EA /* CoreGraphics.framework */; };
4C1D98841F752A7E00F5C2EA /* QuartzCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4C1D98831F752A7E00F5C2EA /* QuartzCore.framework */; };
4C1D98851F752AC300F5C2EA /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4C1D987D1F752A6400F5C2EA /* UIKit.framework */; };
4C1D98861F752AC700F5C2EA /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4C1D987F1F752A6A00F5C2EA /* Foundation.framework */; };
4C1D98871F752ACC00F5C2EA /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4C1D98811F752A7600F5C2EA /* CoreGraphics.framework */; };
4C1D98881F752AD200F5C2EA /* QuartzCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4C1D98831F752A7E00F5C2EA /* QuartzCore.framework */; };
4C68CB1E1CB5779300F7286E /* IQPreviousNextView.h in Headers */ = {isa = PBXBuildFile; fileRef = 4C68CB1C1CB5779300F7286E /* IQPreviousNextView.h */; settings = {ATTRIBUTES = (Public, ); }; };
4C68CB1F1CB5779300F7286E /* IQPreviousNextView.m in Sources */ = {isa = PBXBuildFile; fileRef = 4C68CB1D1CB5779300F7286E /* IQPreviousNextView.m */; };
4CD2C4D81C5A63A300975A7A /* IQNSArray+Sort.h in Headers */ = {isa = PBXBuildFile; fileRef = 4CD2C4B51C5A63A300975A7A /* IQNSArray+Sort.h */; };
Expand Down Expand Up @@ -59,6 +67,10 @@
/* End PBXBuildFile section */

/* Begin PBXFileReference section */
4C1D987D1F752A6400F5C2EA /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = System/Library/Frameworks/UIKit.framework; sourceTree = SDKROOT; };
4C1D987F1F752A6A00F5C2EA /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; };
4C1D98811F752A7600F5C2EA /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = System/Library/Frameworks/CoreGraphics.framework; sourceTree = SDKROOT; };
4C1D98831F752A7E00F5C2EA /* QuartzCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = QuartzCore.framework; path = System/Library/Frameworks/QuartzCore.framework; sourceTree = SDKROOT; };
4C68CB1C1CB5779300F7286E /* IQPreviousNextView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IQPreviousNextView.h; sourceTree = "<group>"; };
4C68CB1D1CB5779300F7286E /* IQPreviousNextView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = IQPreviousNextView.m; sourceTree = "<group>"; };
4CD2C4A61C5A615600975A7A /* IQKeyboardManager.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = IQKeyboardManager.framework; sourceTree = BUILT_PRODUCTS_DIR; };
Expand Down Expand Up @@ -119,26 +131,46 @@
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
4C1D98841F752A7E00F5C2EA /* QuartzCore.framework in Frameworks */,
4C1D98821F752A7600F5C2EA /* CoreGraphics.framework in Frameworks */,
4C1D98801F752A6A00F5C2EA /* Foundation.framework in Frameworks */,
4C1D987E1F752A6400F5C2EA /* UIKit.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
4CD597081D1C5EBE00AB28D3 /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
4C1D98881F752AD200F5C2EA /* QuartzCore.framework in Frameworks */,
4C1D98871F752ACC00F5C2EA /* CoreGraphics.framework in Frameworks */,
4C1D98861F752AC700F5C2EA /* Foundation.framework in Frameworks */,
4C1D98851F752AC300F5C2EA /* UIKit.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXFrameworksBuildPhase section */

/* Begin PBXGroup section */
4C1D987C1F752A6400F5C2EA /* Frameworks */ = {
isa = PBXGroup;
children = (
4C1D98831F752A7E00F5C2EA /* QuartzCore.framework */,
4C1D98811F752A7600F5C2EA /* CoreGraphics.framework */,
4C1D987F1F752A6A00F5C2EA /* Foundation.framework */,
4C1D987D1F752A6400F5C2EA /* UIKit.framework */,
);
name = Frameworks;
sourceTree = "<group>";
};
4CD2C49C1C5A615600975A7A = {
isa = PBXGroup;
children = (
4CD2C4B31C5A63A300975A7A /* IQKeyboardManager */,
4CD597141D1C5EDD00AB28D3 /* IQKeyboardManagerSwift */,
4CD2C4F61C5A63DF00975A7A /* Supporting Files */,
4CD2C4A71C5A615600975A7A /* Products */,
4C1D987C1F752A6400F5C2EA /* Frameworks */,
);
sourceTree = "<group>";
};
Expand Down Expand Up @@ -626,6 +658,7 @@
isa = XCBuildConfiguration;
buildSettings = {
CLANG_ANALYZER_NONNULL = YES;
CLANG_MODULES_AUTOLINK = NO;
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "";
DEFINES_MODULE = YES;
DYLIB_COMPATIBILITY_VERSION = 1;
Expand All @@ -639,14 +672,15 @@
PRODUCT_NAME = "$(TARGET_NAME)";
SKIP_INSTALL = YES;
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_VERSION = 3.0;
SWIFT_VERSION = 4.0;
};
name = Debug;
};
4CD597131D1C5EBE00AB28D3 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
CLANG_ANALYZER_NONNULL = YES;
CLANG_MODULES_AUTOLINK = NO;
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "";
DEFINES_MODULE = YES;
DYLIB_COMPATIBILITY_VERSION = 1;
Expand All @@ -659,7 +693,7 @@
PRODUCT_BUNDLE_IDENTIFIER = com.Iftekhar.IQKeyboardManagerSwift;
PRODUCT_NAME = "$(TARGET_NAME)";
SKIP_INSTALL = YES;
SWIFT_VERSION = 3.0;
SWIFT_VERSION = 4.0;
};
name = Release;
};
Expand Down
69 changes: 27 additions & 42 deletions IQKeyboardManager/IQToolbar/IQBarButtonItem.m
Original file line number Diff line number Diff line change
Expand Up @@ -30,52 +30,37 @@ +(void)initialize
{
[super initialize];

//Tint color
[[self appearance] setTintColor:nil];
IQBarButtonItem *appearanceProxy = [self appearance];

//Title
[[self appearance] setTitlePositionAdjustment:UIOffsetZero forBarMetrics:UIBarMetricsDefault];
[[self appearance] setTitleTextAttributes:nil forState:UIControlStateNormal];
[[self appearance] setTitleTextAttributes:nil forState:UIControlStateHighlighted];
[[self appearance] setTitleTextAttributes:nil forState:UIControlStateDisabled];
[[self appearance] setTitleTextAttributes:nil forState:UIControlStateSelected];
[[self appearance] setTitleTextAttributes:nil forState:UIControlStateApplication];
[[self appearance] setTitleTextAttributes:nil forState:UIControlStateReserved];
// if ([self respondsToSelector:@selector(appearanceWhenContainedInInstancesOfClasses:)])
// {
// appearanceProxy = [self appearanceWhenContainedInInstancesOfClasses:@[[IQToolbar class]]];
// }
// else
// {
// appearanceProxy = [self appearanceWhenContainedIn:[IQToolbar class], nil];
// }

//Background Image
[[self appearance] setBackgroundImage:nil forState:UIControlStateNormal barMetrics:UIBarMetricsDefault];
[[self appearance] setBackgroundImage:nil forState:UIControlStateHighlighted barMetrics:UIBarMetricsDefault];
[[self appearance] setBackgroundImage:nil forState:UIControlStateDisabled barMetrics:UIBarMetricsDefault];
[[self appearance] setBackgroundImage:nil forState:UIControlStateSelected barMetrics:UIBarMetricsDefault];
[[self appearance] setBackgroundImage:nil forState:UIControlStateApplication barMetrics:UIBarMetricsDefault];
[[self appearance] setBackgroundImage:nil forState:UIControlStateReserved barMetrics:UIBarMetricsDefault];

[[self appearance] setBackgroundImage:nil forState:UIControlStateNormal style:UIBarButtonItemStyleDone barMetrics:UIBarMetricsDefault];
[[self appearance] setBackgroundImage:nil forState:UIControlStateHighlighted style:UIBarButtonItemStyleDone barMetrics:UIBarMetricsDefault];
[[self appearance] setBackgroundImage:nil forState:UIControlStateDisabled style:UIBarButtonItemStyleDone barMetrics:UIBarMetricsDefault];
[[self appearance] setBackgroundImage:nil forState:UIControlStateSelected style:UIBarButtonItemStyleDone barMetrics:UIBarMetricsDefault];
[[self appearance] setBackgroundImage:nil forState:UIControlStateApplication style:UIBarButtonItemStyleDone barMetrics:UIBarMetricsDefault];
[[self appearance] setBackgroundImage:nil forState:UIControlStateReserved style:UIBarButtonItemStyleDone barMetrics:UIBarMetricsDefault];
NSArray <NSNumber*> *states = @[@(UIControlStateNormal),@(UIControlStateHighlighted),@(UIControlStateDisabled),@(UIControlStateSelected),@(UIControlStateApplication),@(UIControlStateReserved)];

[[self appearance] setBackgroundImage:nil forState:UIControlStateNormal style:UIBarButtonItemStylePlain barMetrics:UIBarMetricsDefault];
[[self appearance] setBackgroundImage:nil forState:UIControlStateHighlighted style:UIBarButtonItemStylePlain barMetrics:UIBarMetricsDefault];
[[self appearance] setBackgroundImage:nil forState:UIControlStateDisabled style:UIBarButtonItemStylePlain barMetrics:UIBarMetricsDefault];
[[self appearance] setBackgroundImage:nil forState:UIControlStateSelected style:UIBarButtonItemStylePlain barMetrics:UIBarMetricsDefault];
[[self appearance] setBackgroundImage:nil forState:UIControlStateApplication style:UIBarButtonItemStylePlain barMetrics:UIBarMetricsDefault];
[[self appearance] setBackgroundImage:nil forState:UIControlStateReserved style:UIBarButtonItemStylePlain barMetrics:UIBarMetricsDefault];
//Tint color
[appearanceProxy setTintColor:nil];

[[self appearance] setBackgroundVerticalPositionAdjustment:0 forBarMetrics:UIBarMetricsDefault];

//Back Button
[[self appearance] setBackButtonBackgroundImage:nil forState:UIControlStateNormal barMetrics:UIBarMetricsDefault];
[[self appearance] setBackButtonBackgroundImage:nil forState:UIControlStateHighlighted barMetrics:UIBarMetricsDefault];
[[self appearance] setBackButtonBackgroundImage:nil forState:UIControlStateDisabled barMetrics:UIBarMetricsDefault];
[[self appearance] setBackButtonBackgroundImage:nil forState:UIControlStateSelected barMetrics:UIBarMetricsDefault];
[[self appearance] setBackButtonBackgroundImage:nil forState:UIControlStateApplication barMetrics:UIBarMetricsDefault];
[[self appearance] setBackButtonBackgroundImage:nil forState:UIControlStateReserved barMetrics:UIBarMetricsDefault];

[[self appearance] setBackButtonTitlePositionAdjustment:UIOffsetZero forBarMetrics:UIBarMetricsDefault];
[[self appearance] setBackButtonBackgroundVerticalPositionAdjustment:0 forBarMetrics:UIBarMetricsDefault];
for (NSNumber *state in states)
{
UIControlState controlState = [state unsignedIntegerValue];

[appearanceProxy setTitleTextAttributes:@{ NSFontAttributeName: [UIFont systemFontOfSize:15.0], NSForegroundColorAttributeName: [UIColor redColor] } forState:controlState];
[appearanceProxy setBackgroundImage:nil forState:controlState barMetrics:UIBarMetricsDefault];
[appearanceProxy setBackgroundImage:nil forState:controlState style:UIBarButtonItemStyleDone barMetrics:UIBarMetricsDefault];
[appearanceProxy setBackgroundImage:nil forState:controlState style:UIBarButtonItemStylePlain barMetrics:UIBarMetricsDefault];
[appearanceProxy setBackButtonBackgroundImage:nil forState:controlState barMetrics:UIBarMetricsDefault];
}

[appearanceProxy setTitlePositionAdjustment:UIOffsetZero forBarMetrics:UIBarMetricsDefault];
[appearanceProxy setBackgroundVerticalPositionAdjustment:0 forBarMetrics:UIBarMetricsDefault];
[appearanceProxy setBackButtonTitlePositionAdjustment:UIOffsetZero forBarMetrics:UIBarMetricsDefault];
[appearanceProxy setBackButtonBackgroundVerticalPositionAdjustment:0 forBarMetrics:UIBarMetricsDefault];
}

- (instancetype)initWithBarButtonSystemItem:(UIBarButtonSystemItem)systemItem target:(nullable id)target action:(nullable SEL)action
Expand Down
28 changes: 14 additions & 14 deletions IQKeyboardManager/IQToolbar/IQToolbar.m
Original file line number Diff line number Diff line change
Expand Up @@ -38,25 +38,25 @@ +(void)initialize
{
[super initialize];

IQToolbar *appearanceProxy = [self appearance];

//Tint Color
[[self appearance] setTintColor:nil];
[appearanceProxy setTintColor:nil];

[[self appearance] setBarTintColor:nil];

//Background image
[[self appearance] setBackgroundImage:nil forToolbarPosition:UIBarPositionAny barMetrics:UIBarMetricsDefault];
[[self appearance] setBackgroundImage:nil forToolbarPosition:UIBarPositionBottom barMetrics:UIBarMetricsDefault];
[[self appearance] setBackgroundImage:nil forToolbarPosition:UIBarPositionTop barMetrics:UIBarMetricsDefault];
[[self appearance] setBackgroundImage:nil forToolbarPosition:UIBarPositionTopAttached barMetrics:UIBarMetricsDefault];
[appearanceProxy setBarTintColor:nil];

//Shadow image
[[self appearance] setShadowImage:nil forToolbarPosition:UIBarPositionAny];
[[self appearance] setShadowImage:nil forToolbarPosition:UIBarPositionBottom];
[[self appearance] setShadowImage:nil forToolbarPosition:UIBarPositionTop];
[[self appearance] setShadowImage:nil forToolbarPosition:UIBarPositionTopAttached];
NSArray <NSNumber*> *positions = @[@(UIBarPositionAny),@(UIBarPositionBottom),@(UIBarPositionTop),@(UIBarPositionTopAttached)];

for (NSNumber *position in positions)
{
UIToolbarPosition toolbarPosition = [position unsignedIntegerValue];

[appearanceProxy setBackgroundImage:nil forToolbarPosition:toolbarPosition barMetrics:UIBarMetricsDefault];
[appearanceProxy setShadowImage:nil forToolbarPosition:toolbarPosition];
}

//Background color
[[self appearance] setBackgroundColor:nil];
[appearanceProxy setBackgroundColor:nil];
}

-(void)initialize
Expand Down

0 comments on commit 94658eb

Please sign in to comment.