我需要为UITableViewController“Zero”动态隐藏UINavigationBar并将其显示为UITableViewController“One”和“Two”。
最好的方法是什么?
答案 0 :(得分:1)
试试这个..
class B extends akka.actor.Actor {
def receive = {
case urlAndText: (String, String) => // do something
}
}
class A extends akka.actor.Actor {
case class Insert(url: String)
def fileUpload(content: String): String = ??? // returns the url of the uploaded content
val b = context.actorOf(Props(classOf[B]))
def receive = {
case text: String =>
Future {
fileUpload(text)
} onComplete {
case Success(url) =>
b ! Insert(url, text) // will this be
}
}
}
您可以使用viewWillDisappear将其设置为再次显示
答案 1 :(得分:0)
您可以在视图显示时设置hidden
的{{1}}属性...
UINavigationBar
只需在隐藏导航栏的视图中执行此操作
答案 2 :(得分:0)
我实现了一个方法,它在一秒钟之后隐藏了NavigationController非常流畅......我更喜欢这个而不仅仅是隐藏它;)
var navigation: UINavigationController!
override func viewDidLoad() {
navigation = navigationController!
timer = NSTimer.scheduledTimerWithTimeInterval(1.0, target: self, selector: "animate", userInfo: nil, repeats: false)
}
func animate(){
hideController(self.navigation)
}
func hideController(navigationController: UINavigationController){
UIView.animateWithDuration(0.5, delay: 0, options: UIViewAnimationOptions.CurveEaseOut, animations: {
self.navigationController.alpha = 0.0
}, completion: nil)
}
override func viewWillDisappear(animated: Bool) {
super.viewWillDisappear(animated)
if self.navigationController!.respondsToSelector("interactivePopGestureRecognizer") {
timer.invalidate()
UIApplication.sharedApplication().statusBarHidden = false
}
}
我希望我能帮到你
你也可以把hide函数放到另一个类中,所以你不需要在其他视图中重新输入它。
编辑:
我忘了提..当你回到一个视图时,你需要将NavigationController设置回可见...因此创建另一个方法,例如函数show
并将其设置为alpha 1.0
func show(navigationController: UINavigationController){
UIView.animateWithDuration(0.5, delay: 0, options: UIViewAnimationOptions.CurveEaseOut, animations: {
self.navigationController.alpha = 1.0
}, completion: nil)
}