预期的标识符

时间:2011-11-30 18:04:45

标签: ios xcode

一直试图在一行代码中找到错误。返回已注释掉的预期标识符错误。

你能帮我找到错误吗?谢谢。

抱歉代码格式不正确;不知道如何在这里得到它。

   #import "BIDAppDelegate.h"
   #import "BIDSwitchViewController.h"

   @implementation BIDAppDelegate

   @synthesize window = _window;
   @synthesize switchViewController;

   - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary    *)launchOptions
    {
        self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
        // Override point for customization after application launch.
        self.switchViewController = [[BIDSwitchViewController alloc]

                                 initWithNibName:@"Switch View" 
    bundle:nil];
        UIView *switchView = self.switchViewController.view;
        CGRect switchViewFrame = switchView.frame;
        switchViewFrame.origin.y += [[UIApplication sharedApplication].statusBarFrame.size.height; //    Expected identifier

    switchView.frame = switchViewFrame;
                                     [self.window addSubview:switchView];

        self.window.backgroundColor = [UIColor whiteColor];
        [self.window makeKeyAndVisible];
        return YES;
    }

2 个答案:

答案 0 :(得分:2)

你有一个额外的[在违规声明的开头。 :[[UIApplication sharedApplication]应为[UIApplication sharedApplication]

要格式化代码,将其粘贴,选择它并按问题编辑器顶部的{}按钮。

答案 1 :(得分:1)

Cnange该行:

switchViewFrame.origin.y += [UIApplication sharedApplication].statusBarFrame.size.height;