zoukankan      html  css  js  c++  java
  • 关于视图切换

    今天在写代码中突然遇到一个问题,自以为在一个UIPickPhotoViewController切换到VideoPageViewController中,UIPickPhotoViewController和VideoPageViewController都是MainViewController  pushViewController方法推出来的,因此在UIPickPhotoViewController中写的代码如下:

    VideoPageViewController *VideoController = [[VideoPageViewController alloc] init];
                [self.navigationController popViewControllerAnimated:NO];
                [self.navigationController pushViewController:VideoController animated:YES];
                [VideoController release]; 

    结果这样根本就push不出来VideoController,后来才发现,原来是因为当你执行[self.navigationController popViewControllerAnimated:NO];这句代码的时候,你就把自己给pop掉了,所以self.navigationController 应该为nil了,再来执行 [self.navigationController pushViewController:VideoController animated:YES];应该是没效果了。所以想要然[self.navigationController pushViewController:VideoController animated:YES];这句代码有效,只要把self.navigationController 临时的保存起来就OK了。把上面的代码改成:

     VideoPageViewController *VideoController = [[VideoPageViewController alloc] init];
                UINavigationController *tmpNavController = self.navigationController;
                [tmpNavController popViewControllerAnimated:NO];
                [tmpNavController pushViewController:VideoController animated:YES];
                [VideoController release];  

    这样VideoController就能够被push出来了。

     

     
  • 相关阅读:
    配置HDFS HttpFS和WebHDFS
    编译hbase-1.2.3源代码
    Yarn application has already exited with state FINISHED
    一种基于Redis的10行代码实现IP频率控制方法
    PRId64的正确用法
    cmake检测g++编译器是否支持c++11
    定时取指定进程内存脚本
    C++常见gcc编译链接错误解决方法
    Congestion Avoidance in TCP
    Studying TCP's Throughput and Goodput using NS
  • 原文地址:https://www.cnblogs.com/lyanet/p/2785254.html
Copyright © 2011-2022 走看看