1

我想UITabBar在登录成功时显示界面。UITabBar我在中声明了接口AppDelegate,但是登录成功后我不知道如何调用接口。

这是我的代码:

appdelegate.m

    -(void)loadInterface
{
    [self configureiPhoneTabBar];
}

    -(void)configureiPhoneTabBar
    {
        UITabBarController *tabBarController = (UITabBarController *)self.window.rootViewController;
        UIViewController *controller1 = [[tabBarController viewControllers] objectAtIndex:0];
        [self configureTabBarItemWithImageName:@"home_ON.png" : @"home.png" andText:@"Trang chủ" forViewController:controller1];

        UIViewController *controller2 = [[tabBarController viewControllers] objectAtIndex:1];
        [self configureTabBarItemWithImageName:@"channel_ON.png" : @"tvChannel.png" andText:@"Kênh" forViewController:controller2];
    }

loginviewcontroller.m

- (IBAction)btnLogin:(id)sender {
    [self performSegueWithIdentifier:@"idenLogin" sender:self];
    AppDelegate *delegate = (AppDelegate *)[[UIApplication sharedApplication] delegate];
    [delegate loadInterface];
}

其次,当您触摸“播放”按钮时,布局视频显示并且可以正常工作,但我想自动旋转

注意:这是iphone上的界面,我在摘要中修复了肖像,我仍然显示风景,怎么办?

你能下载我的代码演示吗?

4

2 回答 2

0

我在我的 AppDelegate 中创建了一个名为 WindowState 或类似的对象,该对象管理应该是窗口的 rootViewController。最初它将是登录或启动,然后您可以在 WindowState 类中运行检查并侦听通知,例如。MyAppDidSignInNotification 然后将您的应用程序的 rootViewController 更改为 UITabBarController 或其他任何内容。

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
  self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
  self.windowState = [[FASWindowState alloc] initWithWindow:self.window];
  [self.window makeKeyAndVisible];

  return YES;
}
于 2013-01-23T09:15:57.003 回答
0

简而言之,您需要登录屏幕的模式视图。

这是我的做法(来自应用程序委托类)。请注意,我在故事板中设计了我的登录视图。

- (void) showLoginView
{
        assert(loginController == nil);
        assert(activityView == nil);

        UITabBarController *tabbar = (UITabBarController *)self.window.rootViewController;
        loginController = [tabbar.storyboard instantiateViewControllerWithIdentifier:@"LoginViewController"];
        loginController.delegate = self;
        [tabbar presentModalViewController:loginController animated:YES];
}
于 2013-01-23T09:07:09.533 回答