本文整理汇总了Java中org.robovm.apple.uikit.UIView.animate方法的典型用法代码示例。如果您正苦于以下问题:Java UIView.animate方法的具体用法?Java UIView.animate怎么用?Java UIView.animate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.robovm.apple.uikit.UIView
的用法示例。
在下文中一共展示了UIView.animate方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: didPressButton
import org.robovm.apple.uikit.UIView; //导入方法依赖的package包/类
@Method(selector = "didPressButton")
public void didPressButton() {
UILabel textLabel = (UILabel) UIViewLayoutUtil.findViewById(getView(), "text");
if(textLabel.getText().equals("Short text")) {
textLabel.setText("Very long long text");
} else {
textLabel.setText("Short text");
}
UIView.animate(0.2, new Runnable() {
@Override
public void run() {
getView().layoutIfNeeded();
}
});
}
示例2: didLoadObjects
import org.robovm.apple.uikit.UIView; //导入方法依赖的package包/类
@Override
public void didLoadObjects(NSError error) {
super.didLoadObjects(error);
if (getObjects().size() == 0 && !getQuery().hasCachedResult() && !firstLaunch) {
getTableView().setScrollEnabled(false);
if (blankTimelineView.getSuperview() == null) {
blankTimelineView.setAlpha(0);
getTableView().setTableHeaderView(blankTimelineView);
UIView.animate(0.2, new Runnable() {
@Override
public void run() {
blankTimelineView.setAlpha(1);
}
});
}
} else {
getTableView().setTableHeaderView(null);
getTableView().setScrollEnabled(true);
}
}
示例3: updateView
import org.robovm.apple.uikit.UIView; //导入方法依赖的package包/类
private void updateView(final CLLocation location) {
// We animate transition from one position to the next, this makes the
// dot move smoothly over the map
UIView.animate(0.75, new Runnable() {
@Override
public void run() {
// Call the converter to find these coordinates on our
// floorplan.
CGPoint pointOnImage = coordinateConverter.getPointFromCoordinate(location.getCoordinate());
// These coordinates need to be scaled based on how much the
// image has been scaled
CGPoint scaledPoint = new CGPoint(pointOnImage.getX() * displayScale + displayOffset.getX(),
pointOnImage.getY()
* displayScale + displayOffset.getY());
// Calculate and set the size of the radius
double radiusFrameSize = location.getHorizontalAccuracy() * coordinateConverter.getPixelsPerMeter() * 2;
radiusView.setFrame(new CGRect(0, 0, radiusFrameSize, radiusFrameSize));
// Move the pin and radius to the user's location
pinView.setCenter(scaledPoint);
radiusView.setCenter(scaledPoint);
}
});
}
示例4: doneAction
import org.robovm.apple.uikit.UIView; //导入方法依赖的package包/类
/**
* User chose to finish using the UIDatePicker by pressing the "Done" button
* (used only for "non-inline" date picker, iOS 6.1.x or earlier)
*
* @param control
*/
@IBAction
private void doneAction(UIBarButtonItem sender) {
final CGRect pickerFrame = pickerView.getFrame();
pickerFrame.getOrigin().setY(getView().getFrame().getHeight());
// animate the date picker out of view
UIView.animate(PICKER_ANIMATION_DURATION, new Runnable() {
@Override
public void run() {
pickerView.setFrame(pickerFrame);
}
}, new VoidBooleanBlock() {
@Override
public void invoke(boolean v) {
pickerView.removeFromSuperview();
}
});
// remove the "Done" button in the navigation bar
getNavigationItem().setRightBarButtonItem(null);
// deselect the current table cell
NSIndexPath indexPath = getTableView().getIndexPathForSelectedRow();
getTableView().deselectRow(indexPath, true);
}
示例5: hideUIElements
import org.robovm.apple.uikit.UIView; //导入方法依赖的package包/类
private void hideUIElements (boolean shouldHide, boolean shouldAnimate) {
final double alpha = shouldHide ? 0 : 1;
if (shouldAnimate) {
UIView.animate(2.0, 0, UIViewAnimationOptions.CurveEaseInOut, new Runnable() {
@Override
public void run () {
gameLogo.setAlpha(alpha);
archerButton.setAlpha(alpha);
warriorButton.setAlpha(alpha);
}
}, null);
} else {
gameLogo.setAlpha(alpha);
archerButton.setAlpha(alpha);
warriorButton.setAlpha(alpha);
}
}
示例6: reset
import org.robovm.apple.uikit.UIView; //导入方法依赖的package包/类
/**
* The reset method allows the user to repeatedly test the location
* functionality. In addition to discarding all of the location measurements
* from the previous "run", it animates a transition in the user interface
* between the table which displays location data and the start button and
* description label presented at launch.
*/
private void reset() {
locationMeasurements.clear();
// fade in the rest of the UI and fade out the table view
UIView.animate(0.6, new Runnable() {
@Override
public void run() {
startButton.setAlpha(1);
descriptionLabel.setAlpha(1);
tableView.setAlpha(0);
getNavigationItem().setLeftBarButtonItem(null, true);
}
}, new VoidBooleanBlock() {
@Override
public void invoke(boolean finished) {
if (finished) {
// ..
}
}
});
}
示例7: reset
import org.robovm.apple.uikit.UIView; //导入方法依赖的package包/类
/**
* The reset method allows the user to repeatedly test the location
* functionality. In addition to discarding all of the location measurements
* from the previous "run", it animates a transition in the user interface
* between the table which displays location data and the start button and
* description label presented at launch.
*/
private void reset() {
bestEffortAtLocation = null;
locationMeasurements.clear();
// fade in the rest of the UI and fade out the table view
UIView.animate(0.6, new Runnable() {
@Override
public void run() {
startButton.setAlpha(1);
descriptionLabel.setAlpha(1);
tableView.setAlpha(0);
getNavigationItem().setLeftBarButtonItem(null, true);
}
}, new VoidBooleanBlock() {
@Override
public void invoke(boolean finished) {
if (finished) {
// ..
}
}
});
}
示例8: changeCamera
import org.robovm.apple.uikit.UIView; //导入方法依赖的package包/类
private void changeCamera() {
if (imagePicker.getCameraDevice() == UIImagePickerControllerCameraDevice.Rear) {
imagePicker.setCameraDevice(UIImagePickerControllerCameraDevice.Front);
} else {
imagePicker.setCameraDevice(UIImagePickerControllerCameraDevice.Rear);
}
if (!UIImagePickerController.isFlashAvailableForCameraDevice(imagePicker.getCameraDevice())) {
UIView.animate(0.3, new Runnable() {
@Override
public void run() {
flashModeButton.setAlpha(0);
}
});
showFlashMode = false;
} else {
UIView.animate(0.3, new Runnable() {
@Override
public void run() {
flashModeButton.setAlpha(1);
}
});
showFlashMode = false;
}
}
示例9: startRecording
import org.robovm.apple.uikit.UIView; //导入方法依赖的package包/类
private void startRecording() {
UIView.animate(0.3, 0, UIViewAnimationOptions.CurveEaseInOut, new Runnable() {
@Override
public void run() {
cameraSelectionButton.setAlpha(0);
flashModeButton.setAlpha(0);
videoQualitySelectionButton.setAlpha(0);
recordIndicatorView.setAlpha(1);
}
}, new VoidBooleanBlock() {
@Override
public void invoke(boolean v) {
imagePicker.startVideoCapture();
}
});
}
示例10: removeFromSuperviewWithFade
import org.robovm.apple.uikit.UIView; //导入方法依赖的package包/类
public void removeFromSuperviewWithFade() {
UIView.animate(0.3, new Runnable() {
@Override
public void run() {
setAlpha(0);
}
}, new VoidBooleanBlock() {
@Override
public void invoke(boolean finished) {
if (finished) {
removeFromSuperview();
}
}
});
}
示例11: displayExternalDatePickerForRow
import org.robovm.apple.uikit.UIView; //导入方法依赖的package包/类
/**
* Reveals the UIDatePicker as an external slide-in view, iOS 6.1.x and
* earlier, called by "didSelectRow".
*
* @param indexPath The indexPath used to display the UIDatePicker.
*/
private void displayExternalDatePickerForRow(NSIndexPath indexPath) {
// first update the date picker's date value according to our model
CellData itemData = data.get(indexPath.getRow());
pickerView.setDate(itemData.date, true);
// the date picker might already be showing, so don't add it to our view
if (pickerView.getSuperview() == null) {
CGRect startFrame = pickerView.getFrame();
final CGRect endFrame = pickerView.getFrame();
// the start position is below the bottom of the visible frame
startFrame.getOrigin().setY(getView().getFrame().getHeight());
// the end position is slid up by the height of the view
endFrame.getOrigin().setY(startFrame.getOrigin().getY() - endFrame.getHeight());
pickerView.setFrame(startFrame);
getView().addSubview(pickerView);
// animate the date picker into view
UIView.animate(PICKER_ANIMATION_DURATION, new Runnable() {
@Override
public void run() {
pickerView.setFrame(endFrame);
}
}, new VoidBooleanBlock() {
@Override
public void invoke(boolean v) {
// add the "Done" button to the nav bar
getNavigationItem().setRightBarButtonItem(doneButton);
}
});
}
}
示例12: increaseRating
import org.robovm.apple.uikit.UIView; //导入方法依赖的package包/类
@IBAction
private void increaseRating() {
if (++this.rating > 5) {
this.rating = 5;
return;
}
UIImageView icon = new UIImageView(UIImage.getImage("icon.png"));
icon.setContentMode(UIViewContentMode.ScaleAspectFit);
this.ratingsStack.addArrangedSubview(icon);
UIView.animate(0.25, () -> this.ratingsStack.layoutIfNeeded());
}
示例13: decreaseRating
import org.robovm.apple.uikit.UIView; //导入方法依赖的package包/类
@IBAction
private void decreaseRating() {
if (--this.rating < 0) {
this.rating = 0;
return;
}
NSArray<UIView> icons = this.ratingsStack.getArrangedSubviews();
UIView lastIcon = icons.get(icons.size() - 1);
this.ratingsStack.removeArrangedSubview(lastIcon);
lastIcon.removeFromSuperview();
UIView.animate(0.5, () -> this.ratingsStack.layoutIfNeeded());
}
示例14: handleKeyboardNotification
import org.robovm.apple.uikit.UIView; //导入方法依赖的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);
}
示例15: animateFirstTouch
import org.robovm.apple.uikit.UIView; //导入方法依赖的package包/类
/**
* "Pulse" the placard view by scaling up then down, then move the placard
* to under the finger.
*/
private void animateFirstTouch(final CGPoint touchPoint) {
/*
* Create two separate animations. The first animation is for the grow
* and partial shrink. The grow animation is performed in a block. The
* method uses a completion block that itself includes an animation
* block to perform the shrink. The second animation lasts for the total
* duration of the grow and shrink animations and contains a block
* responsible for performing the move.
*/
UIView.animate(GROW_ANIMATION_DURATION_SECONDS, new Runnable() {
@Override
public void run() {
CGAffineTransform transform = CGAffineTransform.createScale(GROW_FACTOR, GROW_FACTOR);
placardView.setTransform(transform);
}
}, new VoidBooleanBlock() {
@Override
public void invoke(boolean finished) {
UIView.animate(SHRINK_ANIMATION_DURATION_SECONDS, new Runnable() {
@Override
public void run() {
placardView.setTransform(CGAffineTransform.createScale(SHRINK_FACTOR, SHRINK_FACTOR));
}
});
}
});
UIView.animate(GROW_ANIMATION_DURATION_SECONDS + SHRINK_ANIMATION_DURATION_SECONDS, new Runnable() {
@Override
public void run() {
placardView.setCenter(touchPoint);
}
});
}