当我在viewController中默认添加tableView时,tableView会滚动,但我希望它是静态的.可能吗?
这是我的代码:
func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int
{
return names.count
}
func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell
{
let cell = tableview.dequeueReusableCellWithIdentifier("cell") as! TableViewCell
cell.username.text = names[indexPath.row]
return cell
}
func numberOfSectionsInTableView(tableView: UITableView) -> Int
{
return 1
}
func tableView(tableView: UITableView, heightForRowAtIndexPath indexPath: NSIndexPath) -> CGFloat
{
return 50.0
}
Run Code Online (Sandbox Code Playgroud) 我有一个xib文件,有一个简单的活动指示器,我想垂直和水平居中.在xcode中,我可以将它集中在w:compact h:compact但是当我在设备上运行时它不是中心并且有偏移量.我已经搜索了有关于约束或禁用自动布局的建议,但是当我执行这些操作时,我的活动指示器不再显示在视图中.
如果你能帮助我,我将不胜感激.谢谢