2

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

我知道我可以使用 ChildBrowser 插件来做到这一点,并且它可以与新的 Cordova 一起使用 - 但我们想尝试将新的 InAppBrowser 作为标准。

谢谢

4

1 回答 1

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-in​​to-cordova-2-4-0-phonegap -2-4-0-to-the-plugin-inappbrowser/

于 2013-03-24T23:08:47.610 回答