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

Commit

Permalink
Merge pull request #46 from inloop/bugfix/textfield_apply_base_style
Browse files Browse the repository at this point in the history
FIX: Apply base style to text field causes crash
  • Loading branch information
radimhalfar authored Feb 28, 2018
2 parents 18bc943 + 7c78c5d commit 5e8aa68
Show file tree
Hide file tree
Showing 7 changed files with 17 additions and 18 deletions.
6 changes: 3 additions & 3 deletions Example/Podfile.lock
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
PODS:
- Styles (0.14.8)
- Styles/Tests (0.14.8)
- Styles (0.15.9)
- Styles/Tests (0.15.9)

DEPENDENCIES:
- Styles (from `../`)
Expand All @@ -11,7 +11,7 @@ EXTERNAL SOURCES:
:path: ../

SPEC CHECKSUMS:
Styles: af5e6b6920360e9a71b84a1776b721f5ef4c257c
Styles: 5922b6d6b0f130580487821bf4f6cdd1918c93c1

PODFILE CHECKSUM: f5341d1bc44d76e5ca1e0d50940004053970d8dc

Expand Down
4 changes: 2 additions & 2 deletions Example/Pods/Local Podspecs/Styles.podspec.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions Example/Pods/Manifest.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Example/Pods/Target Support Files/Styles/Info.plist

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Styles.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

Pod::Spec.new do |s|
s.name = 'Styles'
s.version = '0.14.8'
s.version = '0.15.9'
s.summary = 'UI Elements rapid styling'
s.description = <<-DESC
UIElements styling made easy, declarative and rapid.
Expand Down
10 changes: 5 additions & 5 deletions Styles/Classes/UIElement+Extensions/UITextField+Styles.m
Original file line number Diff line number Diff line change
Expand Up @@ -82,21 +82,21 @@ - (void)swizzle_awakeFromNib {

- (void)setTextStyle:(TextStyle *)style forState:(TextInputState)state {
self.textStyles[@(state)] = style;
[self applyStyle];
[self applyStyleForCurrentState];
}

- (void)setViewStyle:(ViewStyle *)style forState:(TextInputState)state {
self.viewStyles[@(state)] = style;
[self applyStyle];
[self applyStyleForCurrentState];
}

- (void)setPlaceholderStyle:(TextStyle *)style forState:(TextInputState)state {
self.placeholderStyles[@(state)] = style;
[self applyStyle];
[self applyStyleForCurrentState];
}

- (void)applyStyle {
[super applyStyle];
- (void)applyStyleForCurrentState {
[self applyStyle];
TextInputState state = [self isEditing] ? kEditing : kInactive;
[self updateStylesForState:state];
}
Expand Down
5 changes: 2 additions & 3 deletions Styles/Classes/UIElement+Extensions/UITextView+Styles.m
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ - (void)setViewStyle:(ViewStyle *)style forState:(TextInputState)state {
- (void)applyStylesForState:(TextInputState)state {
ViewStyle *viewSyle = self.viewStyles[@(state)];
TextStyle *textStyle = self.textStyles[@(state)];

[self applyTextStyle:textStyle];
[self applyViewStyle:viewSyle];
}
Expand All @@ -94,7 +94,7 @@ - (void)textViewEditingDidChange:(NSNotification *)notification {
return;
}
TextInputState state = notification.name == UITextViewTextDidBeginEditingNotification ? kEditing : kInactive;
[super applyStyle];
[self applyStyle];
[self applyStylesForState:state];
}

Expand All @@ -114,4 +114,3 @@ - (void)applyViewStyle:(ViewStyle *)style {
}

@end

0 comments on commit 5e8aa68

Please sign in to comment.