小编Vic*_*ius的帖子

如何禁用tableView滚动?

当我在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)

ios swift

3
推荐指数
3
解决办法
5337
查看次数

在Xib文件上居中元素

我有一个xib文件,有一个简单的活动指示器,我想垂直和水平居中.在xcode中,我可以将它集中在w:compact h:compact但是当我在设备上运行时它不是中心并且有偏移量.我已经搜索了有关于约束或禁用自动布局的建议,但是当我执行这些操作时,我的活动指示器不再显示在视图中.
如果你能帮助我,我将不胜感激.谢谢

xcode objective-c xib ios

2
推荐指数
1
解决办法
1810
查看次数

标签 统计

ios ×2

objective-c ×1

swift ×1

xcode ×1

xib ×1