Skip to content

Commit df54290

Browse files
committed
Minor change to how clear button is accessed and modified
1 parent 5a52d44 commit df54290

File tree

4 files changed

+15
-12
lines changed

4 files changed

+15
-12
lines changed

README.md

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,9 @@ In 2013, [**Matt D. Smith**](http://twitter.com/mds) unveiled the **[Float Label
1111
![Sample Gif of Library in Action](http://d13yacurqjgara.cloudfront.net/users/6410/screenshots/1254439/form-animation-_gif_.gif)
1212

1313
Image credit: [Matt D. Smith](http://twitter.com/mds).
14-
### Changelog (v1.1.1)
15-
- By default, the keyboard no longer disappears when pressing the clear-text button.
16-
- Before v1.1.1, the keyboard would disappear.
17-
- A new variable was introduced to toggle the state of the keyboard after pressing the clear-text button.
14+
### Changelog (v1.1.2)
15+
- Minor change to how clear button is accessed and modified
16+
- Thanks to [Tchelow](http://github.com/Tchelow)'s answer in [Issue #9](https://github.com/ArtSabintsev/UIFloatLabelTextField/issues/9#issuecomment-73449495)
1817

1918
### Features
2019
- Works with all view `init` styles

UIFloatLabelSampleApp/UIFloatLabelSampleApp.xcodeproj/project.pbxproj

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -275,6 +275,7 @@
275275
GCC_PRECOMPILE_PREFIX_HEADER = YES;
276276
GCC_PREFIX_HEADER = "UIFloatLabelSampleApp/UIFloatLabelSampleApp-Prefix.pch";
277277
INFOPLIST_FILE = "UIFloatLabelSampleApp/UIFloatLabelSampleApp-Info.plist";
278+
IPHONEOS_DEPLOYMENT_TARGET = 8.1;
278279
PRODUCT_NAME = "$(TARGET_NAME)";
279280
WRAPPER_EXTENSION = app;
280281
};
@@ -288,6 +289,7 @@
288289
GCC_PRECOMPILE_PREFIX_HEADER = YES;
289290
GCC_PREFIX_HEADER = "UIFloatLabelSampleApp/UIFloatLabelSampleApp-Prefix.pch";
290291
INFOPLIST_FILE = "UIFloatLabelSampleApp/UIFloatLabelSampleApp-Info.plist";
292+
IPHONEOS_DEPLOYMENT_TARGET = 8.1;
291293
PRODUCT_NAME = "$(TARGET_NAME)";
292294
WRAPPER_EXTENSION = app;
293295
};

UIFloatLabelTextField.podspec

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
Pod::Spec.new do |s|
22
s.name = "UIFloatLabelTextField"
3-
s.version = "1.1.1"
3+
s.version = "1.1.2"
44
s.summary = "A subclassed UITextField that implements the Float Label UI design pattern."
55
s.homepage = "https://github.com/ArtSabintsev/UIFloatLabelTextField"
66
s.platform = :ios, '7.0'
7-
s.source = { :git => "https://github.com/ArtSabintsev/UIFloatLabelTextField.git", :tag => "1.1.1" }
7+
s.source = { :git => "https://github.com/ArtSabintsev/UIFloatLabelTextField.git", :tag => "1.1.2" }
88
s.source_files = 'UIFloatLabelTextField/*.{h,m}'
99
s.requires_arc = true
1010
s.social_media_url = 'https://twitter.com/ArtSabintsev'

UIFloatLabelTextField/UIFloatLabelTextField.m

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -108,16 +108,18 @@ - (void)setupClearTextFieldButton
108108
IMP clearButtonImplementation = [self methodForSelector:clearButtonSelector];
109109

110110
// Create function pointer that returns UIButton from implementation of method that contains clearButtonSelector
111-
UIButton * (* clearButtonFunctionPointer)(id, SEL) = (void *)clearButtonImplementation;
111+
UIButton * (* clearButtonFunctionPointer)(id, SEL) = (UIButton *(*)(id, SEL))clearButtonImplementation;
112112

113113
// Set clearTextFieldButton reference to "clearButton" from clearButtonSelector
114114
_clearTextFieldButton = clearButtonFunctionPointer(self, clearButtonSelector);
115115

116-
// Remove all clearTextFieldButton target-actions (e.g., Apple's standard clearButton actions)
117-
[self.clearTextFieldButton removeTarget:nil action:NULL forControlEvents:UIControlEventAllEvents];
118-
119-
// Add new target-action for clearTextFieldButton
120-
[_clearTextFieldButton addTarget:self action:@selector(clearTextField) forControlEvents:UIControlEventTouchUpInside];
116+
if (_clearTextFieldButton) {
117+
// Remove all clearTextFieldButton target-actions (e.g., Apple's standard clearButton actions)
118+
[self.clearTextFieldButton removeTarget:nil action:NULL forControlEvents:UIControlEventAllEvents];
119+
120+
// Add new target-action for clearTextFieldButton
121+
[_clearTextFieldButton addTarget:self action:@selector(clearTextField) forControlEvents:UIControlEventTouchUpInside];
122+
}
121123
}
122124

123125
- (void)setupFloatLabel

0 commit comments

Comments
 (0)