How to highlight text automatically inside an UIAlertView text field
        Posted  
        
            by user333624
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by user333624
        
        
        
        Published on 2010-05-21T17:05:11Z
        Indexed on 
            2010/05/21
            17:10 UTC
        
        
        Read the original article
        Hit count: 311
        
uitextfield
|highlighting
Hello everyone I have an UIAlertView with a textfield that shows a default value and two buttons, one to cancel and the other one to confirm. What I am trying to do is that when the alert view is popped up the default value is highlighted so the user can override the whole value faster than manually erasing it.
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
UIAlertView *alert = [[UIAlertView alloc]initWithTitle:@"Title" message:@"" delegate:self cancelButtonTitle:@"Cancel" otherButtonTitles:@"Continue",nil];
[alerta addTextFieldWithValue:@"87893" label:@"value"];
UITextField *textField = [alert textField];
campoTexto.highlighted = YES;
campoTexto.keyboardType = UIKeyboardTypeNumbersAndPunctuation;
[alertt show];
[alert release];
}
for some reason there is a highlighted attribute for the textfield but it doesn't seem to work and there is no trail of that attribute in the Class documentation.
© Stack Overflow or respective owner