新的Cordova InAppBrowser按钮

时间:2013-02-08 11:11:54

标签: cordova

有没有办法在新的浏览器窗口中设置样式或至少设置所需的按钮?

我知道我可以使用ChildBrowser插件,并且可以使用新的Cordova - 但我们想尝试新的InAppBrowser作为标准。

谢谢

1 个答案:

答案 0 :(得分:1)

我正在玩它,我可以通过复制 CDVInAppBrowser.m 文件中的关闭按钮代码来添加新按钮。然后我通过shareButton更改名称closeButton,并通过一个新函数wnShare更改函数回调,如下所示:

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;

然后,您可以通过向新功能添加代码来添加要在单击按钮时执行的操作:

- (void)wnShare
{
    /* Whatever ou want to do when the button is tapped goes here */
}

现在我正在研究如何打开一个对话框并显示许多共享链接,以分享通过不同社交媒体显示的当前网站。 如果你有一些线索请告诉: - )

如果有人需要,我在我的博客中写了一个完整的修改列表: http://blog.cubeinspire.com/how-to-add-a-new-event-type-into-cordova-2-4-0-phonegap-2-4-0-to-the-plugin-inappbrowser/