테이블보기에 128 개의 셀을 표시하려고합니다. 그러나 어떤 이유로 테이블보기는 최대 5 개의 셀을 표시합니다. 코드에서 반환 한 행 수를 확인한 결과 5보다 큽니다. 따라서 해당 부분이 맞을 것이라고 확신합니다. 또한, 사용자 지정 셀에 대한 코드를 작성했습니다. 이것이이 행동에 기여합니까? 그렇다면 어떻게해야합니까? 그렇지 않다면 내가 뭘 잘못하고 있니? */테이블보기는 제한된 수의 셀을 표시합니까?
import Foundation
import UIKit
import CoreLocation
class TableViewController: UITableViewController{
var rowNumber: String!
override func viewDidLoad() {
super.viewDidLoad()
//println("Count is : \(dataArray.count)")
// 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.
}
override func numberOfSectionsInTableView(tableView: UITableView!) -> Int {
return 1;
}
override func tableView(tableView: UITableView!, numberOfRowsInSection section: Int) -> Int {
//println("Here Count is : \(dataArray.count)")
return dataArray.count
}
override func tableView(tableView: UITableView!, cellForRowAtIndexPath indexPath: NSIndexPath!) -> UITableViewCell! {
let cellId = "cell"
var cell = tableView.dequeueReusableCellWithIdentifier(cellId) as? myCustomCell
//UITableViewCell
if nil==cell {
cell = myCustomCell(reuseIdentifier: cellId)
}
if let ip = indexPath{
var dict: NSDictionary! = dataArray.objectAtIndex(indexPath.row) as NSDictionary
cell!.myTitle.text = dict.objectForKey("name") as String
}
return cell
}
override func tableView(tableView: UITableView!, didSelectRowAtIndexPath: NSIndexPath){
//println("Clicked \(didSelectRowAtIndexPath.row)")
}
override func prepareForSegue(segue: UIStoryboardSegue!, sender: AnyObject!) {
if(segue.identifier == "centerDetails"){
var svc = segue!.destinationViewController as CellClickController
var selectIndex = self.tableView.indexPathForCell(sender as UITableViewCell)
svc.cellIdx = selectIndex.row
}
}
}
감사 테이블 뷰
/* Custom cell code */
class myCustomCell: UITableViewCell{
@IBOutlet var myTitle: UILabel!
@IBOutlet var mySubtitle: UILabel!
convenience required init(reuseIdentifier: String!){
self.init(style: UITableViewCellStyle.Value1, reuseIdentifier: reuseIdentifier)
}
}
은/* 코드!
'tableView (numberOfRowsInSection)'의'println' 결과는 무엇입니까? –