如何更改Phonegap InAppBrowser按钮颜色

时间:2013-11-01 00:19:11

标签: cordova phonegap-plugins inappbrowser

搜索过高和低,无法找到答案。简单地说,是否可以自定义“完成”按钮颜色以及Phonegap InAppBrowser中的箭头颜色?它们似乎在iOS7上默认为蓝色。想让它们变白。感谢。

4 个答案:

答案 0 :(得分:4)

请注意,如果您更新代码行以更改 setCloseButtontitle()功能中的完成按钮的颜色,并且不传递 closebuttoncaption JS调用中的参数

没有 setCloseButtontitle()

的示例
ref = window.open(link, '_blank', 'location=no');

setCloseButtontitle()

的示例
ref     = window.open(link, '_blank', 'location=no,closebuttoncaption=Close Window');

然后按钮颜色不会改变,所以我建议在以下功能代码之后添加代码行来改变按钮的颜色:

if (browserOptions.closebuttoncaption != nil) {
                    [self.inAppBrowserViewController  setCloseButtonTitle:browserOptions.closebuttoncaption];
 }
 //add this here so it will change the color of the button regardless of the browserOptions.closebuttoncaption being passed
 self.inAppBrowserViewController.closeButton.tintColor =[UIColor whiteColor];

答案 1 :(得分:2)

Project Navigator>>CordovaLib>>Classes>> Commands>>CDVInAppBrowser.m

self.closeButton按钮初始化

之后找到self.closeButton并放在下面
self.closeButton.tintColor = [UIColor whiteColor];

答案 2 :(得分:2)

@ Ved的回答不再准确。

现在在同一个文件中,您需要在setCloseButtontitle()中找到该行:

self.closeButton.tintColor = [UIColor colorWithRed:60.0 / 255.0 green:136.0 / 255.0 blue:230.0 / 255.0 alpha:1];

并将其更改为:

self.closeButton.tintColor = [UIColor whiteColor];

答案 3 :(得分:0)

对于箭头按钮也添加以下行:

*

  

self.inAppBrowserViewController.backButton.tintColor = [UIColor   whiteColor];   self.inAppBrowserViewController.forwardButton.tintColor = [的UIColor   whiteColor];

*