-1
ボタンをクリックしたときにテーブルビューに移動するプロジェクトを設計しています。ここでXcode UIBable to UITableView to connect
は、ストーリーボードの写真です:ここでStoryboard
は、ボタンとビューのコードです:
import UIKit
class CartTableViewController: UITableViewController {
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.
}
// MARK: - Table view data source
override func numberOfSections(in tableView: UITableView) -> Int {
return 1
}
override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return 0
}
:
import UIKit
import os.log
class MealViewController: UIViewController, UITextFieldDelegate, UIImagePickerControllerDelegate, UINavigationControllerDelegate {
//MARK: Properties
@IBOutlet weak var nameLabel: UILabel!
@IBOutlet weak var priceLabel: UILabel!
@IBOutlet weak var photoImageView: UIImageView!
@IBOutlet weak var ratingControl: RatingControl!
@IBOutlet weak var caloriesLabel: UILabel!
@IBOutlet weak var descriptionLabel: UILabel!
@IBAction func addToCart(_ sender: UIButton) {
}
、ここでは、テーブルビューのコードであります私はそれをどのように実行すると、それは空白のテーブルを開きます。 numberOfRowsInSectionを変更すると、sigabrtエラーが発生します。どのようにしてビューを定期的に開くだけですか?