Hi aim beginner in Ios and in my project i am adding face-book login facility for users
And when users click login button enter with proper user id and passwords then it's asking permission like below image then i am clicking "OK" button then it's calling below method
and it's redirected to my Mainviewcontroller
and there login button title showing "logout" like below light gray color image and then it's redirected to another page But i don't want to show that logout button when we call that above delegate method and i want show that title like "log in with face-book" can some help me please
#import "HomeViewController.h"
#import "HomeViewController1.h"
@interface HomeViewController ()
{
FBLoginView *loginview;
UILabel * loginLabel;
}
@end
@implementation HomeViewController
@synthesize fblogin;
- (void)viewDidLoad
{
[super viewDidLoad];
loginview = [[FBLoginView alloc]init];
loginview.frame = CGRectMake(10, 95, 271, 37);
loginview.readPermissions = @[@"public_profile", @"email", @"user_friends"];
for (id obj in loginview.subviews)
{
if ([obj isKindOfClass:[UIButton class]])
{
UIButton * loginButton = obj;
UIImage *loginImage = [UIImage imageNamed:@"YourImg.png"];
[loginButton setBackgroundImage:loginImage forState:UIControlStateNormal];
[loginButton setBackgroundImage:nil forState:UIControlStateSelected];
[loginButton setBackgroundImage:nil forState:UIControlStateHighlighted];
loginButton.backgroundColor = [UIColor lightGrayColor];
}
if ([obj isKindOfClass:[UILabel class]])
{
loginLabel = obj;
loginLabel.text = @"Log in with Facebook";
loginLabel.textAlignment = NSTextAlignmentCenter;
loginLabel.frame = CGRectMake(0, 0, 271, 37);
}
}
loginview.delegate = self;
[self.view addSubview:loginview];
[super viewDidLoad];
}
// This method will be called when the user information has been fetched
- (void)loginViewFetchedUserInfo:(FBLoginView *)loginView
user:(id<FBGraphUser>)user {
NSLog(@"User Id : %@",user.id);
NSLog(@"User Name : %@",user.name);
HomeViewController1 * home1 = [self.storyboard instantiateViewControllerWithIdentifier:@"HomeViewController1"];
[self presentViewController:home1 animated:YES completion:nil];
}
如果获取信息, button.hidden = true
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.