TableView Functions Missing Items

Only two rows of 12 items are displayed vertically in the first section or first column from myarray.

The functions should display 6 Sections or Columns by 180 rows.from myarray.

Exp.


myarray = [180]


func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {

// Displays 1st 12 headers or 1at 12 details vertically

return L // 180 for a previous array build

//return 1 Displays same number

// return myarray.count Always zero

} // end section

func numberOfSections(in tableView: UITableView) -> Int {

return 6 // 6 Sections or Columns, Displays one section vertically, 12 items

} // end sections

func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {

let cell = tableView.dequeueReusableCell(withIdentifier: "customcell", for: indexPath) as UITableViewCell

// Displays the 1st two rows in the first section, 12 items

cell.textLabel?.text = myarray[indexPath.item]

return cell

} // end cell for row

if you write myArray = [180], array has only one element. Is it what you mean ?


How is L defined ?


You need to define numberOfRows :


func numberOfRows(in tableView: NSTableView) -> Int {
    
}


and numberOfRows in section


func tableView(tableView:UITableView!, numberOfRowsInSection section: Int) -> Int {
     
}

***Use of undeclared type 'ProducLine***

exp.

var productLines: [ProductLine] {

return ProductLine.productLines()

}

.

func numberOfSections(in tableView: UITableView) -> Int {

return productLines.count

} // end sections

func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {

let productline = productLines[section]

return productLines.products.count

} // end section

func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {

let cell = tableView.dequeueReusableCell(withIdentifier: "customcell", for: indexPath) as UITableViewCell

let productLine = productLines[indexPath.section]

let product = productLine.products[indexPath.row]

cell.textLabel?.text = myarray[indexPath.item]

return cell

} // end cell row and section

What do you want to explain in this post ? Is "***Use of undeclared type 'ProducLine***" the problem you get ?

I'm looking for a sample TableView that will dump a One Demential Array (myArray) breaking every 6 sections or columns..

The previous sample is more that what I need. The first sample is what I'm using. The table view is displaying data but the data is going down the left side of the tableView. The data should go across the tableView for 6 sections or columns and begin another row for 6 sections or columns.

I need to use CollectionsView instead of TableView

TableView Functions Missing Items
 
 
Q