本文整理汇总了Java中org.robovm.apple.uikit.UITextField类的典型用法代码示例。如果您正苦于以下问题:Java UITextField类的具体用法?Java UITextField怎么用?Java UITextField使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
UITextField类属于org.robovm.apple.uikit包,在下文中一共展示了UITextField类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: shouldChangeCharacters
import org.robovm.apple.uikit.UITextField; //导入依赖的package包/类
@Override
public boolean shouldChangeCharacters (UITextField textField, NSRange range, String string) {
for (int i = 0; i < range.length(); i++) {
app.input.inputProcessor.keyTyped((char)8);
}
if (string.isEmpty()) {
if (range.length() > 0) Gdx.graphics.requestRendering();
return false;
}
char[] chars = new char[string.length()];
string.getChars(0, string.length(), chars, 0);
for (int i = 0; i < chars.length; i++) {
app.input.inputProcessor.keyTyped(chars[i]);
}
Gdx.graphics.requestRendering();
return true;
}
开发者ID:basherone,项目名称:libgdxcn,代码行数:22,代码来源:IOSInput.java
示例2: viewDidLoad
import org.robovm.apple.uikit.UITextField; //导入依赖的package包/类
@Override
public void viewDidLoad() {
super.viewDidLoad();
gameModel = new GameModel();
gameOver = false;
scoreRequestTextField.setDelegate(new UITextFieldDelegateAdapter() {
// Code to limit our text field to 4 characters.
@Override
public boolean shouldChangeCharacters(UITextField textField, NSRange range, String string) {
final int maxLength = 4;
int oldLength = textField.getText().length();
int replacementLength = string.length();
long rangeLength = range.getLength();
long newLength = oldLength - rangeLength + replacementLength;
boolean returnKey = string.indexOf('\n') != -1;
return newLength <= maxLength || returnKey;
}
});
}
开发者ID:robovm,项目名称:robovm-samples,代码行数:25,代码来源:GameViewController.java
示例3: setUserID
import org.robovm.apple.uikit.UITextField; //导入依赖的package包/类
private void setUserID() {
UIAlertView alert = new UIAlertView("Set User ID", "", new UIAlertViewDelegateAdapter() {
@Override
public void clicked(UIAlertView alertView, long buttonIndex) {
if (buttonIndex == 1) {
UITextField textField = alertView.getTextField(0);
if (textField.getText() != null && !textField.getText().isEmpty()) {
String userID = textField.getText();
Flurry.setUserID(userID);
}
setUserAge();
}
}
}, "Cancel", "OK");
alert.setAlertViewStyle(UIAlertViewStyle.PlainTextInput);
alert.show();
}
开发者ID:robovm,项目名称:robovm-samples,代码行数:19,代码来源:MainMenuViewController.java
示例4: setUserAge
import org.robovm.apple.uikit.UITextField; //导入依赖的package包/类
private void setUserAge() {
UIAlertView alert = new UIAlertView("Set User Age", "", new UIAlertViewDelegateAdapter() {
@Override
public void clicked(UIAlertView alertView, long buttonIndex) {
if (buttonIndex == 1) {
UITextField textField = alertView.getTextField(0);
if (textField.getText() != null && !textField.getText().isEmpty()) {
int age = Integer.valueOf(textField.getText());
Flurry.setAge(age);
}
setUserGender();
}
}
}, "Cancel", "OK");
alert.setAlertViewStyle(UIAlertViewStyle.PlainTextInput);
alert.getTextField(0).setKeyboardType(UIKeyboardType.NumberPad);
alert.show();
}
开发者ID:robovm,项目名称:robovm-samples,代码行数:20,代码来源:MainMenuViewController.java
示例5: shouldChangeCharacters
import org.robovm.apple.uikit.UITextField; //导入依赖的package包/类
@Override
public boolean shouldChangeCharacters(UITextField textField, NSRange range, String string) {
for (int i = 0; i < range.getLength(); i++) {
app.input.inputProcessor.keyTyped((char) 8);
}
if (string.isEmpty()) {
if (range.getLength() > 0)
Gdx.graphics.requestRendering();
return false;
}
char[] chars = new char[string.length()];
string.getChars(0, string.length(), chars, 0);
for (int i = 0; i < chars.length; i++) {
app.input.inputProcessor.keyTyped(chars[i]);
}
Gdx.graphics.requestRendering();
return true;
}
开发者ID:mini2Dx,项目名称:mini2Dx,代码行数:23,代码来源:IOSMini2DxInput.java
示例6: shouldEndEditing
import org.robovm.apple.uikit.UITextField; //导入依赖的package包/类
@Override
public boolean shouldEndEditing (UITextField textField) {
// Text field needs to have at least one symbol - so we can use backspace
textField.setText("x");
Gdx.graphics.requestRendering();
return true;
}
开发者ID:basherone,项目名称:libgdxcn,代码行数:9,代码来源:IOSInput.java
示例7: shouldReturn
import org.robovm.apple.uikit.UITextField; //导入依赖的package包/类
@Override
public boolean shouldReturn (UITextField textField) {
if (keyboardCloseOnReturn) setOnscreenKeyboardVisible(false);
app.input.inputProcessor.keyDown(Keys.ENTER);
app.input.inputProcessor.keyTyped((char)13);
Gdx.graphics.requestRendering();
return false;
}
开发者ID:basherone,项目名称:libgdxcn,代码行数:9,代码来源:IOSInput.java
示例8: createDefaultTextField
import org.robovm.apple.uikit.UITextField; //导入依赖的package包/类
private void createDefaultTextField () {
textfield = new UITextField(new CGRect(10, 10, 100, 50));
//Parameters
// Setting parameters
textfield.setKeyboardType(UIKeyboardType.Default);
textfield.setReturnKeyType(UIReturnKeyType.Done);
textfield.setAutocapitalizationType(UITextAutocapitalizationType.None);
textfield.setAutocorrectionType(UITextAutocorrectionType.No);
textfield.setSpellCheckingType(UITextSpellCheckingType.No);
textfield.setHidden(true);
// Text field needs to have at least one symbol - so we can use backspace
textfield.setText("x");
app.getUIViewController().getView().addSubview(textfield);
}
开发者ID:basherone,项目名称:libgdxcn,代码行数:15,代码来源:IOSInput.java
示例9: didBeginEditing
import org.robovm.apple.uikit.UITextField; //导入依赖的package包/类
@Override
@Method(selector = "textFieldDidBeginEditing:")
public void didBeginEditing(UITextField textField) {
System.out.println("textFieldDidBeginEditing"
+ viewToMove.getBounds().origin().y());
CGRect frame = viewToMove.getFrame();
// TODO implement ---------------------------------------------++++++
viewToMove.getBounds().origin().y(-100);
System.out.println("textFieldDidBeginEditing"
+ viewToMove.getBounds().origin().y());
}
开发者ID:wolfgang-s,项目名称:owncloud-gallery,代码行数:12,代码来源:TextFieldKeyboardDelegate.java
示例10: shouldEndEditing
import org.robovm.apple.uikit.UITextField; //导入依赖的package包/类
@Override
@Method(selector = "textFieldShouldEndEditing:")
public boolean shouldEndEditing(UITextField textField) {
System.out.println("shouldEndEditing"
+ viewToMove.getBounds().origin().y());
viewToMove.getBounds().origin().y(0);
System.out.println("shouldEndEditing"
+ viewToMove.getBounds().origin().y());
return true;
}
开发者ID:wolfgang-s,项目名称:owncloud-gallery,代码行数:11,代码来源:TextFieldKeyboardDelegate.java
示例11: shouldChangeCharacters
import org.robovm.apple.uikit.UITextField; //导入依赖的package包/类
@Override
@Method(selector = "textField:shouldChangeCharactersInRange:replacementString:")
public boolean shouldChangeCharacters(UITextField textField,
@ByVal NSRange range, String string) {
// TODO Auto-generated method stub
return true;
}
开发者ID:wolfgang-s,项目名称:owncloud-gallery,代码行数:8,代码来源:TextFieldKeyboardDelegate.java
示例12: PAPPhotoDetailsFooterView
import org.robovm.apple.uikit.UITextField; //导入依赖的package包/类
public PAPPhotoDetailsFooterView(CGRect frame) {
super(frame);
setBackgroundColor(UIColor.clear());
mainView = new UIView(new CGRect(0, 0, UIScreen.getMainScreen().getBounds().getWidth(), 51));
mainView.setBackgroundColor(UIColor.white());
addSubview(mainView);
UIImageView messageIcon = new UIImageView(UIImage.getImage("IconAddComment"));
messageIcon.setFrame(new CGRect(20, 15, 22, 22));
mainView.addSubview(messageIcon);
UIImageView commentBox = new UIImageView(UIImage.getImage("TextFieldComment").newResizableImage(
new UIEdgeInsets(10, 10, 10, 10)));
commentBox.setFrame(new CGRect(55, 8, 237, 34));
mainView.addSubview(commentBox);
commentField = new UITextField(new CGRect(66, 8, 217, 34));
commentField.setFont(UIFont.getSystemFont(14));
commentField.setPlaceholder("Add a comment");
commentField.setReturnKeyType(UIReturnKeyType.Send);
commentField.setTextColor(UIColor.fromRGBA(34f / 255f, 34f / 255f, 34f / 255f, 1));
commentField.setContentVerticalAlignment(UIControlContentVerticalAlignment.Center);
commentField.getKeyValueCoder().setValue("_placeholderLabel.textColor",
UIColor.fromRGBA(114f / 255f, 114f / 255f, 114f / 255f, 1));
mainView.addSubview(commentBox);
}
开发者ID:robovm,项目名称:robovm-samples,代码行数:29,代码来源:PAPPhotoDetailsFooterView.java
示例13: shouldReturn
import org.robovm.apple.uikit.UITextField; //导入依赖的package包/类
@Override
public boolean shouldReturn(UITextField textField) {
textField.resignFirstResponder();
loadAddressURL();
return true;
}
开发者ID:robovm,项目名称:robovm-samples,代码行数:9,代码来源:AAPLWebViewController.java
示例14: shouldChangeCharacters
import org.robovm.apple.uikit.UITextField; //导入依赖的package包/类
@Override
public boolean shouldChangeCharacters(UITextField textField, NSRange range, String string) {
boolean result = true;
// restrict the maximum number of characters to 5
if (textField.getText().length() == 5 && string.length() > 0)
result = false;
return result;
}
开发者ID:robovm,项目名称:robovm-samples,代码行数:11,代码来源:ThreeViewController.java
示例15: shouldEndEditing
import org.robovm.apple.uikit.UITextField; //导入依赖的package包/类
@Override
public boolean shouldEndEditing(UITextField textField) {
// Text field needs to have at least one symbol - so we can use
// backspace
textField.setText("x");
Gdx.graphics.requestRendering();
return true;
}
开发者ID:mini2Dx,项目名称:mini2Dx,代码行数:10,代码来源:IOSMini2DxInput.java
示例16: shouldReturn
import org.robovm.apple.uikit.UITextField; //导入依赖的package包/类
@Override
public boolean shouldReturn(UITextField textField) {
if (keyboardCloseOnReturn)
setOnscreenKeyboardVisible(false);
app.input.inputProcessor.keyDown(Keys.ENTER);
app.input.inputProcessor.keyTyped((char) 13);
Gdx.graphics.requestRendering();
return false;
}
开发者ID:mini2Dx,项目名称:mini2Dx,代码行数:10,代码来源:IOSMini2DxInput.java
示例17: createDefaultTextField
import org.robovm.apple.uikit.UITextField; //导入依赖的package包/类
private void createDefaultTextField() {
textfield = new UITextField(new CGRect(10, 10, 100, 50));
// Parameters
// Setting parameters
textfield.setKeyboardType(UIKeyboardType.Default);
textfield.setReturnKeyType(UIReturnKeyType.Done);
textfield.setAutocapitalizationType(UITextAutocapitalizationType.None);
textfield.setAutocorrectionType(UITextAutocorrectionType.No);
textfield.setSpellCheckingType(UITextSpellCheckingType.No);
textfield.setHidden(true);
// Text field needs to have at least one symbol - so we can use
// backspace
textfield.setText("x");
app.getUIViewController().getView().addSubview(textfield);
}
开发者ID:mini2Dx,项目名称:mini2Dx,代码行数:16,代码来源:IOSMini2DxInput.java
示例18: setTextField
import org.robovm.apple.uikit.UITextField; //导入依赖的package包/类
@IBOutlet
public void setTextField(UITextField textField) {
this.textField = textField;
}
开发者ID:robovm,项目名称:robovm-tutorials,代码行数:5,代码来源:MainSceneController.java
示例19: getKeyboardTextField
import org.robovm.apple.uikit.UITextField; //导入依赖的package包/类
public UITextField getKeyboardTextField () {
if (textfield == null) createDefaultTextField();
return textfield;
}
开发者ID:basherone,项目名称:libgdxcn,代码行数:5,代码来源:IOSInput.java
示例20: generateTextField
import org.robovm.apple.uikit.UITextField; //导入依赖的package包/类
private UITextField generateTextField(String placeholder, float y,
UIKeyboardType keyboardType, String leftViewImageName) {
UITextField textField = new UITextField(new CGRect(0, 0, 300, 40));
textField.setDelegate(new TextFieldKeyboardDelegate(this.getView()));
textField.setTranslatesAutoresizingMaskIntoConstraints(false);
textField
.setContentVerticalAlignment(UIControlContentVerticalAlignment.Center);
textField.setBorderStyle(UITextBorderStyle.RoundedRect);
textField.setPlaceholder(placeholder);
textField.setFont(UIFont.getFont("Helvetica", 17));
textField.setClearsOnBeginEditing(true);
textField.setAdjustsFontSizeToFitWidth(true);
textField.setMinimumFontSize(17);
textField.setAutocapitalizationType(UITextAutocapitalizationType.None);
textField.setKeyboardType(keyboardType);
textField.setReturnKeyType(UIReturnKeyType.Done);
textField.setClearButtonMode(UITextFieldViewMode.WhileEditing);
UIImageView leftView = new UIImageView(new CGRect(0, 0, 40, 40));
leftView.setImage(UIImage.createFromBundle(leftViewImageName));
leftView.setAlpha(0.5);
textField.setLeftView(leftView);
textField.setLeftViewMode(UITextFieldViewMode.Always);
this.getView().addSubview(textField);
this.getView().addConstraint(
NSLayoutConstraint.create(textField, NSLayoutAttribute.CenterX,
NSLayoutRelation.Equal, this.getView(),
NSLayoutAttribute.CenterX, 1, 0));
this.getView().addConstraint(
NSLayoutConstraint.create(textField, NSLayoutAttribute.CenterY,
NSLayoutRelation.Equal, this.getView(),
NSLayoutAttribute.CenterY, 1, y));
this.getView().addConstraint(
NSLayoutConstraint.create(textField, NSLayoutAttribute.Height,
NSLayoutRelation.Equal, this.getView(),
NSLayoutAttribute.Height, 0, 40));
this.getView().addConstraint(
NSLayoutConstraint.create(textField, NSLayoutAttribute.Width,
NSLayoutRelation.Equal, this.getView(),
NSLayoutAttribute.Width, 0.8, 0));
return textField;
}
开发者ID:wolfgang-s,项目名称:owncloud-gallery,代码行数:46,代码来源:LoginViewController.java
注:本文中的org.robovm.apple.uikit.UITextField类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论