textfield

focusing a text field in swift

我是研究僧i 提交于 2020-05-24 08:44:08
问题 I have 4 textfields on a register screen and i have it set up so that when the user presses next on each text field, the next text field is focused. Code below: func textFieldShouldReturn(textField: UITextField) -> Bool { if (textField == self.fNameField) { textField.resignFirstResponder() self.sNameField.becomeFirstResponder() } else if (textField == self.sNameField) { self.emailField.becomeFirstResponder() } else if (textField == self.emailField) { self.passwordField.becomeFirstResponder()

focusing a text field in swift

雨燕双飞 提交于 2020-05-24 08:44:04
问题 I have 4 textfields on a register screen and i have it set up so that when the user presses next on each text field, the next text field is focused. Code below: func textFieldShouldReturn(textField: UITextField) -> Bool { if (textField == self.fNameField) { textField.resignFirstResponder() self.sNameField.becomeFirstResponder() } else if (textField == self.sNameField) { self.emailField.becomeFirstResponder() } else if (textField == self.emailField) { self.passwordField.becomeFirstResponder()

How to remove underline below TextField?

百般思念 提交于 2020-05-14 18:05:48
问题 Here is the code. I want to remove the black underline just below text, and currently the TextField is in edit mode: TextField( autofocus: true, decoration: InputDecoration.collapsed( hintText: "Search", border: InputBorder.none, ), maxLines: 1, ) 回答1: Try to give a TextStyle to your TextField widget. Your TextField is getting your default Theme's TextStyle. TextField( autofocus: true, style: TextStyle(color: Colors.white, fontSize: 30), decoration: InputDecoration.collapsed( hintText:

SwiftUI TextField acts disabled in VStack inside ZStack (simulating an Alert with a TextField)

两盒软妹~` 提交于 2020-05-13 18:47:08
问题 I need to make an Alert in SwiftUI that has an editable TextField in it. Currently, this isn't supported by SwiftUI (as of Xcode 11.3 ), so I'm looking for a work-around. I know I can implement by wrapping the normal UIKit bits in a UIHostingController , but really want to stick with an all-SwiftUI implementation. I've got two VStacks in a ZStack , with the front one (the one with the TextView) being hidden and disabled until until you tap the button. Take a look at this: import SwiftUI

cocos2dx2.2.2 TextField 问题

会有一股神秘感。 提交于 2020-05-01 04:24:30
版本:cocos2dx 2.2.2 在使用TextField时发现两个问题: 1、 缩放bug 在cocostudio中使用custom模式设置 TextField区域大小后,在程序中输入时出现字符缩放的BUG; 解决方案:在cocostudio中不要使用 TextField的custom模式,使用auto模式; 2、 多行显示问题 因问题1,若要实现自动换行需要自己写以下代码: void setTextFiled(TextField* pTextField, const CCSize& size) { if (pTextField) { CCLabelTTF* ttf = dynamic_cast<CCLabelTTF*>(pTextField->getVirtualRenderer()); if (ttf) { ttf->setDimensions(size); } } } 至于size大小,可以使用cocostudio中的custom模式拖动得到。 注意: 因问题1的存在,在使用完custom模式得到大小之后,记得换回auto模式,然后导出json使用。 来源: oschina 链接: https://my.oschina.net/u/1430085/blog/544606

Flutter how to update hint text with current value in TextField

耗尽温柔 提交于 2020-04-18 07:06:32
问题 I have a Textfield set up so when I click on it it clears the value -otherwise you have to delete the current value before you can type a new one. The problem is, when I click, the original hint text can be seen which can be quite confusing since it looks like it's been reset. So for example, the original hint text shows 25 in the text field, then I input a new value of 48 . But if I click again to input a new value once more, the original 25 hint text value is displayed again after it clears

iOS 限制textField字节长度

青春壹個敷衍的年華 提交于 2020-04-10 18:11:29
OC语言中,NSString类型的字符串,视英文字母和汉字都为一个长度(string.length把一个汉字也当做一个长度),而实际上,一个英文字母只占用1个字节,一个汉字占用2个字节。 有时又有需求,需要限定字节数目,而不是内容个数,就需要通过一些方法获取到字符串的字节数。比如,限定10个字节,则最多可以输入10个英文字母,或者5个汉字。 监听textField的长度变化,就需要设置textField的代理。 但是有个bug,监听内容变化的代理方法 - (BOOL)textField:(UITextField *)textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string 在点击键盘输入是正常的,但如果不点击键盘按键,拿汉字输入举例,输入一个字后,键盘上面会出现与该字可能是词语的字,点上面出现的字来输入,就不会触发上面的代理方法。 所以这个代理方法不能用,我们需要通过注册textField的通知来监听。 //注册通知,textfield内容改变调用 [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(textFieldDidChange:) name

Automatically scroll multiline TextFormField when it extends the maxLines attribute

廉价感情. 提交于 2020-04-10 09:33:12
问题 I'm implementing a TextFormField with the maxLines attribute set to 3. How can I make the TextFormField scroll down once the user starts with his fourth line? At the moment the cursor is just not visible anymore until the user scrolls down by hand. Is there a way to do this automatically? This behaviour is actually featured in the flutter_gallery app in the 'Text fields' example. Just type a long text to the 'Live story' input until it reaches the fourth line. The important parts of my code

Tab to next text field when 'next/return' key hit on keyboard in SwiftUI

我怕爱的太早我们不能终老 提交于 2020-04-07 05:26:09
问题 This is strictly for SwiftUI. I would like to have the keyboard move to the next available text field when the user hits the 'return' key on the keyboard. I have the following view: var body: some View { VStack { NavigationView { Form { TextField("First name", text: $model.firstname) .tag(1) TextField("Last name", text: $model.lastname) .tag(2) } .navigationBarTitle("Add a Person", displayMode: .inline) } } } And the following code that should allow the tab: func textFieldShouldReturn(_

Flutter TextField hidden by Keyboard, try many solution but not working

て烟熏妆下的殇ゞ 提交于 2020-04-05 06:46:46
问题 When focussing on the TextField, the keyboard hides over the TextField. Below I attached a screenshot with code. Please guide me in fixing this issue. signup.dart import 'package:flutter/material.dart'; import 'package:yfobs/utilities/desc.dart'; class SignUpPage extends StatefulWidget { static String tag = 'SignUpPage'; @override _SignUpPageState createState() => _SignUpPageState(); } class _SignUpPageState extends State<SignUpPage> { @override Widget build(BuildContext context) { return