[英]Toolbar and Textfield problem
我有一個iPad項目。 在項目中,我有一個工具欄,然后我就可以添加一個文本框。 這是我的簡化代碼。
- (void)viewDidLoad {
[super viewDidLoad];
UITextField *pageNumbersView = [[UITextField alloc] initWithFrame:CGRectMake(0, 0, 100, 40)];
pageNumbersView.clearsOnBeginEditing = YES;
pageNumbersView.borderStyle = UITextBorderStyleRoundedRect;
pageNumbersView.textAlignment = UITextAlignmentCenter;
pageNumbersView.userInteractionEnabled = YES;
pageNumbersView.keyboardType = UIKeyboardTypeNumberPad;
pageNumbersView.returnKeyType = UIReturnKeyDone;
UIBarButtonItem *pagesIndicator = [[UIBarButtonItem alloc] initWithCustomView:pageNumbersView];
UIToolbar *toolbar = [[UIToolbar alloc] initWithFrame:CGRectMake(0, 100, 768, 44)];
toolbar.items = [NSArray arrayWithObject:pagesIndicator];
[self.view addSubview:toolbar];
}
當我單擊文本字段時,將出現鍵盤。 現在的問題是,在鍵盤上,我按下了鍵盤底部最右邊的按鈕(鍵盤隱藏按鈕?),卻什么也沒發生。 如果我將文本字段添加到視圖不工具欄是工作。 對這個問題有任何想法嗎? 我該如何解決? 感謝您的回答。
嘗試使用界面生成器添加文本字段,而不是對其進行硬編碼。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.