uitextfield

animating text box when clicked

雨燕双飞 提交于 2019-12-06 16:25:43
I am trying to move a text box from the bottom of the screen in an iPad app so that the keyboard does not cover it. I have the following which works. -(void) textViewDidBeginEditing:(UITextView *) observationComment { observationComment.frame=CGRectMake(190, 100, 700, 250); } But 1 - I would like to animate the movement - is this possible? 2 - I get a warning Local declaration of 'observationComment' hides instance variable Any advice? Maybe this is not the best way to do it. John Sauer I previously found the answer here , but I had to add code so that the View Controller's view.frame adjusts

How do Prevent a copy/paste/select popover on a UITextView using UIMenuController iOS5.1

╄→尐↘猪︶ㄣ 提交于 2019-12-06 16:09:11
问题 The question : How do I prevent the copy/paste/select popup that occurs over a UITextView from appearing (not using UIwebView and css)? I did not want to go the rout of UIWebView as some posts have gone because I already am using UIViews with UITextFields for data entry. I had tried unsuccessfully to implement the solutions dealing with UITextField in my implementation file of my view controller with the methods: targetForAction:withSender , setMenuVisible:animated and finally

Keyboard blocking UITableViewCell's UITextField?

霸气de小男生 提交于 2019-12-06 16:02:12
问题 Currently I have a UITextField in each UITableViewCell but the issue is, if there are 2 cells or more the cell could be cut off. Is there any easy way to make it so that the cell is visible while my keyboard is open? Thanks! 回答1: If i'm understanding your question correctly, you want the view to scroll when the keyboard shows up. If you make your viewController a subclass of UITableViewController, I believe you get scrolling for free. The only other option is unfortunately not that simple.

Get text from UITextField on a TableViewCell

只谈情不闲聊 提交于 2019-12-06 16:01:37
I have a UITableViewController with prototype cells containing UITextFields. To configure these custome cells, I've created a UITableViewCell subclass. I've conected the textField to the cell subclass via an outlet (nonatomic, weak) . On this subclass I've created a protocol for which the UITableViewController is its delegate so that everytime something changes in these textFields, the TableViewController knows about it. Basically I wanted this to save the values on the NSUserDefaults Besides, in order to dynamically obtain values from these textFields, I can do something like this: (

UITextField get focus and then lose focus immediately due to return YES in textFieldShouldReturn

泪湿孤枕 提交于 2019-12-06 15:43:53
Here are my codes: - (void)viewDidLoad { [super viewDidLoad]; // passwordTextField cannot get focus after click next key due to this RAC RAC(self.loginButton, enabled) = [RACSignal combineLatest:@[self.userTextField.rac_textSignal, self.passwordTextField.rac_textSignal] reduce:^id (NSString *user, NSString *password) { if ([user length] > 0 && [password length] > 0) { return @YES; } return @NO; }]; } - (BOOL)textFieldShouldReturn:(UITextField *)textField { if (textField == self.userTextField) { [self.passwordTextField becomeFirstResponder]; } else { [self loginAction:textField]; } //

Moving content located under the keyboard

删除回忆录丶 提交于 2019-12-06 15:31:07
I have a question regarding the code found in the Apple documentation Moving content located under the keyboard . I have researched this, but I'm looking for clarification on the concepts I am fuzzy on here before I start getting fancy with alternate solutions. Unfortunately, as soon as the keyboard animation finishes moving the keyboard up, the view moves down and completely out of site. This happens whether the text field is actually the one that gets covered by the keyboard or not. So now I'm back to trying to understand the code provided in the documentation and after attempts changing a

Detecting whether the user has typed in a UITextField

泄露秘密 提交于 2019-12-06 15:21:52
I know that if you use the following line of code, you can detect what the user has typed in a TEXT VIEW. if ([[textView text] isEqualToString:@"") I want to detect whether the user has typed anything in a text FIELD, and this does not work with text fields. What should I change? Thanks for your help! The UITextFieldDelegate is the preferred way to find this out. - (void)textFieldDidBeginEditing:(UITextField *)textField - this will only tell you that it has become the first responder / key field, this does not guarantee that the user modified the value - (BOOL)textField:(UITextField *

KVO crash on UITextField initWithFrame

风流意气都作罢 提交于 2019-12-06 15:05:01
A customer of my app sent me this strange crash report and I cannot figure out how this could ever crash. I cannot reproduce the problem myself, so am reliant on the crash report. It crashes on the following very simple line of code: UITextField *value = [[UITextField alloc] initWithFrame:frame]; The crash seems to be related to key-value-observing (KVO), but I am not doing anything with that here; it's a simply constructor! The only possibility I could see, is that another thread is writing to a dealloc'ed object that happens to have the same memory address as an object that is created by the

Blur effect - Background UITextField

风格不统一 提交于 2019-12-06 15:04:09
问题 I use Swift 2 and Xcode 7. I would like to blur in the background of my UITextField. I have not found a property backgroundView . Only background (for background image) or backgroundColor . I would have come to add a view in background. But I do not know how to make a UITextField. Do you have a solution ? 回答1: You can only add some kind of view to make it a blur view. Now the problem is that textfields don't have a backgroundView property but they do have a background property where we can

how to avoid dots next to a uitextfield

↘锁芯ラ 提交于 2019-12-06 14:18:40
Is that possible to remove the dots which are displayed next to uitextfield when text is larger than the width of the uitextfield. There is a property lineBreakMode which defines the behaviour when the text to be displayed is larger than the box of the control //UILineBreakMode //Options for wrapping and truncating text. typedef enum { UILineBreakModeWordWrap = 0, UILineBreakModeCharacterWrap, UILineBreakModeClip, UILineBreakModeHeadTruncation, UILineBreakModeTailTruncation, UILineBreakModeMiddleTruncation, } UILineBreakMode; If you do not want any dots you can use UILineBreakModeClip which