mehfuzh / mhtextfield Goto Github PK
View Code? Open in Web Editor NEWUITextField extension with built-in toolbar, validation and scrolling support.
License: MIT License
UITextField extension with built-in toolbar, validation and scrolling support.
License: MIT License
in iOS 7 , when I input 3 charactors with the simulator keyboard , it crashed...
I try to delete the code : self.delegate = self... it will not crash, but the function not work...
Is it a bug?
Create a cocoapod and get this up.
$ pod spec create MHTextField
$ edit MHTextField.podspec
$ pod spec lint MHTextField.podspec
Hi, I have a UITableview to use this "magic" TextField and I put it in my UITableViewCell , but it seems doesn't work.
This lib is one feature away from being the best damn thing since sliced bread. It just needs support for a reg picker with custom picker options. If this was a android lib id be all over the contribution , but this is my first week learning ios :/
In your demo project, set scrollview.origin.y = 120
, and the emailTextField will be hidden by the keyboard. (I use the 3.5-inch simulator.)
Solution:
In the method - (void)scrollToField
,
change
CGRect textFieldRect = _textField.frame;
to
CGRect textFieldRect = [[_textField superview] convertRect:_textField.frame toView:self.window];
Hey Dev,
On iOS 8 this module has some issues with the layout constraints on Auto-layout since the introduction of Quick Type.
Please look into this and thanks in advance.
Cheers,
Amila Fonseka
Select date and click on done.If i want to change selected date then press on date field and get crashed.
Error:-
*** Assertion failure in -[_UIDatePickerView _setDate:animated:forced:], /SourceCache/UIKit/UIKit-2380.17/_UIDatePickerView.m:302
in some case, the keyBoardWillHide function is not immediately called after resignFirstResponder, the setDoneCommand is reset to No, so that content will not scroll to top
Hi,
I'm using the following code. Unfortunately, the text is not displayed in the placeholder
where am I wrong?
[_userNew setPlaceholder:@"pippooooooo"];
[_userNew setBackgroundColor:[UIColor blueColor]];
[_userNew setValue:[UIColor blackColor]forKeyPath:@"_placeholderLabel.textColor"];
Sorry I'm new in IOS dev, I got someoneelse's code and he use this textfield in his app, and for some reason when the app is executed on the devices the placeholder is not displayed and I think its correctly set.
Thks!
Hi, guy,
Thank you for your MHTextField. It is wonderful!
We need to capture the event when the done Button is clicked. So would you please to add a callback ( block or delegate is ok) .
bitflying
Hi,
If I am using MHTextField programatically Like...
For Ex.
DemoTextField* dm =[[DemoTextField alloc] init];
[dm setPlaceholder:@"Krishan"];
[dm setFrame: CGRectMake(20, 645, 300, 40)];
[self.scrlHTText addSubview:dm];
Then toolbar next previous Button not enabled for use as per normal mode using xib/storyboard MHTextField.
Please update this issue so i can use MHTextField.
Thanks ,
Date type text field should be optional setting for pre enter date in case or requienment.
Currently the keyboard closes only if you press "Done" button. However, there could be cases where it needs to be closed programmatically.
datePickerValueChanged bug:
//Doesn't check for self.dataFormat
//NOW:
(void)datePickerValueChanged:(id)sender{
UIDatePicker datePicker = (UIDatePicker)sender;
NSDate *selectedDate = datePicker.date;
NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
[
dateFormatter setDateFormat:@"MM/dd/YY"];
[_textField setText:[dateFormatter stringFromDate:selectedDate]];
[self validate];
}
WITH FIXED BUG:
(void)datePickerValueChanged:(id)sender{
UIDatePicker datePicker = (UIDatePicker)sender;
NSDate *selectedDate = datePicker.date;
NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
if (self.dateFormat) {
[dateFormatter setDateFormat:self.dateFormat];
} else {
[dateFormatter setDateFormat:@"MM/dd/YY"];
}
[_textField setText:[dateFormatter stringFromDate:selectedDate]];
[self validate];
}
In my project textfields backgroundColor is transparent,
tintColor is a custom color.
Disabled state is a custom color...
You can put blocks events and / or delegate methods developers can write logic for their cases. Maybe someone doesn't need to be white/red background or display a message in case a field has invalid value ...
Please review methods:
//********************************************************************
(void)setup {
if ([self respondsToSelector:@selector(setTintColor:)])
[self setTintColor:[UIColor blackColor]];
...
}
//********************************************************************
(BOOL) validate{
self.backgroundColor = [UIColor colorWithRed:255 green:0 blue:0 alpha:0.5];
...
[self setBackgroundColor:[UIColor whiteColor]];
...
}
//********************************************************************
(void)setNeedsBackground
{
if (!_enabled)
[self setBackgroundColor:[UIColor lightGrayColor]];
}
Great framework.
Is there any plan to support other field element like Choice List ?
I'm sorry my English isn't very good
The fields go up off the screen
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.