// button标题的偏移量
titBtn.titleEdgeInsets = UIEdgeInsetsMake(0, -titBtn.imageView.frame.size.width - titBtn.frame.size.width + titBtn.titleLabel.frame.size.width + 10 * kScaling375, 0, 0);
// button图片的偏移量
titBtn.imageEdgeInsets = UIEdgeInsetsMake(0, 0, -titBtnH/2, -titBtn.titleLabel.frame.size.width - titBtn.frame.size.width + titBtn.imageView.frame.size.width);
思路就是用数组,布局button按钮,判断屏幕宽度,设置x,y值.然后在删除和增加数组的回调里,调用布局.数据操作UI.布局UI前,要移除所有按钮
网友评论