ios - How to hide Navigation and Status Bars when tapped - with animation -
i'm trying hide status bar , navigation bar when view tapped. found works previous question, problem there no animation when hiding bars. disappears.
here current code in view controller:
override func viewdidload() { super.viewdidload() self.navigationcontroller?.hidesbarsontap = true } override func prefersstatusbarhidden() -> bool { if self.navigationcontroller?.navigationbarhidden == true { return true } else { return false } }
when tap again, animation works when 2 bars coming on screen.
if don't include overrided prefersstatusbarhidden
function, can navigation bar hide desired sliding animation. status bar still there.
any suggestions? swift 2 have new method can work?
try
var statusbarhidden = false func tapaction() { self.navigationcontroller?.navigationbarhidden = true self.statusbarhidden = true self.setneedsstatusbarappearanceupdate() } override func prefersstatusbarhidden() -> bool { return statusbarhidden }
Comments
Post a Comment