当前位置: 首页>>代码示例>>Java>>正文


Java CGRect.getSize方法代码示例

本文整理汇总了Java中org.robovm.apple.coregraphics.CGRect.getSize方法的典型用法代码示例。如果您正苦于以下问题:Java CGRect.getSize方法的具体用法?Java CGRect.getSize怎么用?Java CGRect.getSize使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.robovm.apple.coregraphics.CGRect的用法示例。


在下文中一共展示了CGRect.getSize方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: onBoundsChangeToRect

import org.robovm.apple.coregraphics.CGRect; //导入方法依赖的package包/类
@Override
public void onBoundsChangeToRect(CGRect bounds) {
    ShadowDrawableConstantState state = this.internalConstantState;

    CGSize boundsSize = bounds.getSize();
    double offsetWidth = state.getOffset().getWidth();
    double offsetHeight = state.getOffset().getHeight();

    if(offsetWidth > 0) {
        boundsSize.setWidth(boundsSize.getWidth() - offsetWidth);
    } else if(offsetWidth < 0) {
        bounds.getOrigin().setX(bounds.getOrigin().getX() - offsetWidth);
        boundsSize.setWidth(boundsSize.getWidth() + offsetWidth);
    }

    if(offsetHeight > 0) {
        boundsSize.setHeight(boundsSize.getHeight() - offsetHeight);
    } else if(offsetWidth < 0) {
        bounds.getOrigin().setY(bounds.getOrigin().getY() - offsetWidth);
        boundsSize.setHeight(boundsSize.getHeight() + offsetHeight);
    }

    internalConstantState.getDrawable().setBounds(bounds);
}
 
开发者ID:liraz,项目名称:robolayout,代码行数:25,代码来源:ShadowDrawable.java

示例2: LoadingStatus

import org.robovm.apple.coregraphics.CGRect; //导入方法依赖的package包/类
public LoadingStatus(CGRect frame) {
    super(frame);

    setBackgroundColor(UIColor.fromRGBA(0, 0, 0, 0.4));
    String loadingString = "Loading Photos…";

    UIFont loadingFont = UIFont.getBoldSystemFont(17);

    NSAttributedStringAttributes attrs = new NSAttributedStringAttributes().setFont(loadingFont);
    CGRect rect = new NSString(loadingString).getBoundingRect(new CGSize(frame.getWidth(), frame.getHeight()),
            NSStringDrawingOptions.with(NSStringDrawingOptions.UsesLineFragmentOrigin,
                    NSStringDrawingOptions.UsesFontLeading), attrs, null);
    CGSize labelSize = rect.getSize();

    double centerX = Math.floor((frame.getWidth() / 2) - (labelSize.getWidth() / 2));
    double centerY = Math.floor((frame.getHeight() / 2) - (labelSize.getHeight() / 2));
    loadingLabel = new UILabel(new CGRect(centerX, centerY, labelSize.getWidth(), labelSize.getHeight()));
    loadingLabel.setBackgroundColor(UIColor.clear());
    loadingLabel.setTextColor(UIColor.white());
    loadingLabel.setText(loadingString);
    loadingLabel.setFont(loadingFont);

    progress = new UIActivityIndicatorView(UIActivityIndicatorViewStyle.White);
    CGRect progressFrame = progress.getFrame();
    progressFrame.getOrigin().setX(centerX - progressFrame.getWidth() - 8);
    progressFrame.getOrigin().setY(centerY);
    progress.setFrame(progressFrame);

    addSubview(progress);
    addSubview(loadingLabel);
}
 
开发者ID:robovm,项目名称:robovm-samples,代码行数:32,代码来源:LoadingStatus.java

示例3: viewDidLoad

import org.robovm.apple.coregraphics.CGRect; //导入方法依赖的package包/类
@Override
public void viewDidLoad() {
    super.viewDidLoad();

    getTableView().setSeparatorStyle(UITableViewCellSeparatorStyle.None);
    getTableView().setBackgroundColor(UIColor.black());

    getNavigationItem().setTitleView(new UIImageView(UIImage.getImage("TitleFindFriends")));

    if (getNavigationController().getViewControllers().first() == this) {
        UIBarButtonItem dismissLeftBarButtonItem = new UIBarButtonItem("Back", UIBarButtonItemStyle.Plain,
                new UIBarButtonItem.OnClickListener() {
                    @Override
                    public void onClick(UIBarButtonItem barButtonItem) {
                        getNavigationController().dismissViewController(true, null);
                    }
                });
        getNavigationItem().setLeftBarButtonItem(dismissLeftBarButtonItem);
    } else {
        getNavigationItem().setLeftBarButtonItem(null);
    }

    if (MFMailComposeViewController.canSendMail() || MFMessageComposeViewController.canSendText()) {
        headerView = new UIView(new CGRect(0, 0, 320, 67));
        headerView.setBackgroundColor(UIColor.black());
        UIButton clearButton = new UIButton(UIButtonType.Custom);
        clearButton.setBackgroundColor(UIColor.clear());
        clearButton.addOnTouchUpInsideListener(inviteFriendsButtonAction);
        clearButton.setFrame(headerView.getFrame());
        headerView.addSubview(clearButton);
        String inviteString = "Invite friends";
        CGRect boundingRect = NSString.getBoundingRect(inviteString, new CGSize(310, Float.MAX_VALUE),
                NSStringDrawingOptions.with(NSStringDrawingOptions.TruncatesLastVisibleLine,
                        NSStringDrawingOptions.UsesLineFragmentOrigin),
                new NSAttributedStringAttributes().setFont(UIFont.getBoldSystemFont(18)), null);
        CGSize inviteStringSize = boundingRect.getSize();

        UILabel inviteLabel = new UILabel(new CGRect(10,
                (headerView.getFrame().getSize().getHeight() - inviteStringSize.getHeight()) / 2,
                inviteStringSize.getWidth(), inviteStringSize.getHeight()));
        inviteLabel.setText(inviteString);
        inviteLabel.setFont(UIFont.getBoldSystemFont(18));
        inviteLabel.setTextColor(UIColor.white());
        inviteLabel.setBackgroundColor(UIColor.clear());
        headerView.addSubview(inviteLabel);
        getTableView().setTableHeaderView(headerView);
    }
}
 
开发者ID:robovm,项目名称:robovm-samples,代码行数:49,代码来源:PAPFindFriendsViewController.java

示例4: viewDidLoad

import org.robovm.apple.coregraphics.CGRect; //导入方法依赖的package包/类
@Override
public void viewDidLoad() {
    super.viewDidLoad();

    frontViewIsVisible = true;
    CGSize preferredAtomicElementViewSize = AtomicElementView.getPreferredViewSize();
    CGRect viewRect = new CGRect(
            (getView().getBounds().getWidth() - preferredAtomicElementViewSize.getWidth()) / 2,
            (getView().getBounds().getHeight() - preferredAtomicElementViewSize.getHeight()) / 2 - 40,
            preferredAtomicElementViewSize.getWidth(), preferredAtomicElementViewSize.getHeight());
    // create the atomic element view
    atomicElementView = new AtomicElementView(viewRect);

    // add the atomic element view to the view controller's view
    atomicElementView.setElement(element);
    getView().addSubview(atomicElementView);
    atomicElementView.setViewController(this);

    // create the atomic element flipped view
    atomicElementFlippedView = new AtomicElementFlippedView(viewRect);
    atomicElementFlippedView.setElement(element);
    atomicElementFlippedView.setViewController(this);

    // create the reflection view
    CGRect reflectionRect = new CGRect(viewRect.getOrigin(), viewRect.getSize());

    // the reflection is a fraction of the size of the view being reflected
    reflectionRect.getSize().setHeight(reflectionRect.getHeight() * REFLECTION_FRACTION);
    // and is offset to be at the bottom of the view being reflected
    reflectionRect = reflectionRect.offset(0, viewRect.getHeight());
    reflectionView = new UIImageView(reflectionRect);

    // determine the size of the reflection to create
    int reflectionHeight = (int) (atomicElementView.getBounds().getHeight() * REFLECTION_FRACTION);

    // create the reflection image, assign it to the UIImageView and add the
    // image view to the view controller's view
    reflectionView.setImage(atomicElementView.getReflectedImageRepresentation(reflectionHeight));
    reflectionView.setAlpha(REFLECTION_OPACITY);
    getView().addSubview(reflectionView);

    // setup our flip indicator button (placed as a nav bar item to the
    // right)
    flipIndicatorButton = new UIButton(new CGRect(0, 0, 30, 30));
    flipIndicatorButton.addOnTouchUpInsideListener(new UIControl.OnTouchUpInsideListener() {
        @Override
        public void onTouchUpInside(UIControl control, UIEvent event) {
            flipCurrentView();
        }
    });

    // front view is always visible at first
    flipIndicatorButton.setBackgroundImage(UIImage.getImage("flipper_list_blue.png"), UIControlState.Normal);
    UIBarButtonItem flipButtonBarItem = new UIBarButtonItem(flipIndicatorButton);
    getNavigationItem().setRightBarButtonItem(flipButtonBarItem, true);
}
 
开发者ID:robovm,项目名称:robovm-samples,代码行数:57,代码来源:AtomicElementViewController.java


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