Reputation: 359
Quick question regarding swift / xcode
I have a UIViewController with a UITableView. The UIViewController has a Navigation bar and a status bar.
My Table rows are musics that play when I tapped the row. I would like to make a second bar appear on the bottom between the Table and the Bottom Bar when a row is clicked. Like apple music app.
I've done that using hidden property.
override func viewDidLoad() {
super.viewDidLoad()
self.trackControls.hidden = true
getTrackDataJSON()
}
And when Cell is clicked:
func tableView(tableView: UITableView, didSelectRowAtIndexPath indexPath: NSIndexPath) {
let urlString = url
let url = NSURL(string: urlString)!
do {
self.trackControls.hidden = false
avPlayer = AVPlayer(URL:url)
try AVAudioSession.sharedInstance().setCategory(AVAudioSessionCategoryPlayback)
try AVAudioSession.sharedInstance().setActive(true)
}
catch {
print("error")
}
avPlayer.play()
}
Any Ideas on whow to force the table to fill up the space of the bar when the bar is hidden ? And how to get the second bar to appear sliding from the bottom?
Upvotes: 2
Views: 778
Reputation: 69459
Overlay the second bar over your table view and use content insets to make sure you can scroll all the cells from under de second bar.
Also I would suggest using a UIView
and not a UIToolBar
, the UIView
is less restrictive.
Upvotes: 1