有没有办法增加间距UITableViewCell?
我创建了一个表,每个单元格只包含一个图像.图像被分配给单元格,如下所示:
cell.imageView.image = [myImages objectAtIndex:indexPath.row];
Run Code Online (Sandbox Code Playgroud)
但这会使图像放大并适合整个单元格,图像之间没有间距.
或者以这种方式说,图像的高度例如是50,并且我想在图像之间添加20个间隔.有没有办法实现这个目标?
我目前在同一uitableview上显示两种不同类型的自定义单元格时遇到问题。
到目前为止,我管理的工作是接收对更新单元格的“更新” cell。我只是无法弄清楚如何也让numberOfRowsInSection返回两个值,所以我的两个单元格都将显示。
让我解释一下我的代码:
override func numberOfSectionsInTableView(tableView: UITableView) -> Int {
return 1
}
override func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return updates.count
return updatesTask.count // I CANNOT DO THIS - what can I do instead?
}
override func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
let cell:updateTableViewCell = tableView.dequeueReusableCellWithIdentifier("Cell", forIndexPath: indexPath) as! updateTableViewCell
let cellTask:tasksTableViewCell = tableView.dequeueReusableCellWithIdentifier("TaskCell", forIndexPath: indexPath) as! tasksTableViewCell
let update = updates[indexPath.row]
let updateTask = updatesTask[indexPath.row]
// Example of the two …Run Code Online (Sandbox Code Playgroud)