0

PhoneGap 1.3 を使用しており、ツールバーの右側に iOS 追加ボタンを作成しようとしています。ただし、このcreateToolBarItemメソッドには項目の位置を設定するオプションがありません。これどうやってするの?NativeControls.h のコード スニペットを次に示します。

//create the toolbar in `createToolBar` method://
toolBar = [[UIToolbar alloc] initWithFrame:toolBarBounds];

//....set some toolbar options like .hidden, .barStyle, etc.//
[toolBar setFrame:toolBarBounds];
[self.webView setFrame:webViewBounds];

//add the toolbar to the webview
[self.webView.superview addSubView:toolBar];


//create the button item in `createToolBarItem` method:
item = [[UIBarButtonItem alloc] initWithBarButtonSystemItem: UIBarButtonSystemItemAdd target:self action:@selector(toolBarButtonTapped:)];
[toolBarItems insertObject:item atIndex:[tagId intValue]];
[item release];

//then in `showToolBar` method//
[toolBar setItems:toolBarItems animated:NO];
4

1 に答える 1

0

もうお気づきかもしれませんがUIBarButtonSystemItemFlexibleSpace、ボタンを右揃えにするには、ボタンの左側に a を追加する必要があります。

Phonegap では、JS から次のことを行います。

nativeControls.createToolBarItem("spacer", "", "UIBarButtonSystemItemFlexibleSpace", "");
于 2012-06-15T16:18:54.003 に答える