zoukankan      html  css  js  c++  java
  • 点击UITextField弹出UIPickerView

    点击UITextField弹出UIPickerView有一些不同的方法,特此标记一下本方法:

    - (BOOL)textFieldShouldBeginEditing:(UITextField *)textField {
        
        UIPickerView *pickerView = [[UIPickerView alloc] init];
        
        [pickerView sizeToFit];
        pickerView.autoresizingMask = (UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight);
        pickerView.delegate = self;
        pickerView.dataSource = self;
        pickerView.showsSelectionIndicator = YES;            
        textField.inputView = pickerView;
        [pickerView release];
        
        
        
        UIToolbar* keyboardDoneButtonView = [[UIToolbar alloc] init];
        keyboardDoneButtonView.barStyle = UIBarStyleBlack;
        keyboardDoneButtonView.translucent = YES;
        keyboardDoneButtonView.tintColor = nil;
        [keyboardDoneButtonView sizeToFit];
        UIBarButtonItem* doneButton = [[[UIBarButtonItem alloc] initWithTitle:@"确定"
                                                                        style:UIBarButtonItemStyleBordered target:self
                                                                       action:@selector(pickerDoneClicked)] autorelease];
        
        [keyboardDoneButtonView setItems:[NSArray arrayWithObjects:doneButton, nil]];
        textField.inputAccessoryView = keyboardDoneButtonView;  
        [keyboardDoneButtonView release];          
        
        return YES;
        
    }

    效果图:

    效果图

  • 相关阅读:
    docker的安装
    Linux的常用命令
    HTTP协议,HTTPS协议,Websocket协议
    常用排序
    go的数组,切片,map
    if-else,switch,for循环
    go的函数,包以及mode的补充
    Android学习笔记——从源码看Handler的处理机制
    ElementUI
    关于IO的理解
  • 原文地址:https://www.cnblogs.com/appwgh/p/2574645.html
Copyright © 2011-2022 走看看