本文整理汇总了Java中org.robovm.apple.uikit.UIViewController类的典型用法代码示例。如果您正苦于以下问题:Java UIViewController类的具体用法?Java UIViewController怎么用?Java UIViewController使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
UIViewController类属于org.robovm.apple.uikit包,在下文中一共展示了UIViewController类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: shareCurrentScreen
import org.robovm.apple.uikit.UIViewController; //导入依赖的package包/类
@Override
public boolean shareCurrentScreen() {
SLComposeViewController slc = RobovmLauncher.getSLComposeViewController();
String screenshotPath = ScreenshotFactory.saveScreenshot(Gdx.files.getExternalStoragePath() + "/screenshots/", true);
// If we were able to take a screenshot
if (!screenshotPath.equals("")){
slc.addImage(new UIImage(new File(screenshotPath)));
UIViewController view = UIApplication.getSharedApplication().getKeyWindow().getRootViewController();
view.presentViewController(slc, false, null);
return true;
}else{
return false;
}
}
示例2: setViewControllers
import org.robovm.apple.uikit.UIViewController; //导入依赖的package包/类
@Override
public void setViewControllers(NSArray<UIViewController> viewControllers, boolean animated) {
super.setViewControllers(viewControllers, animated);
UIButton cameraButton = new UIButton(UIButtonType.Custom);
cameraButton.setFrame(new CGRect((getTabBar().getBounds().getSize().getWidth() - 131) / 2, 0, 131, getTabBar()
.getBounds().getSize().getHeight()));
cameraButton.setImage(UIImage.getImage("ButtonCamera"), UIControlState.Normal);
cameraButton.setImage(UIImage.getImage("ButtonCameraSelected"), UIControlState.Highlighted);
cameraButton.addOnTouchUpInsideListener(photoCaptureButtonAction);
getTabBar().addSubview(cameraButton);
UISwipeGestureRecognizer swipeUpGestureRecognizer = new UISwipeGestureRecognizer(
new UIGestureRecognizer.OnGestureListener() {
@Override
public void onGesture(UIGestureRecognizer gestureRecognizer) {
shouldPresentPhotoCaptureController();
}
});
swipeUpGestureRecognizer.setDirection(UISwipeGestureRecognizerDirection.Up);
swipeUpGestureRecognizer.setNumberOfTouchesRequired(1);
cameraButton.addGestureRecognizer(swipeUpGestureRecognizer);
}
示例3: getViewControllerBefore
import org.robovm.apple.uikit.UIViewController; //导入依赖的package包/类
@Override
public UIViewController getViewControllerBefore(UIPageViewController pageViewController,
UIViewController viewController) {
PhotosViewController photosViewController = (PhotosViewController) pageViewController.getDelegate();
if (!photosViewController.isPageAnimationFinished()) {
// we are still animating don't return a previous view controller
// too soon
return null;
}
int index = getIndexOfViewController((DataViewController) viewController);
if (index == 0 || index == -1) {
// we are at the first page, don't go back any further
return null;
}
index--;
currentPageIndex = index;
return getViewControllerAtIndex(index, viewController.getStoryboard());
}
示例4: getViewControllerAfter
import org.robovm.apple.uikit.UIViewController; //导入依赖的package包/类
@Override
public UIViewController getViewControllerAfter(UIPageViewController pageViewController,
UIViewController viewController) {
PhotosViewController photosViewController = (PhotosViewController) pageViewController.getDelegate();
if (!photosViewController.isPageAnimationFinished()) {
// we are still animating don't return a next view controller too
// soon
return null;
}
int index = getIndexOfViewController((DataViewController) viewController);
if (index == -1) {
// we are at the last page, don't go back any further
return null;
}
index++;
currentPageIndex = index;
if (index == pageData.size()) {
return null;
}
return getViewControllerAtIndex(index, viewController.getStoryboard());
}
示例5: getSpineLocation
import org.robovm.apple.uikit.UIViewController; //导入依赖的package包/类
@Override
public UIPageViewControllerSpineLocation getSpineLocation(UIPageViewController pageViewController,
UIInterfaceOrientation orientation) {
// Set the spine position to "min" and the page view controller's view
// controllers array to contain just one view
// controller. Setting the spine position to
// 'UIPageViewControllerSpineLocationMid' in landscape orientation sets
// the doubleSided property to YES, so set it to NO here.
UIViewController currentViewController = pageViewController.getViewControllers().get(0);
NSArray<UIViewController> viewControllers = new NSArray<>(currentViewController);
pageViewController.setViewControllers(viewControllers, UIPageViewControllerNavigationDirection.Forward, true,
null);
pageViewController.setDoubleSided(false);
return UIPageViewControllerSpineLocation.Min;
}
示例6: domob
import org.robovm.apple.uikit.UIViewController; //导入依赖的package包/类
private void domob() {
final UIViewController controller = ((IOSApplication)
Gdx.app).getUIViewController();
DMSplashAdController cotroller = new DMSplashAdController("56OJzBWouN1uFPD9LZ", "16TLmT-vApG01NUvNJDvaK-s", getWindow());
cotroller.setDelegate(this);
//cotroller.loadView();
cotroller.present();
// if (cotroller.getIsReady()) {
//cotroller.present();
// }
}
示例7: showBanner
import org.robovm.apple.uikit.UIViewController; //导入依赖的package包/类
@Override
public void showBanner() {
/*
* final GADBannerView mBannerView = new
* GADBannerView(GADAdSize.smartBannerPortrait());
* mBannerView.setAdUnitID("ca-app-pub-1743332321423234/2574098708");
*
* final UIViewController controller = ((IOSApplication)
* Gdx.app).getUIViewController();
*
* GADRequest request = GADRequest.create(); List<String> devices = new
* ArrayList<String>(); devices.add(GADRequest.GAD_SIMULATOR_ID);
* mBannerView.setRootViewController(controller);
* controller.getView().addSubview(mBannerView);
*
* mBannerView.loadRequest(request);
*/
final UIViewController controller = ((IOSApplication)
Gdx.app).getUIViewController();
DMAdView mAdView = new DMAdView("56OJzBWouN1uFPD9LZ", "16TLmT-vApG01NUvNBqMTlRz");
mAdView.setDelegate(this);
mAdView.setFrame(new CGRect(0, 0, DMAdView.DOMOB_AD_SIZE_320x50.getWidth(), DMAdView.DOMOB_AD_SIZE_320x50.getHeight()));
mAdView.setRootViewController(controller);
controller.getView().addSubview(mAdView);
mAdView.loadAd();
}
示例8: showBanner
import org.robovm.apple.uikit.UIViewController; //导入依赖的package包/类
@Override
public void showBanner() {
final GADBannerView mBannerView = new GADBannerView(GADAdSize.smartBannerPortrait());
mBannerView.setAdUnitID("ca-app-pub-1743332321423234/2574098708");
final UIViewController controller = ((IOSApplication) Gdx.app).getUIViewController();
GADRequest request = GADRequest.create();
List<String> devices = new ArrayList<String>();
devices.add(GADRequest.GAD_SIMULATOR_ID);
mBannerView.setRootViewController(controller);
controller.getView().addSubview(mBannerView);
mBannerView.loadRequest(request);
}
示例9: canPerformUnwind
import org.robovm.apple.uikit.UIViewController; //导入依赖的package包/类
/**
* We must disambiguate which QuestionViewController should handle the
* exitToQuizStart: action as there will be several QuestionViewController
* instances on the navigation stack when the unwind segue is triggered. By
* default, a UINavigationController (or QuizContainerViewController)
* searches its viewControllers array in reverse. Without overriding this
* method, the QuestionViewController directly preceding the results screen
* would be selected as the destination of the unwind segue.
*/
@Override
public boolean canPerformUnwind(Selector action, UIViewController fromViewController, NSObject sender) {
// Always check if the view controller implements the unwind action by
// calling the super's implementation.
if (super.canPerformUnwind(action, fromViewController, sender)) {
// The first QuestionViewController in the navigation stack should
// handle the unwind action.
return this == ((UINavigationController) getParentViewController()).getViewControllers().get(0);
}
return false;
}
示例10: viewDidLoad
import org.robovm.apple.uikit.UIViewController; //导入依赖的package包/类
@Override
public void viewDidLoad() {
super.viewDidLoad();
modelController = new ModelController();
// Do any additional setup after loading the view, typically from a nib.
// Configure the page view controller and add it as a child view
// controller.
pageViewController = new UIPageViewController(UIPageViewControllerTransitionStyle.PageCurl,
UIPageViewControllerNavigationOrientation.Horizontal, null);
pageViewController.setDelegate(this);
modelController.setPageData(photosToShow);
UIStoryboard storyboard = new UIStoryboard("Main", null);
DataViewController startingViewController = modelController.getViewControllerAtIndex(0, storyboard);
NSArray<UIViewController> viewControllers = new NSArray<UIViewController>(startingViewController);
pageViewController.setViewControllers(viewControllers,
UIPageViewControllerNavigationDirection.Forward, false, null);
updateNavBarTitle();
pageViewController.setDataSource(modelController);
addChildViewController(pageViewController);
getView().addSubview(pageViewController.getView());
pageViewController.didMoveToParentViewController(this);
// add the page view controller's gesture recognizers to the book view
// controller's view
// so that the gestures are started more easily
getView().setGestureRecognizers(pageViewController.getGestureRecognizers());
pageAnimationFinished = true;
}
示例11: didFinishAnimating
import org.robovm.apple.uikit.UIViewController; //导入依赖的package包/类
@Override
public void didFinishAnimating(UIPageViewController pageViewController, boolean finished,
NSArray<UIViewController> previousViewControllers, boolean completed) {
// update the nav bar title showing which index we are displaying
updateNavBarTitle();
pageAnimationFinished = true;
}
示例12: cycleViewControllers
import org.robovm.apple.uikit.UIViewController; //导入依赖的package包/类
/**
* Transition from the old view controller to the new one.
*
* @param oldViewController
* @param newViewController
*/
private void cycleViewControllers(UIViewController oldViewController, UIViewController newViewController) {
if (newViewController == null)
throw new NullPointerException("newViewController");
if (oldViewController != null) {
oldViewController.getView().removeFromSuperview();
}
CGRect frame = newViewController.getView().getFrame();
frame.getSize().setWidth(containerView.getFrame().getWidth());
frame.getSize().setHeight(containerView.getFrame().getHeight());
newViewController.getView().setFrame(frame);
containerView.addSubview(newViewController.getView());
}
示例13: getViewControllerForSelectedIndex
import org.robovm.apple.uikit.UIViewController; //导入依赖的package包/类
/**
* @param index
* @return the view controller associated with the segmented control's
* selected index.
*/
private UIViewController getViewControllerForSelectedIndex(int index) {
UIViewController viewController = null;
switch (index) {
case 0:
viewController = productsList;
break;
case 1:
viewController = purchasesList;
break;
default:
break;
}
return viewController;
}
示例14: segmentValueChanged
import org.robovm.apple.uikit.UIViewController; //导入依赖的package包/类
/**
* Called when a user taps on the segmented control
*
* @param sender
*/
private void segmentValueChanged(UIControl sender) {
UISegmentedControl segControl = (UISegmentedControl) sender;
// Return productsList if the user tapped Products in the segmented
// control and purchasesList, otherwise
UIViewController newViewController = segControl.getSelectedSegment() == 0 ? productsList : purchasesList;
// Return purchasesList if the user tapped Purchases in the segmented
// control and productsList, otherwise
UIViewController oldViewController = segControl.getSelectedSegment() == 1 ? purchasesList : productsList;
cycleViewControllers(oldViewController, newViewController);
}
示例15: setupDocumentController
import org.robovm.apple.uikit.UIViewController; //导入依赖的package包/类
private void setupDocumentController(NSURL url) {
// checks if docInteractionController has been initialized with the URL
if (docInteractionController == null) {
docInteractionController = new UIDocumentInteractionController(url);
docInteractionController.setDelegate(new UIDocumentInteractionControllerDelegateAdapter() {
@Override
public UIViewController getViewControllerForPreview(UIDocumentInteractionController controller) {
return DITableViewController.this;
}
});
} else {
docInteractionController.setURL(url);
}
}