2015-01-05 2 views
5

해결책을 찾고 있었지만 깜짝 선물에 대한 질문이 아직 없습니다.Google Plus 로그인 버튼의 제목을 변경하는 방법은 무엇입니까?

Google 로그인 버튼의 제목을 변경하는 방법은 무엇입니까? setTitle:에 의해

  1. 재정의 제목하지만 도움이되지 않았다 : enter image description here

    내가하려고했다.

  2. Google 플러스 프레임 워크 디렉토리에 "로그인"문자열이 있지만 잘 찾았습니다 ... Finder에서 해당 문자열을 찾지 못했습니다. 3.Use 페이스 북 로그인 버튼을 변경하기위한 작동 코드를 다음

for (id obj in self.signInButtonGPP.subviews) 
{ 
    if ([obj isKindOfClass:[UILabel class]]) 
    { UILabel * label = view; 
     label.text = @"Google"; 
    }} 
난 당신이 구글이 제공하는 사용자 정의 GPPSigninButton 클래스를 사용하고 있으리라 믿고있어 당신에게

+0

당신은 다음을 의미합니다 : UILabel * label = obj; 권리? – jerrygdm

답변

4

은 버튼의 자원은 GooglePlus.bundle 파일에 포함되어 있습니다. 라벨의 값은 GooglePlusPlatform.strings 번들의 파일에서 가져옵니다.

의 값을 직접 편집 할 수 있습니다. 키에 사용자 정의 제목이 있습니다. 는 (이. 당신은 모든 로케일을 수행해야하지만 더러운 수정 될 것이다) enter image description here enter image description here

그리고하는 동안 그것은 Google+ Sign-In button branding guidelines을 준수해야합니다.

+0

작동합니다! 고맙습니다. –

+0

와우, 대단한 대답, 고마워. – JAL

0

감사드립니다.

this sample project에서 "로그인"텍스트가 이미지의 일부인 것처럼 보이므로 불행히도이 텍스트를 변경할 수 없습니다. IBAction을 사용하여 직접 버튼을 만들고 로그인 이벤트를 처리해야합니다.

Google's Sample Project

는 내가 SDK의 최신 버전을 사용하여 내 자신의 예제 응용 프로그램을 만들었습니다. 보기 디버거를 통해 버튼을 보면 라벨이 있지만 헤더 파일에는 노출되지 않습니다.

My Own Sample Project

// 
// GPPSignInButton.h 
// Google+ iOS SDK 
// 
// Copyright 2012 Google Inc. 
// 
// Use of this SDK is subject to the Google+ Platform Terms of Service: 
// https://developers.google.com/+/terms 
// 

#import <UIKit/UIKit.h> 

// The various layout styles supported by the GPPSignInButton. 
// The minmum size of the button depends on the language used for text. 
// The following dimensions (in points) fit for all languages: 
// kGPPSignInButtonStyleStandard: 226 x 48 
// kGPPSignInButtonStyleWide:  308 x 48 
// kGPPSignInButtonStyleIconOnly: 46 x 48 (no text, fixed size) 
typedef enum { 
    kGPPSignInButtonStyleStandard = 0, 
    kGPPSignInButtonStyleWide = 1, 
    kGPPSignInButtonStyleIconOnly = 2 
} GPPSignInButtonStyle; 

// The various color schemes supported by the GPPSignInButton. 
typedef enum { 
    kGPPSignInButtonColorSchemeDark = 0, 
    kGPPSignInButtonColorSchemeLight = 1 
} GPPSignInButtonColorScheme; 

// This class provides the Google+ sign-in button. You can instantiate this 
// class programmatically or from a NIB file. You should set up the 
// |GPPSignIn| shared instance with your client ID and any additional scopes, 
// implement the delegate methods for |GPPSignIn|, and add this button to your 
// view hierarchy. 
@interface GPPSignInButton : UIButton 

// The layout style for the sign-in button. The default style is standard. 
@property(nonatomic, assign) GPPSignInButtonStyle style; 

// The color scheme for the sign-in. The default scheme is dark. 
@property(nonatomic, assign) GPPSignInButtonColorScheme colorScheme; 

@end 

는 불행하게도 이것은 당신이 텍스트를 변경할 수 없음을 의미합니다.

+0

절대로 말하지 마십시오 –

2

음 .. 페이스 북의 로그인 버튼 텍스트를 변경했을 때 사용한 것과 같은 해결책을 사용할 수 있다고 생각합니다. 어쩌면 그것의 최고 & 깨끗한 방법,하지만 .. 작동합니다. 원래 G + 로그인 버튼 프레임을 CGRectZero로 설정하고 G + 버튼과 동일한 모양의 사용자 정의 버튼과 맞춤 텍스트를 추가하기 만하면됩니다. 보다, 당신이 당신의 버튼 터치를 감지 할 때이 같은 G + 버튼을 전달해야

[self.gppSigninButton sendActionsForControlEvents:UIControlEventTouchUpInside]; 

그것을 테스트하지 못했지만, 내가 그것을 잘 작동 것 같아요. 도움이 되길 바랍니다.

0

Google Plus SDK는 SDK와 함께 설정 번들을 제공하지 않습니다.

설정 번들은 내부에 사용되는 모든 이미지가있는 것입니다.

Google Plus 라이브러리는 **. ** 확장자는 파일에 대한 액세스 권한이 없음을 의미합니다.

또한 로그인 버튼은 이미지이기 때문에 제목을 변경할 수 없습니다.

GPPSignInButton를 서브 클래스 시도하고 로 awakeFromNib 방법에있는 당신의 필요에 따라 그것의 이미지/제목을 변경합니다.이 도움이

희망 ..

관련 문제