在我的phonegap iOS应用程序中,我使用cordova2.7.0并使用inAppwebbrowser,当它打开完成按钮到底部时,我需要将“完成”文本更改为法语名称,所以请告诉我。
谢谢
在我的phonegap iOS应用程序中,我使用cordova2.7.0并使用inAppwebbrowser,当它打开完成按钮到底部时,我需要将“完成”文本更改为法语名称,所以请告诉我。
谢谢
You can do it by native in Xcode
,in phonegap currently can't do it, customizing 'Done' button text is a feature that the Phonegap team is working on. You can read more about it here.
how in xcode:
Locate CDVInAppBrowser.m
as shown
coredovalib -> classes -> commands -> CDVInAppBrowser.m
and paste below code snippet where close button properties are set
self.closeButton = [[UIBarButtonItem alloc] initWithTitle:@"my text"
style:UIBarButtonItemStyleBordered target:self action:@selector(close)];
${projectname}/plugins/org.apache.cordova.inappbrowser/src/ios/CDVInAppBrowser.m
使用您选择的编辑器打开。
在 init 函数中,查找以下内容:
self.toolbar = YES;
self.closebuttoncaption = nil;
self.toolbarposition = kInAppBrowserToolbarBarPositionBottom;
self.clearcache = NO;
self.clearsessioncache = NO;
改变
self.closebuttoncaption = nil;
=>self.closebuttoncaption = @"your text";
这里的主要优点是它构建正确,您不必每次构建时都更改它。此外,建议在 init 函数中更改文本,因此不必在 setter 函数中更改它。
PS:我使用 org.apache.cordova.inappbrowser 0.6.0 "InAppBrowser"
尝试这个
在 CDVInAppBrowser.m 文件替换
替换这个
if (browserOptions.closebuttoncaption != nil) {
[self.inAppBrowserViewController setCloseButtonTitle:browserOptions.closebuttoncaption];
}
至
if (browserOptions.closebuttoncaption == nil) {
NSLog(@"hiii if");
[self.inAppBrowserViewController setCloseButtonTitle:@"Your French Name hear"];
}
在 Cordova InAppBrowser 1.7.0 中,您可以像closebuttoncaption
调用 InAppBrowser 时一样提供关闭按钮文本,而不必更改 Cordova 的代码:
myIAB.create('http:/blah, '_blank', 'location=no,closebuttoncaption=Close');
还有在window.open
:
window.open('http://blah','_blank','location=no,closebuttoncaption=Close');
browserOptions
CDVInAppBrowserOptions 中列出的其他默认值:
location = YES;
toolbar = YES;
closebuttoncaption = nil;
toolbarposition = kInAppBrowserToolbarBarPositionBottom;
clearcache = NO;
clearsessioncache = NO;
enableviewportscale = NO;
mediaplaybackrequiresuseraction = NO;
allowinlinemediaplayback = NO;
keyboarddisplayrequiresuseraction = YES;
suppressesincrementalrendering = NO;
hidden = NO;
disallowoverscroll = NO;