新Cordova InAppBrowser按钮 [英] New Cordova InAppBrowser buttons
问题描述
有没有方法来设置样式,或者至少在新的浏览器窗口中设置所需的按钮?
Is there a way to style or, at least, set the desired buttons in a new browser window?
我知道我可以使用ChildBrowser插件,它可以与新的Cordova一起使用 - 但我们想尝试新的InAppBrowser作为标准。
I know I can do it with ChildBrowser plugin, and that it can live with the new Cordova - but we want to try the new InAppBrowser as a standard.
感谢
推荐答案
我可以通过在 CDVInAppBrowser.m 文件中复制关闭按钮代码来添加新按钮。然后我通过shareButton改变了名称closeButton,并通过一个新的函数wnShare改变了函数callback:
I've playing a bit with it and I could add a new button by duplicating the Close button code inside the CDVInAppBrowser.m file. Then I changed the name closeButton by shareButton and the function callback by one new function wnShare like this:
self.shareButton = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemSave target:self action:@selector(wnShare)];
self.shareButton.enabled = YES;
self.shareButton.imageInsets = UIEdgeInsetsZero;
self.shareButton.style = UIBarButtonItemStylePlain;
self.shareButton.width = 38.000;
然后,您可以通过向新功能添加代码来添加单击按钮时要执行的操作:
Then you can add action you want to perform when the button is clicked by adding code to the new function:
- (void)wnShare
{
/* Whatever ou want to do when the button is tapped goes here */
}
现在我正在寻找如何打开对话框,并显示许多共享链接以共享通过不同的社交媒体显示的当前网站。
如果你有一些线索,请告诉: - )
Right now I'm looking on how to open a dialogbox and show many share links to share the current website displayed through different social medias. If you have some clue please tell :-)
如果任何人需要,我写了一个完整的修改列表到我的博客:
http://blog.cubeinspire.com/how-to-add-a-new-event-type-into-cordova-2-4-0-phonegap-2-4- 0-to-the-plugin-inappbrowser /
I wrote a full list of modification into my blog if anyone needs that: http://blog.cubeinspire.com/how-to-add-a-new-event-type-into-cordova-2-4-0-phonegap-2-4-0-to-the-plugin-inappbrowser/
这篇关于新Cordova InAppBrowser按钮的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!