@Override public void viewWillAppear(boolean animated) { super.viewWillAppear(animated); getNavigationItem().setRightBarButtonItem(StoreApp.getInstance().createBasketButton()); imageView.animate(); NSIndexPath bottomRow = NSIndexPath.row(getTableView().getNumberOfRowsInSection(0) - 1, 0); getTableView().scrollToRow(bottomRow, UITableViewScrollPosition.Top, false); }
private void addToBasket() { UINavigationController navigation = getNavigationController(); CGPoint center = bottomView .getButton() .convertPointToView( bottomView.getButton().getImageView().getCenter(), navigation.getView()); UIImageView imageView = new UIImageView(tshirtIcon); imageView.setCenter(center); imageView.setContentMode(UIViewContentMode.ScaleAspectFill); UIImageView backgroundView = new UIImageView(UIImage.getImage("circle")); backgroundView.setCenter(center); navigation.getView().addSubviews(backgroundView, imageView); UIView targetView = (UIView) getNavigationItem().getRightBarButtonItem().getKeyValueCoder().getValue("view"); CGPoint targetPosition = new CGPoint( targetView.getCenter().getX() + targetView.getFrame().getWidth() / 3, targetView.getCenter().getY() + targetView.getFrame().getHeight() / 2); animateView(imageView, targetPosition, null); animateView( backgroundView, targetPosition, () -> { getNavigationItem().setRightBarButtonItem(StoreApp.getInstance().createBasketButton()); }); if (addedToBasket != null) { addedToBasket.invoke(new Order(order)); } }