iOS - pushViewController在转换为xCode 9 / iOS 11后无法正常工作

时间:2017-10-16 18:35:21

标签: ios uinavigationcontroller

我看到我的iOS应用程序不允许从最近升级到iOS 11的应用程序商店下载,所以我正在尝试更新它。我在Xcode 9中使用它,现在我已经设法在我的iPhone 6上启动了应用程序。但是,在初始屏幕显示之后,我似乎无法显示它。

例如,初始显示成功显示并显示一个名为“start”的按钮。当你按下它时会弹出另一个显示,但它不会(虽然它到达显示它的代码)。

这是代码,在一个名为“StartController.m”的类中,它应该调用显示:

    NSLog(@"nav controller = %@", self.navigationController); 
    // push question controller onto the stack
    [self.navigationController pushViewController:questionController animated:YES];

    // the nav controller owns it now, we can release it
    [questionController release];

调试显示按下按钮时成功调用此代码,但在issueController发布后,没有任何反应。 这是StartController.h中questionController的声明:

@interface StartController : UIViewController <ADBannerViewDelegate>{ 
    QuestionController      *questionController;

这是StartController.m中相同的声明:

@implementation StartController

@synthesize questionController, settingsController, nextLevelViewController, appState;

使用此代码在app delegate的“didFinishLaunchingWithOptions”方法中成功显示初始视图(使用“开始”按钮):

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {    


    // Override point for customization after application launch.

    // create the start controller 
    self.startController = [[StartController alloc] init];

    // transfer to it - not animated because it's the first view
    [navController pushViewController:startController animated:NO]; 

    // add the current nav controller view to the window view heirarchy 
    // [window addSubview:navController.view];

    [self.window setRootViewController:startController];

    // release becasause now the navController has it
    [startController release];

    // show the start controller 
    [self.window makeKeyAndVisible];

    return YES;
}

供参考,这是app delegate header中navController的声明:

@interface QuizAppDelegate : NSObject <UIApplicationDelegate> {
    UIWindow                *window;
    UINavigationController  *navController;
    StartController         *startController;   
}

@property (readonly) BOOL iPad; 
@property (nonatomic, retain)   IBOutlet    UIWindow *window;
@property (nonatomic, retain)   StartController *startController;
@property (nonatomic, retain)   IBOutlet    UINavigationController *navController;

以下是实施中的声明:

@implementation QuizAppDelegate

@synthesize window;
@synthesize startController;
@synthesize navController;

我尽量不发布太多代码,因为害怕模糊问题,但如果要求我会添加它。任何想法可能是什么问题?

0 个答案:

没有答案