2014-10-18 3 views
-3

Я создал segue от кнопки, но это дало мне следующую ошибку. Я использую Swift и Xcode 6.Добавить идентификатор для segue

/Users/dave_cooljamdesign/Desktop/XcodeDev/findaphysio2/FindaPhysio/FindaPhysio/Base.lproj/Main.storyboard: Segues initiated directly from view controllers must have an identifier 

Как я могу дать им идентификатор, когда я draging с точки зрения таблицы с точки зрения детализации?

Ниже приведен код, чтобы показать, что я делаю в контроллере представления

import UIKit 
import MapKit 

class ClinicsTableViewController: 
UITableViewController { 
var clinic = [Clinics]() 

@IBOutlet var mapView: MKMapView! 

override func viewDidLoad() { 
    super.viewDidLoad() 

    // Uncomment the following line to preserve selection between presentations 
    // self.clearsSelectionOnViewWillAppear = false 

    // Uncomment the following line to display an Edit button in the navigation bar for this view controller. 
    // self.navigationItem.rightBarButtonItem = self.editButtonItem() 
    self.clinic = [Clinics(name:"Chocolate")] 

    self.tableView.reloadData() 

} 

override func didReceiveMemoryWarning() { 
    super.didReceiveMemoryWarning() 
    // Dispose of any resources that can be recreated. 
} 

// MARK: - Table view data source 

override func numberOfSectionsInTableView(tableView: UITableView) -> Int { 
    // #warning Potentially incomplete method implementation. 
    // Return the number of sections. 
    return 0 
} 

override func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int { 
    // #warning Incomplete method implementation. 
    // Return the number of rows in the section. 
    return self.clinic.count 
} 

    override func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell { 
     //ask for a reusable cell from the tableview, the tableview will create a new one if it doesn't have any 
    let cell = self.tableView.dequeueReusableCellWithIdentifier("findaphysioCell", forIndexPath: indexPath) as UITableViewCell 

    // Get the corresponding candy from our candies array 
    let _clinic = self.clinic[indexPath.row] 

    // Configure the cell 
    cell.textLabel!.text = _clinic.name 
    cell.accessoryType = UITableViewCellAccessoryType.DisclosureIndicator 

    return cell 
} 
} 
+0

выберите segue в раскадровке и команду + вариант + 4. – gabbler

ответ

0

В раскадровке, выберите SEGUE между двумя контроллерами зрения. Перейдите в указатель атрибутов справа и добавьте имя идентификатора.

В коде сделать что-то вроде этого:

self.performSegueWithIdentifier("setupView", sender: self) 

Очевидно изменить «setupView» с тем, что вы установили для идентификатора SEGUE.

1

Найдите segue на раскадровке (линия между контроллерами просмотра с кругом посередине) и нажмите на нее.

enter image description here

Затем откройте инспектор атрибутов в панели утилиты и дать ему идентификатор.

enter image description here

Как уже упоминалось болтун, опция Ярлык команда + + немедленно откройте инспектор атрибутов.

+0

Я должен признать, что я любящий быстрый, я был отстранен объективом c, но сделал приложение для клиента в быстром и выключенном распределении легче понять. – rogue39nin

+0

Я назвал его connor, тогда появляется следующая ошибка, когда я нажимаю на кнопку * Завершение приложения из-за неотображенного исключения «NSUnknownKeyException», причина: «[ setValue: forUndefinedKey:]: этот класс не является ключевым кодом - совместим для ключевого mapView. ' – rogue39nin

+0

Можете ли вы изменить свой вопрос, чтобы включить любой код? – user3746428