• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java UIEvent类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.robovm.apple.uikit.UIEvent的典型用法代码示例。如果您正苦于以下问题:Java UIEvent类的具体用法?Java UIEvent怎么用?Java UIEvent使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



UIEvent类属于org.robovm.apple.uikit包,在下文中一共展示了UIEvent类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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();
    }
}
 
开发者ID:robovm,项目名称:robovm-samples,代码行数:18,代码来源:PAPTabBarController.java


示例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");
    }
}
 
开发者ID:robovm,项目名称:robovm-samples,代码行数:23,代码来源:APLViewController.java


示例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;
}
 
开发者ID:robovm,项目名称:robovm-samples,代码行数:27,代码来源:APAMultiplayerLayeredCharacterScene.java


示例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);
}
 
开发者ID:robovm,项目名称:robovm-samples,代码行数:21,代码来源:APLMoveMeView.java


示例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;
    }
}
 
开发者ID:robovm,项目名称:robovm-samples,代码行数:17,代码来源:APLMoveMeView.java


示例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);
}
 
开发者ID:robovm,项目名称:robovm-samples,代码行数:20,代码来源:LandscapeViewController.java


示例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;
}
 
开发者ID:playn,项目名称:playn,代码行数:14,代码来源:RoboInput.java


示例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");
	    }
	});
   }
 
开发者ID:wolfgang-s,项目名称:owncloud-gallery,代码行数:30,代码来源:LoginViewController.java


示例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);
    }
}
 
开发者ID:robovm,项目名称:robovm-samples,代码行数:9,代码来源:PAPPhotoDetailsHeaderView.java


示例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);
}
 
开发者ID:robovm,项目名称:robovm-samples,代码行数:15,代码来源:PAPFindFriendsViewController.java


示例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);
    }
}
 
开发者ID:robovm,项目名称:robovm-samples,代码行数:9,代码来源:PAPPhotoTimelineViewController.java


示例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);
    }
}
 
开发者ID:robovm,项目名称:robovm-samples,代码行数:41,代码来源:APLViewController.java


示例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);
    }
}
 
开发者ID:robovm,项目名称:robovm-samples,代码行数:17,代码来源:APLViewController.java


示例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()));
    }
}
 
开发者ID:robovm,项目名称:robovm-samples,代码行数:14,代码来源:APLViewController.java


示例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()));
    }
}
 
开发者ID:robovm,项目名称:robovm-samples,代码行数:11,代码来源:APLViewController.java


示例16: touchesBegan

import org.robovm.apple.uikit.UIEvent; //导入依赖的package包/类
@Override
public void touchesBegan(NSSet<UITouch> touches, UIEvent event) {
    // Dismiss the keyboard when the view outside the text field is touched.
    textField.resignFirstResponder();
    // Revert the text field to the previous value.
    textField.setText(string);
    super.touchesBegan(touches, event);
}
 
开发者ID:robovm,项目名称:robovm-samples,代码行数:9,代码来源:MyViewController.java


示例17: touchesBegan

import org.robovm.apple.uikit.UIEvent; //导入依赖的package包/类
/** Touches to the Image view will start the movie playing. */
@Override
public void touchesBegan(NSSet<UITouch> touches, UIEvent event) {
    UITouch touch = touches.any();
    if (touch.getPhase() == UITouchPhase.Began) {
        /* Play the movie! */
        viewController.playLocalMovieFile();
    }
}
 
开发者ID:robovm,项目名称:robovm-samples,代码行数:10,代码来源:MyImageView.java


示例18: MyLocalMovieViewController

import org.robovm.apple.uikit.UIEvent; //导入依赖的package包/类
public MyLocalMovieViewController() {
    super();

    UIView view = getView();
    view.setBackgroundColor(UIColor.fromWhiteAlpha(0.66, 1));

    imageView = new MyImageView(new CGRect(57, 59, 205, 135));
    imageView.setMovieViewController(this);
    imageView.setUserInteractionEnabled(true);
    imageView.setImage(UIImage.getImage("images/preview.jpg"));
    imageView.setContentMode(UIViewContentMode.ScaleAspectFit);
    view.addSubview(imageView);

    playButton = new UIButton(UIButtonType.RoundedRect);
    playButton.setFrame(new CGRect(106, 201, 108, 44));
    playButton.setBackgroundColor(UIColor.fromWhiteAlpha(0.66, 0.5));
    playButton.setTitle("Play Movie", UIControlState.Normal);
    playButton.getTitleLabel().setFont(UIFont.getSystemFont(18));
    playButton.addOnTouchUpInsideListener(new UIControl.OnTouchUpInsideListener() {
        @Override
        public void onTouchUpInside(UIControl control, UIEvent event) {
            playLocalMovieFile();
        }
    });
    view.addSubview(playButton);

    setTabBarItem(new UITabBarItem("Local", UIImage.getImage("images/local.png"), 0));
}
 
开发者ID:robovm,项目名称:robovm-samples,代码行数:29,代码来源:MyLocalMovieViewController.java


示例19: setupUserInterface

import org.robovm.apple.uikit.UIEvent; //导入依赖的package包/类
private void setupUserInterface() {
    CGRect buttonFrame = new CGRect(10, 209, 234, 37);

    // create the button
    wikipediaButton = new UIButton(UIButtonType.RoundedRect);
    wikipediaButton.setFrame(buttonFrame);

    wikipediaButton.setTitle("View at Wikipedia", UIControlState.Normal);

    // Center the text on the button, considering the button's shadow
    wikipediaButton.setContentHorizontalAlignment(UIControlContentHorizontalAlignment.Center);
    wikipediaButton.setContentVerticalAlignment(UIControlContentVerticalAlignment.Center);

    wikipediaButton.addOnTouchUpInsideListener(new UIControl.OnTouchUpInsideListener() {
        @Override
        public void onTouchUpInside(UIControl control, UIEvent event) {
            // create the string that points to the correct Wikipedia page
            // for the element name
            String wikiPageString = String.format("http://en.wikipedia.org/wiki/%s", element.getName());
            if (!UIApplication.getSharedApplication().openURL(new NSURL(wikiPageString))) {
                // there was an error trying to open the URL. for the moment
                // we'll simply ignore it.
            }
        }
    });
    addSubview(wikipediaButton);
}
 
开发者ID:robovm,项目名称:robovm-samples,代码行数:28,代码来源:AtomicElementFlippedView.java


示例20: touchesMoved

import org.robovm.apple.uikit.UIEvent; //导入依赖的package包/类
@Override
public void touchesMoved(NSSet<UITouch> touches, UIEvent event) {
    if (heroes.size() < 1) {
        return;
    }
    UITouch touch = defaultPlayer.movementTouch;
    if (touches.contains(touch)) {
        defaultPlayer.targetLocation = touch.getLocationInNode(defaultPlayer.hero.getParent());
        if (!defaultPlayer.fireAction) {
            defaultPlayer.moveRequested = true;
        }
    }
}
 
开发者ID:robovm,项目名称:robovm-samples,代码行数:14,代码来源:APAMultiplayerLayeredCharacterScene.java



注:本文中的org.robovm.apple.uikit.UIEvent类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java ViewDescriptor类代码示例发布时间:2022-05-22
下一篇:
Java DebuggerUtils类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap