我有一個賽格瑞從第一個VC clubSelectionViewController
要低於clubSummaryViewController
所示的一個,但我必須單擊後退2次獲得下一個VC顯現。我究竟做錯了什麼?下一頁VC沒有顯示
import Foundation
import UIKit
class clubSelectionViewController: UIViewController, UITableViewDelegate {
var clubsForSelection = [clubObject]()
var clubForClubSummaryView = [clubObject]()
@IBAction func selectDanceClubs(sender: AnyObject) {
clubForClubSummaryView = clubDataFilter.removeStripClubsFrom(clubsForSelection)
self.performSegueWithIdentifier("ClubSummary", sender: self)
}
@IBAction func selectStripClubs(sender: AnyObject) {
clubForClubSummaryView = clubDataFilter.removeDanceClubsFrom(clubsForSelection)
self.performSegueWithIdentifier("ClubSummary", sender: self)
}
override func viewDidLoad() {
super.viewDidLoad()
// everytime screen loads it removes information to give blank screen it removes all clubs in array
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) {
if segue.identifier == "ClubSummary" {
let summaryView = segue.destinationViewController as! clubSummaryViewController
summaryView.clubDetails = [clubObject]()
summaryView.clubDetails = self.clubForClubSummaryView
}
}
}
其次VC
import UIKit
class clubSummaryViewController: UIViewController, UITableViewDelegate, UITableViewDataSource {
var clubDetails = [clubObject]()
var selectedClub = clubObject()
@IBOutlet var clubSummaryTableView: UITableView!
override func viewDidLoad() {
super.viewDidLoad()
//Declare Delegate, Load TableView
clubSummaryTableView.delegate = self
//clubSummaryTableView.dataSource = self
clubSummaryTableView.reloadData()
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
//MARK: TableViewDelegate
func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return self.clubDetails.count
}
func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
let cell = self.clubSummaryTableView.dequeueReusableCellWithIdentifier("SummaryCell")! as? clubSummaryCell
cell?.clubName.text = clubDetails[indexPath.row].clubName
cell?.clubAddress.text = clubDetails[indexPath.row].clubAddress
//TODO: insert image
cell?.clubPhoto.image = clubDetails[indexPath.row].clubImage.image
return cell!
}
func tableView(tableView: UITableView, didSelectRowAtIndexPath indexPath: NSIndexPath) {
self.selectedClub = self.clubDetails[indexPath.row]
self.performSegueWithIdentifier("ClubDetails", sender: self)
}
override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) {
if segue.identifier == "ClubDetails"{
let clubDetailsView = segue.destinationViewController as? clubInfoViewController
clubDetailsView?.clubForDetails = self.selectedClub
}
}
}
想必你有3家風險投資公司 - 的選擇,總之,細節。你問你爲什麼要按兩次'回來'從細節到選擇?或者你總結說'總結'第一次沒有做什麼,但第二次把你帶回選擇? – Michael
@邁克爾我不得不從summaryVC到selectionVC按兩次回summaryVC實際顯示一切它應該之前。 – Chris
問題已解決? –