这是我用来将按钮居中到屏幕底部的代码:
CGFloat centro = self.view.center.x;
CGFloat bottom = CGRectGetMaxY(self.view.frame);
_sendButton.center = CGPointMake(centro, bottom);但是,按钮的实际中心被设置在屏幕的底部,它覆盖了按钮的一半。如何将其设置为按钮上的最低点设置为:
CGPointMake(centro,bottom)而不是?
发布于 2018-01-02 07:34:50
你需要减去按钮高度的一半:
CGFloat centro = self.view.center.x;
CGFloat bottom = CGRectGetMaxY(self.view.frame) - _sendButton.frame.size.height / 2.0;
_sendButton.center = CGPointMake(centro, bottom);https://stackoverflow.com/questions/48054093
复制相似问题