简体   繁体   English

预期标识符

[英]Expected identifer

Have been trying to find the error in one line of code. 一直试图在一行代码中找到错误。 Return expected identifier error which has been commented out. 返回已注释掉的预期标识符错误。

Can you help me to find the error? 您能帮我找到错误吗? Thank you. 谢谢。

Sorry for the bad code formatting; 对不起,错误的代码格式; don't know how to get it right here. 不知道如何在这里得到它。

   #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;
    }

You have an extra [ at the start of the offending statement. 您在冒犯性陈述的开头有一个额外的[。 : [[UIApplication sharedApplication] should be [UIApplication sharedApplication] [[UIApplication sharedApplication]应为[UIApplication sharedApplication]

To format code, paste it in, select it and press the {} button at the top of the question editor. 要格式化代码,请将其粘贴,选择它并按问题编辑器顶部的{}按钮。

Cnange那行:

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM