0
:認識されていないセレクタは インスタンス0x7feaa273c520' *まずスローコールスタックに送られました----------エラー:2016-07-31 11:16:36.116 t6_TableDemo [900:25064] - [UIView tableView:numberOfRowsInSection :]:16:未認識セレクタインスタンスに0x7feaa273c520 2016年7月31日11に送ら「 - [UIViewの のtableView:キャッチされない例外により 'NSInvalidArgumentException'、理由にアプリを終了25064] *:36.326 t6_TableDemo [900 numberOfRowsInSection。 ]:(swiftでデバッグ:codでエラーが見つかりません
、コードは次のとおりです。
{
//
// ViewController.swift
// t6_TableDemo
//
// Created by dvd shd on 7/29/16.
// Copyright © 2016 zohur. All rights reserved.
//
import UIKit
class ViewController: UIViewController,UITableViewDataSource {
let devcourses=[("ios App","simon All"),("ios 8","Biotifull"),("Win 7"," it is good"), ("Windows 8","is a bad"), ("Linux 7","is better"), ("ios 9","verry very Good"),("Xcode 7","it is better")]
let webcourses=[("rghamsar","akhavan"),("azmadar","bakhshali"),("rezapedar","shokrollahzadeh"), ("mohammadhoseinfarzand","shokrollahzadeh"), ("zhkhahar","shokrollahzadeh"), ("pakhahar","shokrollahzadeh"),("khodam","it is better")]
func numberOfSectionsInTableView(tableView: UITableView) -> Int {
return 2
}
func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
if section == 0 {
return devcourses.count
} else
{
return webcourses.count
}
}
func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
var cell = tableView.dequeueReusableCellWithIdentifier("cell", forIndexPath: indexPath)as UITableViewCell
if indexPath.section == 0 {
let (courseTitle,courseAuthor)=devcourses[indexPath.row]
cell.textLabel?.text=courseTitle
cell.detailTextLabel?.text = courseAuthor
}
else {
let (courseTitle,courseAuthor)=webcourses[indexPath.row]
cell.textLabel?.text=courseAuthor
cell.detailTextLabel?.text=courseTitle
}
// Retrieve in image
var myImage = UIImage(named: "CellIcon")
cell.imageView?.image=myImage
return cell
}
func tableView(tableView: UITableView, titleForHeaderInSection section: Int) -> String? {
if section == 0 {
return "Developer Courses"
} else
{
return "Web Courses"
}
}
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.
}
}
}