本文整理汇总了Java中org.robovm.apple.uikit.UITextField类的典型用法代码示例。如果您正苦于以下问题:Java UITextField类的具体用法?Java UITextField怎么用?Java UITextField使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
UITextField类属于org.robovm.apple.uikit包,在下文中一共展示了UITextField类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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;
}
示例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;
}
});
}
示例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();
}
示例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();
}
示例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;
}
示例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;
}
示例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;
}
示例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);
}
示例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());
}
示例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;
}
示例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;
}
示例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);
}
示例13: shouldReturn
import org.robovm.apple.uikit.UITextField; //导入依赖的package包/类
@Override
public boolean shouldReturn(UITextField textField) {
textField.resignFirstResponder();
loadAddressURL();
return true;
}
示例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;
}
示例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;
}