pdenlinger
pdenlinger

Reputation: 3917

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

Upvotes: 1

Views: 311

Answers (2)

beryllium
beryllium

Reputation: 29767

Cnange that line to:

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

Upvotes: 1

jrturton
jrturton

Reputation: 119242

You have an extra [ at the start of the offending statement. :[[UIApplication sharedApplication] should be [UIApplication sharedApplication]

To format code, paste it in, select it and press the {} button at the top of the question editor.

Upvotes: 2

Related Questions