Search Results

Search found 295 results on 12 pages for 'uitextfield'.

Page 1/12 | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >

  • iphone UITextField remembering user's previous input???

    - by Rob
    Is there a way to remember what the user put into a UITextField and have it displayed the next time they come to that UITextField? i.e. - have them input their name the first time they come to the "Name" UITextField but have that name already displayed in that field the next time they come across that UITextField? I want the name to still be editable if they come back to the UITextField, but inputted nonetheless in case they don't need to change it the second time around.

    Read the article

  • vertical scrolling of text in UItextfield

    - by mindfreak
    I am filling Uitextfield with Uibutton click event.(e.g. clicking on BUTTONA will add 'a' to textfield.). my problem is that when inserted text reaches the end of textfield, further characters inserted into textfield via UIbutton are not visible.instead ... is seen . how to let text inside Uitextfield scroll to left when width of UItextfield is reached(just like when we enter characters in UItextfield via keyboard) ? Please let me know.

    Read the article

  • UITextfield is becoming focused after UIButton pressed

    - by Chris
    I have a UITextfield for entering text. A button triggers a functionality. After completion of the IBAction the UITextfield is getting focused again. After the IBAction I want to keyboard to disappear. What happends now is that due to the IBAction of the button, the keyboards disappears (I'm showing a UIAlert) and after the IBAction the keyboards pop's up again together with the focus in the UITextfield. Is it possible to prevent the UITextfield to be focused after the IBAction?

    Read the article

  • how to enter text into uitextfield

    - by adnan
    I have implemented the delegates for UITextField and also method for these text field. Below are the methods: - (void)textFieldDidBeginEditing:(UITextField *)textField { [textField resignFirstResponder]; } - (BOOL)textFieldShouldReturn:(UITextField *)aTextField { [aTextField resignFirstResponder]; return YES; } My problem is that when I want to enter text into UITextField its delegate does not allow me to enter the text into textfields. Kindly tell me how i can enter the data into textfields

    Read the article

  • Clear UITextField when standard number pad is pressed

    - by Manu
    Hi all, I'm sorry if I didn't explain my problem well enough in the title. In my application, I'm using a small subview to create a very basic calculator on the top side of the screen (I just have an UITextField to show the operations and two buttons). Instead of using a custom keyboard for it, I want to use the standard iPhone number pad. My problem is that after doing an operation (e.g. adding two numbers) and showing the result, I cannot figure out how to clear the screen when the user enters a new number. So, for example: User enters "6" - Number 6 is shown in UITextField User selects "+" - UITextField is cleared to make room for the next number User enters "10" - Number 10 is shown in UITextField User selects "+" - 16 is shown as the result of the previous operation, and should stay there until another number is pressed (he wants to continue adding more numbers) User enters "5" At this point, if I was using a custom keyboard, I could clear the UITextField as soon as the button "5" is pressed by the user, but I cannot figure out how to do so when using the standard number pad. So, the result I get at the moment is "165". Is there a way to detect when a key is pressed in the standard number pad so that I can clear the UITextField before the new number appears? I thought there may be a NSNotification for that, but I couldn't find it. I'm aware that I could solve my problem if I created a custom keyboard or if I used two separated UITextFields (one for the operations and another one for the total), but I would like to use the standard number pad if it's possible. Thanks very much!

    Read the article

  • Clipped UITextField with UITextFieldAlignmentRight

    - by Typeoneerror
    Got a small problem with UITextField. I have a simple UITextField and when I set the textAlignment property to "right", it gets clipped by 1-2 pixels. It looks shite so I'm hoping someone has an idea of how to remedy this. I've tried setting the frame to integers to prevent them from being on .5 pixels. - (UITextField *)textControlForSetting:(NSDictionary *)settings { CGRect frame = CGRectIntegral(CGRectMake(100.0f, 0.0f, 170.0f, 44.0f)); UITextField *textField = [[[UITextField alloc] initWithFrame:frame] autorelease]; NSString *defaultValue = [settings objectForKey:kDefaultValueKey]; NSString *currentValue = [prefs objectForKey:[settings objectForKey:kSettingKey]]; textField.tag = settingsCounter; textField.delegate = self; textField.textAlignment = UITextAlignmentRight; textField.font = [UIFont fontWithName:@"HelveticaNeue" size:14.0f]; textField.contentVerticalAlignment = UIControlContentVerticalAlignmentCenter; textField.placeholder = (currentValue != nil) ? currentValue : defaultValue; settingsCounter++; return textField; }

    Read the article

  • Code to show UIPickerview under clicked UITextField

    - by Chris F
    I thought I'd share a code snippet where I show a UIPickerView when you click a UITextField. The code uses a UIPickerView, but there's no reason to use a different view controller, like a UITableViewController that uses a table instead of a picker. Just create a single-view project with a nib, and add a UITextField to the view and make you connections in IB. // .h file #import @interface MyPickerViewViewController : UIViewController <UIPickerViewDelegate, UIPickerViewDataSource, UITextFieldDelegate> - (IBAction)dismissPickerView:(id)sender; @end // .m file #import "MyPickerViewViewController.h" @interface MyPickerViewViewController () { UIPickerView *_pv; NSArray *_array; IBOutlet __weak UITextField *_tf; BOOL _pickerViewShown; } @end @implementation MyPickerViewViewController - (void)viewDidLoad { [super viewDidLoad]; _pickerViewShown = NO; _array = [NSArray arrayWithObjects:@"One", @"Two", @"Three", @"Four", nil]; _pv = [[UIPickerView alloc] initWithFrame:CGRectZero]; _pv.showsSelectionIndicator = YES; _pv.dataSource = self; _pv.delegate = self; _tf.delegate = self; _tf.inputView = _pv; } - (IBAction)dismissPickerView:(id)sender { [_pv removeFromSuperview]; [_tf.inputView removeFromSuperview]; [_tf resignFirstResponder]; _pickerViewShown = NO; } - (void)didReceiveMemoryWarning { [super didReceiveMemoryWarning]; // Dispose of any resources that can be recreated. } - (BOOL)textFieldShouldBeginEditing:(UITextField *)textField { if (!_pickerViewShown) { [self setRectForPickerViewRelativeToTextField:textField]; [self.view addSubview:_tf.inputView]; _pickerViewShown = YES; } else { [self dismissPickerView:self]; } return NO; } - (void)setRectForPickerViewRelativeToTextField:(UITextField*)textField { CGFloat xPos = textField.frame.origin.x; CGFloat yPos = textField.frame.origin.y; CGFloat width = textField.frame.size.width; CGFloat height = textField.frame.size.height; CGFloat pvHeight = _pv.frame.size.height; CGRect pvRect = CGRectMake(xPos, yPos+height, width, pvHeight); _pv.frame = pvRect; } - (NSString *)pickerView:(UIPickerView *)pickerView titleForRow:(NSInteger)row forComponent:(NSInteger)component { return [_array objectAtIndex:row]; } - (NSInteger)numberOfComponentsInPickerView:(UIPickerView *)pickerView { return 1; } - (NSInteger)pickerView:(UIPickerView *)pickerView numberOfRowsInComponent:(NSInteger)component { return _array.count; } - (void) pickerView:(UIPickerView *)pickerView didSelectRow:(NSInteger)row inComponent:(NSInteger)component { _tf.text = [_array objectAtIndex:row]; [self dismissPickerView:self]; } @end

    Read the article

  • UITextField to show UIPickerView in xcode 4.3.2 using textField.inputView

    - by ChromeBlue
    I'm looking to have a UITextField display a UIPickerView when touched. I found quite a few questions on the same topic that say to use UITextField.inputView. However, when I try, nothing changes. I have a very simple code: setupViewController.h #import <UIKit/UIKit.h> extern NSString *setupRightChannel; @interface setupViewController : UIViewController { UITextField* rightChannelField; UIPickerView *channelPicker; } @property (retain, nonatomic) IBOutlet UITextField* rightChannelField; @property (retain, readwrite) IBOutlet UIPickerView *channelPicker; setupViewController.m #import "setupViewController.h" @Interface setupViewController() @end @implementation setupViewController @synthesize rightChannelField; - (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil { self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil]; if (self) { // Custom initialization } return self; } - (void)viewDidLoad { [super viewDidLoad]; self.navigationItem.title = @"Setup"; // Do any additional setup after loading the view from its nib. rightChannelField.inputView = channelPicker; } -(IBAction)okClicked:(id)sender { setupRightChannel = rightChannelField.text; } I feel like I might be missing something fundamental here, but I honestly cannot think of what it is.

    Read the article

  • iPhone UITextField controlling background color

    - by Stephen Joy
    Greetings, I am unable to control the background color of a UITextField with a borderStyle= UITextBorderStyleRoundedRect. With this border style the backgroundColor property only seems to control a very narrow line along the inner edge of the rounded rectangle. The rest of the field remains white. However, if the borderStyle is set to UIBorderStyle=UITextBorderStyleBezel then the entire background of the UITextField is controlled by its backgroundColor property. Is this a feature? Is there a way to control the backgroundColor of a UITextField with a borderStyle=UITextBorderStyleRoundedRect? Thanks, Stephen

    Read the article

  • Detect backspace in UITextField

    - by marcc
    Is there any way to detect when the backspace/delete key is pressed in the iPhone keyboard on a UITextField that is empty? I want to know when backspace is pressed only if the UITextField is empty. Based on the suggestion from @Alex Reynolds in a comment, I've added the following code while creating my text field: [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(handleTextFieldChanged:) name:UITextFieldTextDidChangeNotification object:searchTextField]; This notification is received (handleTextFieldChanged function is called), but still not when I press the backspace key in an empty field. Any ideas? There seems to be some confusion around this question. I want to receive a notification when the backspace key is pressed. That's it. But the solution must also work when the UITextField is already empty.

    Read the article

  • iPhone: Issue disabling Auto-Cap/autocorrect on a UITextField

    - by phil swenson
    For some reason, even though I disable the auto-cap and auto-correct of my UITextField, it's still capitalizing the first letter of my input. Here is the code: UITextField* textField = [[[UITextField alloc] initWithFrame:CGRectMake(90.0, 10.0, 213.0, 25.0)] autorelease]; [textField setClearButtonMode:UITextFieldViewModeWhileEditing]; textField.returnKeyType = UIReturnKeyGo; textField.autocorrectionType = FALSE; textField.autocapitalizationType = UITextAutocapitalizationTypeNone; textField.delegate = self; if (inputFieldType == Email) { label.text = @"Email:"; textField.keyboardType = UIKeyboardTypeEmailAddress; emailTextField = textField; textField.placeholder = @"Email Address"; } else { // password textField.secureTextEntry = TRUE; label.text = @"Password:"; if (inputFieldType == Password){ textField.placeholder = @"Password"; passwordTextField = textField; } if (inputFieldType == ConfirmPassword){ textField.placeholder = @"Confirm Password"; confirmPasswordTextField = textField; } } See screenshot:

    Read the article

  • Re-Apply currency formatting to a UITextField on a change event

    - by Jim Aldes
    Howdy all, I'm working with a UITextField that holds a localized currency value. I've seen lots of posts on how to work with this, but my question is: how do I re-apply currency formatting to the UITextField after every key press? I know that I can set up and use a currency formatter with: NSNumberFormatter *currencyFormatter = [[NSNumberFormatter alloc] init]; [currencyFormatter setNumberStyle:NSNumberFormatterCurrencyStyle]; ... [currencyFormatter stringFromNumber:...]; but I don't know how to hook it up. For instance, if the value in the field reads "$12,345" and the user taps the "6" key, then the value should change to "$123,456". Which callback is the "correct" one to do this in (should I use textField:shouldChangeCharactersInRange:replacementString: or a custom target-action) and how do I use the NSNumberFormatter to parse and re-apply formatting to the UITextField's text property? Any help would be much appreciated! Thanks!

    Read the article

  • Bring to front DatePicker on an UITextField

    - by crazyfr
    Hi, When an UITextField is firstResponder, I would like to bring to front an UIDatePicker (bottom part of the screen) without the "going down keyboard" (no call to UITextField resignFirstResponder). The aim is to process like UIKeyboard of UITextField which pop-up on nearly everything when it becomeFirstResponder. modalViewController seems to be fullscreen only. - showDatePicker:(id)sender { if([taskName isFirstResponder]) [taskName resignFirstResponder]; [self.view.window addSubview: self.pickerView]; // size up the picker view and compute the start/end frame origin (...) [UIView commitAnimations]; } This example is an animation of keyboard going down, and DatePicker going up, behind and not in front. Do you know a solution ? A piece of code would be welcome. Thanks in advance.

    Read the article

  • How to push text from one UITextfield to another UITextfield in the next View? And back!?

    - by Chrizzz
    an Hi, I have an UITextField in one view, UITextField A in View A. And I have another in view B, UITextField B in View B. I use a Navigation Controller Bar to switch between the views. The UITextFields are properties and connected Outlets of both views A and B. On my view A there is an "Options"-button which pushes view B. So when you are typing in Textfield A, I would like the same text to appear in Textfield B. When you edit TextField B and you go back to view A (via the "Title View A"-button in de navigation bar), I would like the same text to re-appear in Textfield A. I expected this to be easy. But I can't get it working. I tried: ViewBController *controller = [[ViewBController alloc] initWithNibName:@"ViewBController" bundle:nil]; controller.TextFieldA.text = TextFieldB.text But nothing appeared in view B. And how do I get back? I dont want to use NSUserdefaults because I would have to remove the values also.

    Read the article

  • UiTextField events

    - by Mike
    When I create UITextField inside Interface Builder, I can access Events tab for it, which has events like Value changed, Touch cancel, Touch drag, etc. I can assign my own methods to every of those events. How can I do the same, when I create UITextField programmatically with alloc?

    Read the article

  • Showing tokens in UITextField

    - by Miraaj
    Hi all, I want to get tokens appearance in UITextField as we have in NSTokenField ie. as soon as user enters some name in UITextField it gets enclosed within a token. We have this control in to-cc fields in mail in iPhone / iPod and I want to get similar feature in my application. Can anyone suggest me some solution for it?? Thanks, Miraaj

    Read the article

  • UITextField rigtht frame

    - by JustMe
    Hi, I have a peace of code like this: CGSize lSize = [@"Hello World" sizeWithFont:[UIFont fontWithName:@"Arial" size:13]]; Now I want to have the right frame to see this text in the UITextField. I don't want to change the font size just have the frame for UITextField to fit with this text. I will really appreciate any helps

    Read the article

  • Get UITableView to scroll to the selected UITextField and Avoid Being Hidden by Keyboard

    - by Lauren Quantrell
    I have a UITextField in a table view on a UIViewController (not a UITableViewController). If the table view is on a UITableViewController, the table will automatically scroll to the textField being edited to prevent it from being hidden by the keyboard. But on a UIViewController it does not. I have tried for a couple of days reading through multiple ways to try to accomplish this and I cannot get it to work. The closest thing that actually scrolls is: -(void) textFieldDidBeginEditing:(UITextField *)textField { // SUPPOSEDLY Scroll to the current text field CGRect textFieldRect = [textField frame]; [self.wordsTableView scrollRectToVisible:textFieldRect animated:YES]; } However this only scrolls the table to the topmost row. What seems like an easy task has been a couple of days of frustration. I am using the following to construct the tableView cells: - (UITableViewCell *)tableView:(UITableView *)aTableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { NSString *identifier = [NSString stringWithFormat: @"%d:%d", [indexPath indexAtPosition: 0], [indexPath indexAtPosition:1]]; UITableViewCell *cell = [aTableView dequeueReusableCellWithIdentifier:identifier]; if (cell == nil) { cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:identifier] autorelease]; cell.accessoryType = UITableViewCellAccessoryNone; UITextField *theTextField = [[UITextField alloc] initWithFrame:CGRectMake(180, 10, 130, 25)]; theTextField.adjustsFontSizeToFitWidth = YES; theTextField.textColor = [UIColor redColor]; theTextField.text = [textFieldArray objectAtIndex:indexPath.row]; theTextField.keyboardType = UIKeyboardTypeDefault; theTextField.returnKeyType = UIReturnKeyDone; theTextField.font = [UIFont boldSystemFontOfSize:14]; theTextField.backgroundColor = [UIColor whiteColor]; theTextField.autocorrectionType = UITextAutocorrectionTypeNo; theTextField.autocapitalizationType = UITextAutocapitalizationTypeNone; theTextField.clearsOnBeginEditing = NO; theTextField.textAlignment = UITextAlignmentLeft; //theTextField.tag = 0; theTextField.tag=indexPath.row; theTextField.delegate = self; theTextField.clearButtonMode = UITextFieldViewModeWhileEditing; [theTextField setEnabled: YES]; [cell addSubview:theTextField]; [theTextField release]; } return cell; } I suspect I can get the tableView to scroll properly if I can somehow pass the indexPath.row in the textFieldDidBeginEditing method? Any help is appreciated.

    Read the article

  • [iPhone app] Detecting which key has been pressed in UITextField

    - by Dough
    Hi, I have an UITextField object in my view and want to launch a method when user press backspace button and textField is empty. First I have to do is to create a cursor storing text length, so when cursor changes from 1 to 0 there is nothing to do. The only way to launch the method is when text length is 0 - press backspace - remain to 0. How to catch the event of pressing the backspace key in my UITextField ? Thanks in advance !

    Read the article

  • UITextField start at end of text

    - by Raphael Pinto
    I created an UITextField in my App. This text field display a long text. The problem is that when I first open the view containing the UITextField, it is automaticaly show the end of my text. But I want it to show the begining. I read the UITextFiled Class Reference on Apple dev center, but nothing seem to allow me to change it. How can I do?

    Read the article

  • UITextField inside of UITableViewCell will not activate on iPad but works on iPhone

    - by cfihelp
    I have a UITextField inside a UITableViewCell. It will not activate on the iPad (but it works fine on the iPhone) no matter what I try. Tapping on it and telling it to become the firstResponder both fail. The odd thing is that if I take the exact same code and move it to another view controller in my app it executes just fine. This makes it seem as if there is likely a problem in the parent UITableViewController but I can't find anything obvious. I'm hoping that someone out there has experienced a similar problem and can point me in the right direction. Below is the sample code that works fine when I move it to a new project or put it in a new view controller launched immediately by my app delegate: // Customize the appearance of table view cells. - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { static NSString *CellIdentifier = @"Cell"; UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier]; if (cell == nil) { cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease]; } if (indexPath.row == 0) { UITextField *nameText = [[UITextField alloc] initWithFrame:CGRectMake(5, 5, cell.contentView.frame.size.width, cell.contentView.frame.size.height)]; nameText.delegate = self; nameText.backgroundColor = [UIColor redColor]; [cell.contentView addSubview:nameText]; [nameText becomeFirstResponder]; [nameText release]; } // Configure the cell... return cell; } Help!

    Read the article

  • Set cursor position in a UITextField (Monotouch)

    - by manuel
    In a UITextView used for entering decimal numbers I would like to get rid of possible leading zeros (The behavior should be like the one of the Calculator App). Normally this would be rather easy to implement but I just cannot figure out how to restore the cursor position. UITextField has a property SelectedTextRange of type UITextRange which can be used to get the cursor position. However, there seems no easy way to get the current index nor to create a new UITextRange object that contains the new values. I could find the solution in objective c: Finding the cursor position in a UITextField It is however very unclear to me how to rewrite that in Monotouch. Any help with this would be highly appreciated. Thanks, Manuel

    Read the article

  • UITextField valueDidChange-Event

    - by Infinite
    Is there a way to catch a "valueDidChange"-Event for a Textfield? oO I've got a modalView with an UITextField. When the UITextField is empty, the "Done"-Button in the NavigationBar should be disabled and when there is Text entered, it should become enabled. Right now the only way to accomplish this by using the "textFieldShouldReturn"-Method. This works but is simply horrible for usability. Isn't there a way to check the requirements every time a letter is being entered or removed?

    Read the article

1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >