我遇到了UIBarButtonItem tintColor的问题。
我已在AppDelegate中设置[[UIBarButtonItem appearance] setTintColor:[UIColor whiteColor]];
,以便在应用中使用默认颜色
但是在这个屏幕上。它似乎看不到按钮,因为它是白色的!
我使用FBSDKShareDialog showFromViewController
来显示共享弹出屏幕。如何为此屏幕编辑tintColor?
编辑以解释更多信息。
作为建议,它仅适用于此屏幕。但实际上我的问题是在我将此屏幕更改为蓝色后。它会影响发送电子邮件屏幕。所以在电子邮件屏幕上似乎看不到按钮,因为我的导航栏是蓝色。那是诡计多端的。我使用UIActicityController来呈现电子邮件屏幕。
答案 0 :(得分:0)
目标c
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
self.window.tintColor = [UIColor whiteColor];
return YES;
}
或强>
- (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
}
答案 1 :(得分:0)
如果你仍然没有想到这一点,你可以做的就是使用FBSDKSharing
的代表。
- (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
{
}