按下按钮点击新视图

时间:2013-05-01 21:26:43

标签: ios objective-c uiview uiviewcontroller

似乎无法弄清楚这一点。我试图在按钮点按下加载UIView(最好从右侧滑入),但在第一页后它没有改变。

  1. 我点击设置页面上的注册按钮,它会加载第一个注册页面,然后在第一个注册页面上,当我点击continueButton加载第二个页面时它根本不会做任何事情..
  2. SettingsPage.m

    - (void)regsiterButton:(UIButton *)standardButton {
        MAINVIEWCONTROLLER.mainView = [[RegisterStep1 alloc] initWithFrame:MAINVIEWCONTROLLER.mainView.frame];
    }
    

    RegisterStep1.m - 尝试加载下一个注册页面但不起作用:

    - (void)continueButton:(UIButton *)standardButton {
        MAINVIEWCONTROLLER.mainView = [[RegisterStep2 alloc] initWithFrame:MAINVIEWCONTROLLER.mainView.frame];
    }
    

1 个答案:

答案 0 :(得分:1)

假设RegisterStep1UIViewController子类,您希望使用UINavigationController的{​​{1}}方法,该方法从右侧执行默认转换。

如果您尚未设置pushViewController:animated:,则在使用之前,您需要通过UINavigationControllerSettingsPage打包在一起。

Apple guide描述了导航控制器如何适应应用的整体导航。