テーブルビューとナビゲーションコントローラを使用してリストの基本CRUD操作を設定しています。最初のテーブルビューでプラスボタンをクリックすると、セグを使用して次のテーブルビューをモーダルに表示し、テーブルセルにあるテキストフィールドのリストにアイテムを追加できます。Nav Controllerを搭載したXcode Table View Controllerでテーブルセルが表示されず、セルからデータが処理されています
これまでのように、プラスボタンをクリックすると右のページに移動し、ナビゲーションバーボタンがそのページで機能します。完了をクリックすると、私がストーリーボードに入力したtextFieldのテキストがリストに追加され、どこかにあることがわかります。私は自動レイアウトを設定して、問題ではないはずです。テーブルのセルを覆うもの(すべて濃い灰色)があるように見えますが、それが何であるかわかりません。
this image shows the storyboards, the last board is the one I having trouble with
コード2番目のビューのための:第二ファイルの
class MissionDetailsTableViewController: UITableViewController {
@IBAction func cancelBarButtonPressed(sender: UIBarButtonItem) {
cancelButtonDelegate?.cancelButtonPressedFrom(self)
}
@IBAction func doneBarButtonPressed(sender: UIBarButtonItem) {
delegate?.missionDetailsViewController(self, didFinishAddingMission: newMissionTextField.text!)
}
@IBOutlet weak var newMissionTextField: UITextField!
weak var cancelButtonDelegate: CancelButtonDelegate?
weak var delegate: MissionDetailsViewControllerDelegate?
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()
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
プロトコル:
protocol CancelButtonDelegate: class {
func cancelButtonPressedFrom(controller: UIViewController)
}
明確化のために以下のイメージを見ますprotocol MissionDetailsViewControllerDelegate: class {
func missionDetailsViewController(controller: MissionDetailsTableViewController, didFinishAddingMission mission: String)
}
2番目のtableViewのコードを表示する – Tim