S
S
Stanislav Korolevskiy2015-12-16 12:49:29
Swift
Stanislav Korolevskiy, 2015-12-16 12:49:29

How to call UIAlertController when cell is clicked in TableView?

Good afternoon! There is a ViewController with a TableView in it. It is not possible to call UIAlertController when clicking on a cell... Please tell me what could be the reason? Method written before viewDidLoad

func tableView(tableView: UITableView, didSelectRowAtIndexPath indexPath: NSIndexPath) {
        
        //создаем алерт контроллер
        let actionMenu = UIAlertController(title: nil, message: "Что делаем?", preferredStyle: .ActionSheet)
        
        //создаем действия для контроллера
        let cancelAction = UIAlertAction(title: "Отмена", style: .Cancel, handler: nil)
        actionMenu.addAction(cancelAction)
       
        //отображаем контроллер
        self.presentViewController(actionMenu, animated: true, completion: nil)  
    }

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
An, 2015-12-16
@korolevsky_s

Perhaps didSelectRowAtIndexPath is not being called. delegate at tableView is precisely set?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question