2012-01-26 11 views
0

PhoneGap 1.3を使用していて、ツールバーの右側にiOS追加ボタンを作成しようとしています。ただし、createToolBarItemメソッドにはアイテムの位置を設定するオプションがありません。これどうやってするの?ここでNativeControls.hからのコードの抜粋です:PhoneGapを使用してUIToolBarにUIBarButtonItemを配置します

//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]; 

答えて

0

あなたはおそらく今では判明していますが、それは右揃え持っているあなたのボタンの左側にUIBarButtonSystemItemFlexibleSpaceを追加する必要があります。 JSからのPhoneGapで

は、実行します。

nativeControls.createToolBarItem("spacer", "", "UIBarButtonSystemItemFlexibleSpace", ""); 
関連する問題