本文整理汇总了Java中org.robovm.apple.uikit.UIEvent类的典型用法代码示例。如果您正苦于以下问题:Java UIEvent类的具体用法?Java UIEvent怎么用?Java UIEvent使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
UIEvent类属于org.robovm.apple.uikit包,在下文中一共展示了UIEvent类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onTouchUpInside
import org.robovm.apple.uikit.UIEvent; //导入依赖的package包/类
@Override
public void onTouchUpInside(UIControl control, UIEvent event) {
boolean cameraDeviceAvailable = UIImagePickerController
.isSourceTypeAvailable(UIImagePickerControllerSourceType.Camera);
boolean photoLibraryAvailable = UIImagePickerController
.isSourceTypeAvailable(UIImagePickerControllerSourceType.PhotoLibrary);
if (cameraDeviceAvailable && photoLibraryAvailable) {
UIActionSheet actionSheet = new UIActionSheet(null, actionSheetDelegate, "Cancel", null, "Take Photo",
"Choose Photo");
actionSheet.showFrom(getTabBar());
} else {
// if we don't have at least two options, we automatically show
// whichever is available (camera or roll)
shouldPresentPhotoCaptureController();
}
}
示例2: touchesMoved
import org.robovm.apple.uikit.UIEvent; //导入依赖的package包/类
/**
* Handles the continuation of a touch.
*/
@Override
public void touchesMoved(NSSet<UITouch> touches, UIEvent event) {
int touchCount = 0;
touchPhaseText.setText("Phase: Touches moved");
// Enumerates through all touch objects
for (UITouch touch : touches) {
// Send to the dispatch method, which will make sure the appropriate
// subview is acted upon
dispatchTouchEvent(touch.getView(), touch.getLocationInView(getView()));
touchCount++;
}
// When multiple touches, report the number of touches.
if (touchCount > 1) {
touchTrackingText.setText(String.format("Tracking %d touches", touchCount));
} else {
touchTrackingText.setText("Tracking 1 touch");
}
}
示例3: touchesBegan
import org.robovm.apple.uikit.UIEvent; //导入依赖的package包/类
@Override
public void touchesBegan(NSSet<UITouch> touches, UIEvent event) {
if (heroes.size() < 1) {
return;
}
UITouch touch = touches.any();
if (defaultPlayer.movementTouch != null) {
return;
}
defaultPlayer.targetLocation = touch.getLocationInNode(defaultPlayer.hero.getParent());
boolean wantsAttack = false;
NSArray<SKNode> nodes = getNodesAtPoint(touch.getLocationInNode(this));
for (SKNode node : nodes) {
if (((node.getPhysicsBody().getCategoryBitMask() & APAColliderType.Cave) == APAColliderType.Cave)
|| ((node.getPhysicsBody().getCategoryBitMask() & APAColliderType.GoblinOrBoss) == APAColliderType.GoblinOrBoss)) {
wantsAttack = true;
}
}
defaultPlayer.fireAction = wantsAttack;
defaultPlayer.moveRequested = !wantsAttack;
defaultPlayer.movementTouch = touch;
}
示例4: touchesBegan
import org.robovm.apple.uikit.UIEvent; //导入依赖的package包/类
@Override
public void touchesBegan(NSSet<UITouch> touches, UIEvent event) {
// We only support single touches, so any retrieves just that touch from
// touches.
UITouch touch = touches.any();
// Only move the placard view if the touch was in the placard view.
if (touch.getView() != placardView) {
// In case of a double tap outside the placard view, update the
// placard's display string.
if (touch.getTapCount() == 2) {
setupNextDisplayString();
}
return;
}
// Animate the first touch.
CGPoint touchPoint = touch.getLocationInView(this);
animateFirstTouch(touchPoint);
}
示例5: touchesEnded
import org.robovm.apple.uikit.UIEvent; //导入依赖的package包/类
@Override
public void touchesEnded(NSSet<UITouch> touches, UIEvent event) {
UITouch touch = touches.any();
// If the touch was in the placardView, bounce it back to the center.
if (touch.getView() == placardView) {
/*
* Disable user interaction so subsequent touches don't interfere
* with animation until the placard has returned to the center.
* Interaction is reenabled in animationDidStop:finished:.
*/
setUserInteractionEnabled(false);
animatePlacardViewToCenter();
return;
}
}
示例6: LandscapeViewController
import org.robovm.apple.uikit.UIEvent; //导入依赖的package包/类
public LandscapeViewController() {
UIView view = getView();
view.setBackgroundColor(UIColor.white());
imageView = new UIImageView(new CGRect(0, 0, 568, 320));
view.addSubview(imageView);
UIButton button = new UIButton(new CGRect(20, 259, 49, 41));
button.setImage(UIImage.getImage("left"), UIControlState.Normal);
button.setImage(UIImage.getImage("left_pressed"),
UIControlState.with(UIControlState.Selected, UIControlState.Highlighted));
button.addOnTouchUpInsideListener(new UIControl.OnTouchUpInsideListener() {
@Override
public void onTouchUpInside(UIControl control, UIEvent event) {
dismissViewController(false, null);
}
});
view.addSubview(button);
}
示例7: toEvents
import org.robovm.apple.uikit.UIEvent; //导入依赖的package包/类
private Touch.Event[] toEvents (NSSet<UITouch> touches, UIEvent event, Touch.Event.Kind kind) {
final Touch.Event[] events = new Touch.Event[touches.size()];
int idx = 0;
for (UITouch touch : touches) {
CGPoint loc = touch.getLocationInView(touch.getView());
// transform the point based on our current scale
IPoint xloc = plat.graphics().transformTouch((float)loc.getX(), (float)loc.getY());
// on iOS the memory address of the UITouch object is the unique id
int id = (int)touch.getHandle();
events[idx++] = new Touch.Event(0, touch.getTimestamp() * 1000, xloc.x(), xloc.y(), kind, id);
}
return events;
}
示例8: generateLoginButton
import org.robovm.apple.uikit.UIEvent; //导入依赖的package包/类
private void generateLoginButton() {
loginButton = new UIButton(new CGRect(0, 0, 200, 30));
loginButton.setTitle("Login", UIControlState.Normal);
loginButton.setTranslatesAutoresizingMaskIntoConstraints(false);
this.getView().addSubview(loginButton);
this.getView().addConstraint(
NSLayoutConstraint.create(loginButton,
NSLayoutAttribute.CenterX, NSLayoutRelation.Equal,
this.getView(), NSLayoutAttribute.CenterX, 1, 0));
this.getView().addConstraint(
NSLayoutConstraint.create(loginButton,
NSLayoutAttribute.CenterY, NSLayoutRelation.Equal,
this.getView(), NSLayoutAttribute.CenterY, 1, 53));
this.getView().addConstraint(
NSLayoutConstraint.create(loginButton,
NSLayoutAttribute.Height, NSLayoutRelation.Equal,
this.getView(), NSLayoutAttribute.Height, 0, 30));
this.getView().addConstraint(
NSLayoutConstraint.create(loginButton, NSLayoutAttribute.Width,
NSLayoutRelation.Equal, this.getView(),
NSLayoutAttribute.Width, 0.5, 0));
loginButton
.addOnTouchUpInsideListener(new UIControl.OnTouchUpInsideListener() {
@Override
public void onTouchUpInside(UIControl control, UIEvent event) {
System.out.println("onTouchUpInside");
}
});
}
示例9: onTouchUpInside
import org.robovm.apple.uikit.UIEvent; //导入依赖的package包/类
@Override
public void onTouchUpInside(UIControl control, UIEvent event) {
UIButton button = (UIButton) control;
PAPUser user = likeUsers.get((int) button.getTag());
if (delegate != null) {
delegate.didTapUserButton(PAPPhotoDetailsHeaderView.this, button, user);
}
}
示例10: onTouchUpInside
import org.robovm.apple.uikit.UIEvent; //导入依赖的package包/类
@Override
public void onTouchUpInside(UIControl control, UIEvent event) {
ABPeoplePickerNavigationController addressBook = new ABPeoplePickerNavigationController();
addressBook.setPeoplePickerDelegate(peoplePickerDelegate);
if (MFMailComposeViewController.canSendMail() && MFMessageComposeViewController.canSendText()) {
addressBook.setDisplayedProperties(Arrays.asList(ABPersonProperty.Email, ABPersonProperty.Phone));
} else if (MFMailComposeViewController.canSendMail()) {
addressBook.setDisplayedProperties(Arrays.asList(ABPersonProperty.Email));
} else if (MFMessageComposeViewController.canSendText()) {
addressBook.setDisplayedProperties(Arrays.asList(ABPersonProperty.Phone));
}
presentViewController(addressBook, true, null);
}
示例11: onTouchUpInside
import org.robovm.apple.uikit.UIEvent; //导入依赖的package包/类
@Override
public void onTouchUpInside(UIControl control, UIEvent event) {
PAPPhoto photo = getObjects().get((int) control.getTag());
if (photo != null) {
PAPPhotoDetailsViewController photoDetailsVC = new PAPPhotoDetailsViewController(photo);
getNavigationController().pushViewController(photoDetailsVC, true);
}
}
示例12: touchesBegan
import org.robovm.apple.uikit.UIEvent; //导入依赖的package包/类
/**
* Handles the start of a touch.
*/
@Override
public void touchesBegan(NSSet<UITouch> touches, UIEvent event) {
long numTaps = touches.any().getTapCount();
touchPhaseText.setText("Phase: Touches began");
touchInfoText.setText("");
if (numTaps >= 2) {
touchInfoText.setText(String.format("%d taps", numTaps));
if ((numTaps == 2) && piecesOnTop) {
// A double tap positions the three pieces in a diagonal.
// The user will want to double tap when two or more pieces are
// on top of each other
if (firstPieceView.getCenter().getX() == secondPieceView.getCenter().getX()) {
secondPieceView.setCenter(new CGPoint(firstPieceView.getCenter().getX() - 50, firstPieceView
.getCenter().getY() - 50));
}
if (firstPieceView.getCenter().getX() == thirdPieceView.getCenter().getX()) {
thirdPieceView.setCenter(new CGPoint(firstPieceView.getCenter().getX() + 50, firstPieceView
.getCenter().getY() + 50));
}
if (secondPieceView.getCenter().getX() == thirdPieceView.getCenter().getX()) {
thirdPieceView.setCenter(new CGPoint(secondPieceView.getCenter().getX() + 50, secondPieceView
.getCenter().getY() + 50));
}
touchInstructionsText.setText("");
}
} else {
touchTrackingText.setText("");
}
// Enumerate through all the touch objects.
for (UITouch touch : touches) {
// Send to the dispatch method, which will make sure the appropriate
// subview is acted upon.
dispatchFirstTouch(touch.getLocationInView(getView()), null);
}
}
示例13: dispatchFirstTouch
import org.robovm.apple.uikit.UIEvent; //导入依赖的package包/类
/**
* Checks to see which view, or views, the point is in and then calls a
* method to perform the opening animation, which makes the piece slightly
* larger, as if it is being picked up by the user.
*/
private void dispatchFirstTouch(CGPoint touchPoint, UIEvent event) {
if (firstPieceView.getFrame().contains(touchPoint)) {
animateFirstTouch(touchPoint, firstPieceView);
}
if (secondPieceView.getFrame().contains(touchPoint)) {
animateFirstTouch(touchPoint, secondPieceView);
}
if (thirdPieceView.getFrame().contains(touchPoint)) {
animateFirstTouch(touchPoint, thirdPieceView);
}
}
示例14: touchesEnded
import org.robovm.apple.uikit.UIEvent; //导入依赖的package包/类
/**
* Handles the end of a touch event.
*/
@Override
public void touchesEnded(NSSet<UITouch> touches, UIEvent event) {
touchPhaseText.setText("Phase: Touches ended");
// Enumerates through all touch object
for (UITouch touch : touches) {
// Sends to the dispatch method, which will make sure the
// appropriate subview is acted upon
dispatchTouchEndEvent(touch.getView(), touch.getLocationInView(getView()));
}
}
示例15: touchesCancelled
import org.robovm.apple.uikit.UIEvent; //导入依赖的package包/类
@Override
public void touchesCancelled(NSSet<UITouch> touches, UIEvent event) {
touchPhaseText.setText("Phase: Touches cancelled");
// Enumerates through all touch objects.
for (UITouch touch : touches) {
// Sends to the dispatch method, which will make sure the
// appropriate subview is acted upon.
dispatchTouchEndEvent(touch.getView(), touch.getLocationInView(getView()));
}
}