IOS 學習筆記---UITextField的一些屬性

來源:互聯網
上載者:User

標籤:

UITextField* textField=[[UITextField alloc]initWithFrame:CGRectMake(60, 100, 200, 30)];    //屬性    //樣式      textField.borderStyle=UITextBorderStyleBezel;//矩形有陰影    textField.borderStyle=UITextBorderStyleLine;//矩形沒有陰影    textField.borderStyle=UITextBorderStyleNone;//無邊框    textField.borderStyle=UITextBorderStyleRoundedRect;//邊角為圓形        textField.text=@"sdf";//預設字型    textField.placeholder=@"在此輸入。。。";//提示輸入    textField.textAlignment=NSTextAlignmentCenter;//置中    textField.secureTextEntry=YES;//安全輸入,密碼框    textField.clearButtonMode=UITextFieldViewModeWhileEditing;//設定文字框右邊有個清除欄    textField.keyboardType = UIKeyboardTypePhonePad; // 彈出的鍵盤的樣式,彈出數組鍵盤    textField.keyboardAppearance=UIKeyboardAppearanceAlert;//設定鍵盤的顏色為深灰,預設是淺灰色UIKeyboardAppearanceDefault    textField.clearsOnBeginEditing = YES; // 再次編輯就清空原有的內容        textField.minimumFontSize = 20.0f; // 設定自動縮小顯示的最小字型大小    textField.secureTextEntry = NO; // 設定是否以密碼的圓點形式顯示    textField.autocorrectionType = YES; // 設定是否啟動自動提醒更新功能    textField.returnKeyType = UIReturnKeyDefault; // 設定彈出的鍵盤帶形式與帶的按鍵    [self.view addSubview:textField];


//當開始點擊textField會調用的方法-(void)textFieldDidBeginEditing:(UITextField *)textField {        NSLog(@"開始編輯");    }//當textField編輯結束時調用的方法-(void)textFieldDidEndEditing:(UITextField *)textField {        NSLog(@"結束編輯");    }//按下Done按鈕的調用方法,我們讓鍵盤消失-(BOOL)textFieldShouldReturn:(UITextField *)textField{        [textField resignFirstResponder];        return YES;    }- (void)didReceiveMemoryWarning {    [super didReceiveMemoryWarning];    // Dispose of any resources that can be recreated.}

 

IOS 學習筆記---UITextField的一些屬性

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.