![](/img/trans.png)
[英]iOS 8 - UIWebView Keyboard - Previous/Next/Done Accessory Bar - How can I remove the toolbar?
[英]How to show the “Previous/Next/Done” bar with a UITextView
在iPhone上的webview中輸入文本時,我在鍵盤上方看到了“上一個/下一個/完成”欄。 我想在我正在與UITextView一起制作的應用程序中使用這個內置欄。 我在幾個應用程序中看到鍵盤上方看起來非常相似的條形圖。 我的猜測是這是一個手工制作的酒吧,看起來像我想要的酒吧或程序員找到一種方式來顯示實際的酒吧。 假設它是實際的酒吧,而不是手工制作的酒吧,你如何讓它顯示?
我寫了XCDFormInputAccessoryView ,這是一個帶有previous / next / done按鈕的輸入附件視圖。
沒有內置的Prev / Next / Done欄,你必須自己創建它。
也可以看看:
創建此方法並在ViewWillLoad上調用它:
- (void) keyboardToolbarSetup
{
if(self.keyboardToolbar==nil)
{
self.keyboardToolbar = [[UIToolbar alloc] initWithFrame:CGRectMake(0, 0, self.view.bounds.size.width, 44)];
UIBarButtonItem *cancelButton = [[UIBarButtonItem alloc] initWithTitle:@"Cancel" style:UIBarButtonItemStylePlain target:self action:@selector(anyAction)];
UIBarButtonItem *extraSpace = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemFlexibleSpace target:nil action:nil];
UIBarButtonItem *doneButton = [[UIBarButtonItem alloc] initWithTitle:@"Done" style:UIBarButtonItemStyleDone target:self action:@selector(anyOtherAction)];
NSArray *toolbarButtons = [[NSArray alloc]initWithObjects:cancelButton,extraSpace,doneButton, nil];
[self.keyboardToolbar setItems:toolbarButtons];
self.myTextView.inputAccessoryView=self.keyboardToolbar;
}
}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.