Tengo la siguiente UITableView
Me gustaria poder agregarle espacios entre cada celda
Mi codigo Swift
// MARK: - Table view data source
func numberOfSections(in tableView: UITableView) -> Int {
return 6
}
func tableView(_ tableView: UITableView, heightForHeaderInSection section: Int) -> CGFloat {
switch (section)
{
case 0:
return 1
case 1:
return 1
case 2:
return 0
default:
return 0
}
}
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
var numberOfRows : Int
switch (section)
{
case 1:
numberOfRows = 6
break
case 2:
numberOfRows = 0
break
default:
numberOfRows = 0
break
}
return numberOfRows
}
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let mainCell = Bundle.main.loadNibNamed("MenuOptionsTableViewCell", owner: self, options: nil)?.first as! MenuOptionsTableViewCell
mainCell.selectionStyle = .none
mainCell.backgroundColor = Utils.Color.COLOR_E8E8E8
mainCell.strLblTitleOptionsMenu.textColor = Utils.Color.COLOR_2B5034
switch (indexPath.section)
{
case 1:
if (indexPath.row == 0)
{
mainCell.strLblTitleOptionsMenu.text=NSLocalizedString("strLblOption1",comment:"")
mainCell.imgOptionsMenu.image = UIImage.init(named:"PagarMenu")
return mainCell
}
else if(indexPath.row == 1)
{
mainCell.strLblTitleOptionsMenu.text = NSLocalizedString("strLblOption2",comment:"")
mainCell.imgOptionsMenu.image = UIImage.init(named:"BillingMenu")
return mainCell
}
else if(indexPath.row == 2)
{
mainCell.strLblTitleOptionsMenu.text = NSLocalizedString("strLblOption3",comment:"")
mainCell.imgOptionsMenu.image = UIImage.init(named:"CollectionNotificationsMenu")
return mainCell
}
else if(indexPath.row == 3)
{
mainCell.strLblTitleOptionsMenu.text = NSLocalizedString("strLblOption4",comment:"")
mainCell.imgOptionsMenu.image = UIImage.init(named:"billingQueryMenu")
return mainCell
}
else if(indexPath.row == 4)
{
mainCell.strLblTitleOptionsMenu.text = NSLocalizedString("strLblOption5",comment:"")
mainCell.imgOptionsMenu.image = UIImage.init(named:"MovsBalanceMenu")
return mainCell
}
else if(indexPath.row == 5)
{
mainCell.strLblTitleOptionsMenu.text = NSLocalizedString("strLblOption6",comment:"")
mainCell.imgOptionsMenu.image = UIImage.init(named:"CashOutMenu")
return mainCell
}
break
default:
break
}
return mainCell
}
func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
return 40
}
func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
// switch (indexPath.section)
// {
// case 0:
// break
// case 1:
// if (indexPath.row == 0)
// {
// self.presenter.personalInfo()
// }
// else if(indexPath.row == 1)
// {
// self.presenter.secretQuestion()
// }
// else if(indexPath.row == 2)
// {
// self.presenter.passwordUpdate()
// }
// break
// case 2:
// if (indexPath.row == 0)
// {
// self.presenter.userLock()
// }
// else if(indexPath.row == 1)
// {
// self.presenter.unroll()
// }
// else if(indexPath.row == 2)
// {
// self.presenter.disassociate()
// }
// else if(indexPath.row == 3)
// {
// self.presenter.signOff()
// }
// break
// default:
// break
// }
tableView.deselectRow(at: indexPath, animated: true)
}
}