uitextfield

Format a UITextField for currency

风格不统一 提交于 2019-12-01 13:38:56
I have a UITextField on my aplication that receives only numeric input from the user. This numeric input represents currency and have the default value of 0.00. I would like to create something like a mask to format the UITextField as the user enter the numbers. For example: 9 becomes $0,09 99 becomes $0,99 999 becomes $999,99 The code below works great, but as I'm using integer and float values the app will eventually display wrong values afeter a certain point. For example: 999999999 becomes 100000000 That happens because flot and integer aren't precise enough and NSDEcimalNumber should be

How to Store User Entered Details and Get It Back in ios?

偶尔善良 提交于 2019-12-01 13:32:37
问题 How to Store user entered details and Get it Back in ios? I had Following TextFields : UserName , Email , Re-enter Email id , Phone , State , Address , Locality and Pincode . I want to store this Details in Current viewController locally and display this details in Next ViewController .... How many Ways I can Store and Fetch the Details, Does anyone know where I can find more information about this? 回答1: Do you want to keep user Info persistent(1) or you need this data just to represent it

Find out when UIKeyboard.frame intersects with other frame?

℡╲_俬逩灬. 提交于 2019-12-01 13:21:48
问题 I need to find out when the textfield becomes the first responder to notify me whether the keyboard that's going to show will obstruct the UITextField. If it does, I wanna adjust the scrollview properties. So far I have this setup. I'm listening for UIKeyboardWillShow notifications that calls the following selector: func keyboardWillAppear(notification:NSNotification) { if let keyboardSize = (notification.userInfo?[UIKeyboardFrameEndUserInfoKey] as? NSValue)?.cgRectValue { if keyboardSize

UITextField Crash in Simulator not in iPhone 4 (4.2)

给你一囗甜甜゛ 提交于 2019-12-01 12:10:30
问题 I'm facing a strange issue and have no idea how to solve it. I have in my app a simple viewcontroller with 3 textfield. I have define them as IBOutlet in my .h and linked them with the file's owner. Two of them are define with default Keyboard, the other use phone pad keyboard. When i Try to edit the phone field (phone pad keyboard) it's ok. Keyboard appear, field can be modify. When i try to edit one of the 2 others, then the app crash for the reason :"Terminating in response to SpringBoard

iOS Replace char in uitextfield

百般思念 提交于 2019-12-01 11:53:04
I found an annoying problem. I have a textfield with the numeric decimal keyboard, but the simulator has the point, the device has the comma (both 6.1). How can I do, if you insert a comma, this is replaced by a point? Thanks EDIT: this process, must take place in this method, in real time - (BOOL) textField: (UITextField *) theTextField shouldChangeCharactersInRange: (NSRange) range ReplacementString: (NSString *) string otherwise the comma is written, and at the next character, it is replaced HDdeveloper You can use - (NSString *)stringByReplacingOccurrencesOfString:(NSString *)target

Replacing character after each type in UITextField?

假装没事ソ 提交于 2019-12-01 11:37:29
问题 I have a UITextField in which the user is expected to type a sentence which we tell the user to type. So the sentence to type is already known to us. Midway of the sentence, the user has to secretly pass a message. The way to do this is by typing a few letters of the already known sentence and then type '&' followed by WhichEverMessageUserWantsToPass and '&' to end. The catch is the moment the user presses '&', whatever he types after that should not be displayed, instead each letter he types

iOS Replace char in uitextfield

廉价感情. 提交于 2019-12-01 11:37:13
问题 I found an annoying problem. I have a textfield with the numeric decimal keyboard, but the simulator has the point, the device has the comma (both 6.1). How can I do, if you insert a comma, this is replaced by a point? Thanks EDIT: this process, must take place in this method, in real time - (BOOL) textField: (UITextField *) theTextField shouldChangeCharactersInRange: (NSRange) range ReplacementString: (NSString *) string otherwise the comma is written, and at the next character, it is

How properly subclass UITextField in iOS?

╄→гoц情女王★ 提交于 2019-12-01 11:15:26
I know that there is a lot of info on the Internet about that question but I am stuck. I have app in which I need to customise my UITextFields . For example I need change border colour when edit starts or I need limitation of how many characters I can set in different text fields. I also need an image in several text fields which has to be indented on the left. To do all this I decided to make custom UITextField class (to subclass UITextField). I created new class from UITextField (which implements <UITextFieldDelegate> ). In that class I use self.delegate = self (this is widely used on the

ios making a button change view when text field equals string

巧了我就是萌 提交于 2019-12-01 11:09:41
I am making this kind of password to skip levels in a game. But I dont know what code I need to make a button change View Controller... - (IBAction)button:(id)sender { if ([txt.text isEqualToString:@"passwordToSkipLevel1"]) { // Code to change View Controller??? } } I am not sure if I have done it correct to far, and I am not sure how I can make it change View Controller either... Any ideas? Extra: Is there any method to make the password not case sensetive? What you have seems fine as far as it goes. To make the comparison case-insensitive, you can use if ([txt.txt

tableView convertPoint: fromView: odd behaviour and workaround

和自甴很熟 提交于 2019-12-01 11:04:15
I have a tableView with custom cells. One of the objects in the cell is a textField. The tableViewController is the textFieldDelegate. The datasource for the table is an array of objects. When the user tap on the textField, the tableViewController implements textField delegates methods controlling this way the data entry. To use the data entered by user, the tableViewController implements the following: - (BOOL)textFieldShouldEndEditing:(UITextField *)textField { CGPoint point = [textField center]; point = [self.tableView convertPoint:point fromView:textField]; NSIndexPath *indexPath = [self