【发布时间】:2016-03-04 13:20:27
【问题描述】:
你好,我已经像这样在我的静态 TableView 上动态创建了按钮
override func tableView(tableView: UITableView, viewForFooterInSection section: Int) -> UIView? {
let footerView = UIView(frame: CGRectMake(0, 0, tableView.frame.size.width, tableView.frame.size.height))
let button = UIButton(type: UIButtonType.System) as UIButton
button.frame = CGRectMake(0, 0, 414, 65)
button.setTitle(buttonTitle, forState: UIControlState.Normal)
button.addTarget(self, action:buttonAction, forControlEvents: UIControlEvents.TouchUpInside)
button.setTitleColor(UIColor.whiteColor(), forState:UIControlState.Normal)
button.titleLabel?.font = UIFont(name: Variables.MONTESERRAT_REGULAR, size: 20.0)
button.backgroundColor = UIColor().blueColor() //top
footerView.addSubview(button!)
return footerView
}
我想在单击按钮时在按钮顶部显示微调器。我知道如何制作点击功能或如何创建微调器。我只是不知道如何将微调器放在按钮顶部代替标题,以便当用户单击按钮时,标题隐藏并且微调器在标题位置移动。我希望你明白我在说什么
【问题讨论】:
-
将微调器添加为按钮的子视图。将微调器的中心设置为 button.center 和:[button addSubview:yourspinner];
标签: ios swift uibutton uiactivityindicatorview