本文整理汇总了Java中org.robovm.apple.foundation.NSRange类的典型用法代码示例。如果您正苦于以下问题:Java NSRange类的具体用法?Java NSRange怎么用?Java NSRange使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
NSRange类属于org.robovm.apple.foundation包,在下文中一共展示了NSRange类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: shouldChangeCharacters
import org.robovm.apple.foundation.NSRange; //导入依赖的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.foundation.NSRange; //导入依赖的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: shouldChangeCharacters
import org.robovm.apple.foundation.NSRange; //导入依赖的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
示例4: shouldChangeCharacters
import org.robovm.apple.foundation.NSRange; //导入依赖的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
示例5: urlFieldWasTapped
import org.robovm.apple.foundation.NSRange; //导入依赖的package包/类
@IBAction
private void urlFieldWasTapped(UITextView sender) {
// Select the url.
urlField.setSelectedRange(new NSRange(0, urlField.getText().length()));
// Show the copy menu.
UIMenuController.getSharedMenuController().setTargetRect(urlField.getBounds(), urlField);
UIMenuController.getSharedMenuController().setMenuVisible(true, true);
}
开发者ID:robovm,项目名称:robovm-samples,代码行数:10,代码来源:RootViewController.java
示例6: handleKeyboardNotification
import org.robovm.apple.foundation.NSRange; //导入依赖的package包/类
private void handleKeyboardNotification(UIKeyboardAnimation animation) {
double animationDuration = animation.getAnimationDuration();
// Convert the keyboard frame from screen to view coordinates.
CGRect keyboardScreenBeginFrame = animation.getStartFrame();
CGRect keyboardScreenEndFrame = animation.getEndFrame();
CGRect keyboardViewBeginFrame = getView().convertRectFromView(keyboardScreenBeginFrame, getView().getWindow());
CGRect keyboardViewEndFrame = getView().convertRectFromView(keyboardScreenEndFrame, getView().getWindow());
double originDelta = keyboardViewEndFrame.getOrigin().getY() - keyboardViewBeginFrame.getOrigin().getY();
// The text view should be adjusted, update the constant for this
// constraint.
textViewBottomLayoutGuideConstraint
.setConstant(textViewBottomLayoutGuideConstraint.getConstant() - originDelta);
getView().setNeedsUpdateConstraints();
UIView.animate(animationDuration, 0, UIViewAnimationOptions.BeginFromCurrentState, new Runnable() {
@Override
public void run() {
getView().layoutIfNeeded();
}
}, null);
// Scroll to the selected text once the keyboard frame changes.
NSRange selectedRange = textView.getSelectedRange();
textView.scrollRangeToVisible(selectedRange);
}
开发者ID:robovm,项目名称:robovm-samples,代码行数:30,代码来源:AAPLTextViewController.java
示例7: shouldChangeCharacters
import org.robovm.apple.foundation.NSRange; //导入依赖的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
示例8: touchesEnded
import org.robovm.apple.foundation.NSRange; //导入依赖的package包/类
/**
* Deselects the text in the urlField if the user taps in the white space of
* this view controller's view.
*/
@Override
public void touchesEnded(NSSet<UITouch> touches, UIEvent event) {
urlField.setSelectedRange(new NSRange(0, 0));
}
开发者ID:robovm,项目名称:robovm-samples,代码行数:9,代码来源:RootViewController.java
示例9: shouldChangeCharacters
import org.robovm.apple.foundation.NSRange; //导入依赖的package包/类
@Override
public boolean shouldChangeCharacters(UITextField textField, NSRange range, String string) {
return true;
}
开发者ID:robovm,项目名称:robovm-samples,代码行数:5,代码来源:AAPLWebViewController.java
注:本文中的org.robovm.apple.foundation.NSRange类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论