0

I am trying to integrate the Facebook SDK in my iOS application.

I have followed the tutorial provided as it is and it works except that in my application I need facebook login button showing up in the third view controller as part of the sign up process.

When I add everything in the project the first view shows All White as I have added

self.window.backgroundColor = [UIColor lightGrayColor]; in the app delegate's method didFinishLaunchingWithOptions as described in the facebook turotial and sample app.

What change should I make to make it work.

Thanks

1 Answer 1

0

Add in your viewDidLoadmethod of your ViewController this code:

- (void)viewDidLoad{

    [super viewDidLoad];
// Do any additional setup after loading the view.
    FBLoginView *loginView = [[FBLoginView alloc] initWithReadPermissions:@[@"basic_info", @"email", @"user_likes"]];

    // Set this loginUIViewController to be the loginView button's delegate
    loginView.delegate = self;

    // Align the button in the center horizontally
    loginView.frame = CGRectOffset(loginView.frame,
                               (self.view.center.x - (loginView.frame.size.width / 2)),
                               5);

    // Align the button in the center vertically
    loginView.center = CGPointMake(self.view.center.x, self.view.frame.size.height - (loginView.frame.size.height + 10));

    // Add the button to the view
    [self.view addSubview:loginView];

}
1
  • I have added this since it's part of facebook's tutorial. What I am thinking is that this has something to do with 'window' related code in app delegate. I have not been able to show the login button on the third view controller. I have added this code in my third view controller but nothing is displaying on the first view controller as well which was working fine before facebook integration. The screen color in first view controller is now grey as mentioned in my main question. Feb 26, 2014 at 10:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.