Static Table View Outside Uitableviewcontroller

How to use a static UITableView inside a UIViewController?

You are using a UITableView with Prototype Cells which is visible because in the grey area it's written "Prototype Content".

Change to Static Cells in the Table View inspector (on the right of the window) after selecting the TableView in Interface Builder.

TableView inspector
Change to Static Cells

iOS UITableViewController static tableView does not scroll

Finally, after more than 3 days of daily debugging, I found out the problem ...

This is definitely the trickiest bug I've ever encountered, but it seems that Cocoapods power comes with responsibility. I've imported the following library:

https://github.com/shaps80/iMessageStyleReveal

And unfortunately the library itself breaks the table view scroll. When I debugged the actuals views, it was even more hard to notice the added gesture recognizer of the library, as it had a common name and cancelTouchesInView set to FALSE. The actual problem was inside the extension, where the UITableView methods were overriden.

Removed it and everything works again. Phew.

Want to create a cool static UI but : Static table views are only valid...

Add a UITableViewController to your view. It should hold a UITableView. Define this as a static table view, and make it grouped. Add two sections. One with one row, and the other with two rows. Add your Labels buttons and sliders to the rows again.

I do not know why you would want to have two UITableViews here?

Swift - Create a UITableViewController with one static cell at the top and the rest be dynamic cells?

Don't use Static Cells. Choose Dynamic Prototypes in your table view and create 2 prototype cells.

Sample Image

And return first cell in first section, other cells in second section

override func numberOfSections(in tableView: UITableView) -> Int {
return 2
}
override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
if section == 0 {
return 1
} else if section == 1 {
return sortedSongs.count
} else if section == 2 {
return anotherArrayCount
}
return 0
}
override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
if indexPath.section == 0 {
let cell = tableView.dequeueReusableCell(withIdentifier: "FirstCell", for: indexPath) as! FirstCell
return cell
} else {
let cell = tableView.dequeueReusableCell(withIdentifier: "RecentCell", for: indexPath) as! RecentCell
//cell.songTitle.text = albumList[indexPath.row]
//cell.songArtist.text = artistList[indexPath.row]
//cell.songImage.image = imageList[indexPath.row]
return cell
}
}


Related Topics



Leave a reply



Submit