I'm currently having an issue. I'm creating a game and I want to be able to use a UITableView to show data (Like levels). However, I'm using strictly SpriteKit and can't seem to get the UITableView and SpritKit to work.
I tried creating a variable in my 'GameScene' class (which is an SKScene) called 'gameTableView' and its value set to a class I made called 'GameRoomTableView'.
var gameTableView = GameRoomTableView()
The class had the value of 'UITableView' (notice that I did not set it to UITableViewController).
class GameRoomTableView: UITableView {
}
I was able to add the tableView as a subview of my SKView. I did this in my 'DidMoveToView' function that's inside my GameScene class. In which got the view to show.
self.scene?.view?.addSubview(gameRoomTableView)
However, I do not know how to change things like the number of sections and how to add cells.The class won't let me access those type of things unless it's a viewController and with that I'd need an actual ViewController to get it to work. I've seen many games use tableViews but I'm not sure how they got it to work, haha.
Please don't hesitate to tell me what I'm doing wrong and if you know of a better way of going about this. Let me know if you have any questions.
UITableView
to aSpriteKitScene
, but are you sure you can't just make the class conform to theUITableViewDelegate
andUITableViewDataSource
? I'm not saying this WILL work, but I wrote some example code where I did just that and it doesn't show any errors