コード例 #1
0
  @Override
  public void layoutSubviews() {
    super.layoutSubviews();

    CGRect bounds = getBounds();
    CGRect frame = name.getFrame();

    frame.setWidth(bounds.getWidth() - (PRICE_WIDTH + PADDING * 2));
    frame.setX(PADDING);
    frame.setY(PADDING);
    name.setFrame(frame);

    frame = price.getFrame();
    frame.setY(PADDING + (name.getFrame().getHeight() - frame.getHeight()) / 2);
    frame.setX(name.getFrame().getX() + name.getFrame().getWidth() + PADDING);
    frame.setWidth(PRICE_WIDTH);
    price.setFrame(frame);

    frame = bounds;
    frame.setY(name.getFrame().getY() + name.getFrame().getHeight());
    frame.setX(PADDING);
    frame.setWidth(frame.getWidth() - PADDING * 2);
    frame.setHeight(frame.getHeight() - frame.getY());
    descriptionLabel.setFrame(frame);
  }
  @Override
  public void viewDidLayoutSubviews() {
    super.viewDidLayoutSubviews();

    CGRect bounds = getView().getBounds();
    bounds.setY(bounds.getY() + bounds.getHeight() - BottomButtonView.HEIGHT);
    bounds.setHeight(BottomButtonView.HEIGHT);
    bottomView.setFrame(bounds);
  }