导航栏中的"Facebook共享"按钮显示为不活动 [英] Facebook Share Button in navigation bar appears inactive

查看:69
本文介绍了导航栏中的"Facebook共享"按钮显示为不活动的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试将FB共享按钮实现到导航栏(具有它的设计).

I'm trying to implement FB Share Button to Navigation Bar(with it's design).

我用SLComposeViewController编写了共享代码,一切正常.

I coded sharing with SLComposeViewController, and everything works fine.

我只使用Facebook,而Action图标不是我想要的. 我试图将一个按钮作为FBSDKShareButton添加到导航栏:

I use only Facebook and Action icon is not what i want. I tried to add a button as FBSDKShareButton to Navigation Bar:

但是按钮始终处于不活动状态并且看上去很差:

but button is always inactive and looks poor:

我确定,我已在登录FB的设备上测试我的应用程序.可能是FBSDKShareButton需要有关此的一些信息吗?怎么样?

I am sure, that I test my app on the device logged to FB. May be FBSDKShareButton needs some information about this? How?

self.fbShareButton.enabled = true 

在viewDidLoad中不起作用.

in viewDidLoad does not work.

当然,我可以使用通常的UIButton并分配创建(或下载)的图像.但是与此同时,我失去了本地化和调整大小的功能.

Of course, i can make usual UIButton and assign created(or downloaded) image. But with this I lose localization and resizing.

有什么想法吗?

推荐答案

尝试一下

    public void btnClick(View v){
    Intent sharingIntent = new Intent(Intent.ACTION_SEND);
    sharingIntent.setType("text/plain");
    //Give any url in uriString
    uriString = "http://www.opencv-tutorial-codes.blogspot.in";
    sharingIntent.putExtra(Intent.EXTRA_TEXT,uriString );
    sharingIntent.setPackage("com.facebook.katana");
    startActivity(sharingIntent);

这篇关于导航栏中的"Facebook共享"按钮显示为不活动的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆