I am creating an iphone app, and I am using a UITextField. In my textfield, if the user fills the textfield, I would still like the user to see what they are text. I am not using the keyboard to fill the textfield – the values are getting filled in from buttons on a calculator. It there a way to make the textfield show the most recently entered values as it normally would with the keyboard?
Thanks.
Here is the code that populates the textfield:
- (IBAction)number:(id)sender {
NSString *entry = [sender currentTitle];
NSLog(@"%@", entry);
if(justOpenedCalculator){
total.text = @"";
total.text = [total.text stringByAppendingString:entry];
addFirstValueToDiscount = YES;
}else{
total.text = [total.text stringByAppendingString:entry];
addFirstValueToDiscount = YES;
}
justOpenedCalculator = NO;
}
I don’t see why you could not do it with the
textField. Just go over theUITextFieldDelegatemethods in the Apple Documentation, and implement it. Here is the LINK !. You need to implement that and instead of doing ajustOpenedCalculatoryou could utilize thetextFieldDidBeginEditingmethod, and otherdelegatemethods for your functions.Make sure that you do a
yourTextField.inputView = yourCustomKeyboard.