Как переопределить один вид перехода в коде?IOS

Программируем под IOS
Anonymous
Как переопределить один вид перехода в коде?

Сообщение Anonymous »

Просто у меня есть один переход к роду show от FirstViewController к SecondViewController . Я называю его на iPad и iPhone из двух мест моего FirstViewController . Это нормально, но в одном случае мне нужно представить SecondViewController как .popover .

Код: Выделить всё

override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) {

if let secondViewController = segue.destinationViewController as? SecondViewController {

if let cell = sender as? UITableViewCell, indexPath = tableView.indexPathForCell(cell) {

let student = fetchedResultsController.objectAtIndexPath(indexPath) as! Student
secondViewController.schoolClass = schoolClass
secondViewController.student = student

} else {

secondViewController.modalPresentationStyle = .Popover
secondViewController.schoolClass = schoolClass

let popoverPresentationController = studentFormViewController.popoverPresentationController
popoverPresentationController!.delegate = self
popoverPresentationController?.permittedArrowDirections = .Up
popoverPresentationController?.barButtonItem = addStudentBarButtonItem
}
}
}
Это не работает.>

Подробнее здесь: https://stackoverflow.com/questions/378 ... ue-in-code

Вернуться в «IOS»