2017-02-27 1 views
1

UIBarButtonItem tintColor에 문제가 있습니다.FBSDK 공유 대화 상자를 사용하는 동안 UIBarButtonItem의 색조를 변경하는 방법

는 I 앱

에 색을 기본으로 사용하기위한 그러나이 화면에 AppDelegate에에 [[UIBarButtonItem appearance] setTintColor:[UIColor whiteColor]];을 설정했습니다. 흰색이기 때문에 버튼이 보이지 않는 것 같습니다! 공유 팝업 화면을 표시하려면 FBSDKShareDialog showFromViewController을 사용했습니다. 이 화면에서 tintColor를 편집하려면 어떻게해야합니까?

설명을 편집하십시오.

제안 사항은이 화면에서만 작동합니다. 하지만 실제로이 문제는 파란색으로 바뀌 었습니다. 이메일 화면 전송에 영향을줍니다. 그래서 전자 메일 화면에서 내 탐색 표시 줄이 파란색이기 때문에 단추를 볼 수없는 것 같습니다. 그건 속임수 야. UIActicityController를 사용하여 전자 메일 화면을 표시했습니다.

enter image description here

+0

코드 변경하는 경우 ([UINavigationBar conformsToProtocol : @protocol (UIAppearanceContainer)]) { [UINavigationBar 외관] .tintColor = [UIColor whiteColor]; } – iOS

+0

@지가 사용자가 이메일로 보내기를 클릭 할 때'[[UIBarButtonItem appearance] setTintColor : [UIColor whiteColor]];를 설정해야합니다. 버튼이 기본값으로 파란색으로 설정되고 내비게이션 막대 색상이 파란색으로 설정됩니다. 그래서 그것은이 버튼으로 볼 수 없습니다. – Oniikal3

답변

0

대물 C

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions 
{ 
self.window.tintColor = [UIColor whiteColor]; 
return YES; 
} 

OR

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions 
{ 
if([UINavigationBar conformsToProtocol:@protocol(UIAppearanceContainer)]) { 
    [UINavigationBar appearance].tintColor = [UIColor whiteColor]; 
} 

return YES; 
} 

// ****************** *************************************************** *********

스위프트

func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool { 
self.window?.tintColor = UIColor.white 
return true 
} 

또는 여전히이 일을 생각하지 않은 경우

func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool { 
if UINavigationBar is UIAppearanceContainer { 
    UINavigationBar.appearance().tintColor = UIColor.white 
} 
return true 
} 
+0

미안하지만, 당신의 제안은 tintColor를 변경할 수 있습니다. 그러나 나는 더 많은 정보를 설명했습니다. 그래서 이것은 작동하지 않을 것이다. – Oniikal3

0

은, 당신이 할 수있는 일은 FBSDKSharing의 위임을 사용하는 것입니다. AppDelegate에 파일 에

- (IBAction)shareOnFacebook:(id)sender 
{ 
    FBSDKShareLinkContent *content = [[FBSDKShareLinkContent alloc] init]; 
    content.contentTitle = @"Content Title"; 
    content.contentURL = [NSURL URLWithString:@"https://example.com/url/to/your/app"]; 
    content.quote = @"Learn quick and simple ways for people to share content from your app or website to Facebook."; 

    // make the changes here; what you want to see in FB Dialog 
    [[UINavigationBar appearance] setBackgroundImage:[[UIImage alloc] init] forBarPosition:UIBarPositionAny barMetrics:UIBarMetricsDefault]; 

    FBSDKShareDialog *dialog = [[FBSDKShareDialog alloc] init]; 
    dialog.fromViewController = self; 
    dialog.shareContent = content; 
    dialog.mode = FBSDKShareDialogModeShareSheet; 
    dialog.delegate = self; 
    [dialog show]; 
} 

// And change it back in these delegate methods 
-(void)sharer:(id<FBSDKSharing>)sharer didCompleteWithResults:(NSDictionary *)results 
{ 
} 

-(void)sharerDidCancel:(id<FBSDKSharing>)sharer 
{ 
} 

-(void)sharer:(id<FBSDKSharing>)sharer didFailWithError:(NSError *)error 
{ 
} 
관련 문제