相关疑难解决方法(0)

适用于iOS的Google+ SDK以编程方式添加登录按钮

至于G + docs:https://developers.google.com/+/mobile/ios/sign-in

登录按钮可以使用XIB添加,也可以在UIViewController中以编程方式添加.

我有一个TableViewController,我将添加G + Signin按钮作为表格行的附件视图:

subtitleCell.accessoryView = self.googlePlusSignInButton;
Run Code Online (Sandbox Code Playgroud)

登录按钮将按如下方式初始化:

-(void) setGooglePlusButtons {

    self.googlePlusSignInButton = [[UIButton buttonWithType:UIButtonTypeCustom] retain];


    UIImage *backgroundButtonImage = [UIImage imageNamed:@"bt_search_cancel.png"];

    googlePlusSignInButton_.frame = CGRectMake(0.0f,
                                               0.0f,
                                               backgroundButtonImage.size.width,
                                               backgroundButtonImage.size.height);

    googlePlusSignInButton_.titleLabel.textColor = [UIColor whiteColor];
    googlePlusSignInButton_.titleLabel.font = [UIFont boldSystemFontOfSize:11.0f];
    googlePlusSignInButton_.titleLabel.numberOfLines = 2;

    googlePlusSignInButton_.titleLabel.shadowColor = [UIColor darkGrayColor];
    googlePlusSignInButton_.titleLabel.shadowOffset = CGSizeMake(0.0f,
                                                                 -1.0f);

    [googlePlusSignInButton_ setTitle:NSLocalizedString(@"UI_BUTTONS_LOGIN", @"")
                             forState:UIControlStateNormal];

    [googlePlusSignInButton_ setBackgroundImage:backgroundButtonImage
                                       forState:UIControlStateNormal];


    // Make sure the GPPSignInButton class is linked in because references from
    // xib file doesn't count.
    [GPPSignInButton class];

    GPPSignIn *signIn …
Run Code Online (Sandbox Code Playgroud)

ios google-plus

7
推荐指数
1
解决办法
1万
查看次数

标签 统计

google-plus ×1

ios ×1