スライダとUITableViewを使用してタイムテーブルアプリケーションを作成しようとしていますが、SIGABRTエラーが発生します。私はすべてのアウトレットとアクションを再リンクするだけでなく、最初からやり直そうとしましたが、それでも動作しないようです。SIGABRTエラーを解決できません - UITableViewを使用したタイムテーブルアプリケーション
が、私はここに正しくフォーマットでそれを貼り付けることはできませんので、私はpastebin.comの上に置く
デバッグコード:http://pastebin.com/cBaALXWq
ViewController.swift
import UIKit
class ViewController: UIViewController, UITableViewDelegate {
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view, typically from a nib.
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
@IBOutlet weak var sliderValue: UISlider!
func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return 50
}
@IBAction func sliderMoved(sender: AnyObject) {
var timesTableIndex: Int = Int(sender.value)!
func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
let cell = UITableViewCell(style: UITableViewCellStyle.Default, reuseIdentifier: "Cell")
cell.textLabel?.text = String(timesTableIndex*indexPath.row+1)
return cell
}
}
}
AppDelegate.swift。あなたは@IBActionメソッド内cellForRowAtIndex:
を追加しましたように私に見えるライン4
import UIKit
@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {
EDIT
@IBOutlet weak var sliderValue: UISlider!
var timesTableIndex: Int?
func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return 50
}
@IBAction func sliderMoved(sender: AnyObject) {
timesTableIndex = Int(sliderValue.value * 50)
}
}
func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
let cell = UITableViewCell(style: UITableViewCellStyle.Default, reuseIdentifier: "Cell")
cell.textLabel.text = String(timesTableIndex*(1+indexPath.row))
return cell
}
更新後も同じ問題が発生していますか?ストーリーボードでUITableviewを作成しましたか?私はIBOutletまたはプログラムでテーブルビュー – HardikDG