In order to connect to facebook in my ios app i\'m using FBLoginVIew from Facebook SDK for iOS.
It shows a nice FB Login Button, but I want to use my own image and t
I wanted to be FBLoginview shows as a UIBarbutton, So i have made a simple approach:
First i've added FBLoginView as a property:
@property (nonatomic, strong) FBLoginView* loginView;
And then i've added the login view outside the view:
self.loginView = [[FBLoginView alloc] init];
self.loginView.frame = CGRectMake(-500, -500, 0, 0);
[self.view addSubview:self.loginView];
self.loginView.delegate = self;
And then, i've added a standard system UIbarbuttonItem
UIBarButtonItem* fbButton = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemAction target:self action:@selector(fireFbLoginView)];
[self.navigationItem setRightBarButtonItem:fbButton];
And then i set the bar button to fire click action of the FBLoginView ;)
-(void)fireFbLoginView{
for(id object in self.loginView.subviews){
if([[object class] isSubclassOfClass:[UIButton class]]){
UIButton* button = (UIButton*)object;
[button sendActionsForControlEvents:UIControlEventTouchUpInside];
}
}
}