Skip to content
This repository has been archived by the owner on Jul 2, 2020. It is now read-only.

Commit

Permalink
Merge pull request #61 from xiangyaguo/master
Browse files Browse the repository at this point in the history
Fixed search bar setKeyboardAppearance: unrecognized selector on iOS7.0,
close #60
  • Loading branch information
Draveness authored Sep 1, 2016
2 parents 5696e6a + 26fe9fb commit 4615ca9
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions DKNightVersion/Manual/UISearchBar+Keyboard.m
Original file line number Diff line number Diff line change
Expand Up @@ -50,27 +50,41 @@ + (void)load {
- (instancetype)dk_init {
UISearchBar *obj = [self dk_init];
if (self.dk_manager.supportsKeyboard && [self.dk_manager.themeVersion isEqualToString:DKThemeVersionNight]) {

#ifdef __IPHONE_7_0
obj.keyboardAppearance = UIKeyboardAppearanceDark;
UITextField *searchField = [obj valueForKey:@"_searchField"];
searchField.keyboardAppearance = UIKeyboardAppearanceDark;
#else
obj.keyboardAppearance = UIKeyboardAppearanceAlert;
#endif
} else {
#ifdef __IPHONE_7_0
UITextField *searchField = [obj valueForKey:@"_searchField"];
searchField.keyboardAppearance = UIKeyboardAppearanceDefault;
#else
obj.keyboardAppearance = UIKeyboardAppearanceDefault;
#endif
}

return obj;
}

- (void)night_updateColor {
[super night_updateColor];
if (self.dk_manager.supportsKeyboard && [self.dk_manager.themeVersion isEqualToString:DKThemeVersionNight]) {
#ifdef __IPHONE_7_0
self.keyboardAppearance = UIKeyboardAppearanceDark;
UITextField *searchField = [self valueForKey:@"_searchField"];
searchField.keyboardAppearance = UIKeyboardAppearanceDark;
#else
self.keyboardAppearance = UIKeyboardAppearanceAlert;
#endif
} else {
#ifdef __IPHONE_7_0
UITextField *searchField = [self valueForKey:@"_searchField"];
searchField.keyboardAppearance = UIKeyboardAppearanceDefault;
#else
self.keyboardAppearance = UIKeyboardAppearanceDefault;
#endif
}
}

Expand Down

0 comments on commit 4615ca9

Please sign in to comment.