Programmatically pressing a UITabBar button in Xcode

前端 未结 6 1259
无人及你
无人及你 2020-12-17 17:34

Sorry for the newbie question. I have a UITabBar in my main window view as well as an array of UINavigationControllers for each Tab. The structure is similar to the iPod a

6条回答
  •  南方客
    南方客 (楼主)
    2020-12-17 18:04

    I'd like to reply to Prakash, but can't figure out how. Maybe I'm blocked until my score goes up.

    Anyhow, I hope this helps someone:

    I was doing what Prakash said, and nothing was happening. It's because to get a pointer to my app delegate, I was doing this:

    AppDelegate_Phone *appDelegate = [[AppDelegate_Phone alloc] init];
    

    When I should have been doing this:

    AppDelegate_Phone *appDelegate = (AppDelegate_Phone *) [[UIApplication sharedApplication] delegate];
    

    Newbie mistake.

提交回复
热议问题