私はいくつかのセクションヘッダーをタップした後、セクション内の行数を表示するにはどうすればいいですか?
が含まれているのtableViewを持っているが、私はそれが唯一のセクションヘッダーを表示したいと私はセクションヘッダをタップするときには、そのセクションのみをcontining、すべての従業員の詳細が表示されます。以下は
私のコードです:
func numberOfSectionsInTableView(tableView: UITableView) -> Int {
return company.count
}
func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return company[section].employees!.count
}
func tableView(tableView: UITableView, titleForHeaderInSection section: Int) -> String? {
if company[section].employees!.count < 1 {
return nil
}
return company[section].companyName
}
func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCellWithIdentifier("cell") as! EmployeeTableViewCell
let employeeDetails = company[indexPath.section].employees!.allObjects as! [Employees]
cell.lblName.text = employeeDetails[indexPath.row].employeeName
cell.lblAddress.text = String(employeeDetails[indexPath.row].address!)
cell.lblAge.text = String(employeeDetails[indexPath.row].age!)
return cell
}
ありがとう!
私はこのようにmySelected配列を宣言しています:var selectedArray:NSMutableArray! (selectedArray.containsObject(sender.tag)){ –
このような配列を宣言します。var selectedArray:NSMutableArray = [] –
@ S.Bharti selectedSectionStoredButtonClickedチェックに1行追加しました。この行のセクションヘッダーをタップするとクラッシュします。それ。あなたがコメントアウトする場合は、他のセクションよりも行が隠れるようになります –