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.
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.
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
Core Data Background Context Best Practice
Using Multiple Storyboards in iOS
Using Iskindofclass with Swift
iOS - Calling App Delegate Method from Viewcontroller
Uisearchbar Increases Navigation Bar Height in iOS 11
Toggling Privacy Settings Will Kill the App
Why Is Main Window of Type Double Optional
Passing Image to Another View Controller (Swift)
How to Create a Uiview Bounce Animation
How to Create IPA in Xcode 6 Without Apple Developer Account
How to Create a Circular Progress Indicator for a Count Down Timer
How to Create a Delay in Swift
Module Compiled with Swift 5.1 Cannot Be Imported by the Swift 5.1.2 Compiler
Add Bottom Border Line to UI Textfield View in Swiftui/Swift/Objective-C/Xamarin
Resize Uiimage to 200X200Pt/Px
Uipopoverpresentationcontroller on iPhone Doesn't Produce Popover