У меня есть tableView, который мне нужно, чтобы иметь возможность удалять элементы, однако, когда я вернул его из режима редактирования, imageView из моей пользовательской ячейки переключается на левая сторона. Вот некоторые соответствующие код и изображения:Пользовательский элемент изображения изображения перемещается влево при редактировании tableView
func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
var cell = tableView.dequeueReusableCellWithIdentifier("cell", forIndexPath: indexPath) as! NotificationsTableViewCell
cell.storiesLabel.text = stories[indexPath.row].name
cell.selectionStyle = UITableViewCellSelectionStyle.None
cell.shouldIndentWhileEditing = false
if stories[indexPath.row].notificationBool == true {
cell.notificationImageView.image = UIImage(named: "notifications_filled.png")
}
else {
cell.notificationImageView.image = UIImage(named: "notifications.png")
}
return cell
}
func editFollowedStoriesTableView() {
if tableView.editing == true {
tableView.setEditing(false, animated: false)
}
else {
tableView.setEditing(true, animated: false)
}
}
func tableView(tableView: UITableView, editingStyleForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCellEditingStyle {
if(self.tableView.editing){
return UITableViewCellEditingStyle.Delete
}
return UITableViewCellEditingStyle.None
}
Как я могу предотвратить вторую картину от происходящего? Любая помощь очень удобна!
Вы используете автоматическую компоновку? – Subash
Да, я. Вы хотите увидеть ограничения? –
Да. Можете ли вы опубликовать снимок экрана? – Subash