Tôi đã thêm UIToolBar
với UIBarButtonItem
làm inputAccessoryView cho số UITextView
. Nó hoạt động tốt nhưng UIBarButtonItem có thể chạm vào bên ngoài khung của nó, có lẽ 50 pixel bên ngoài bên phải. Nó không có vấn đề gì lớn nhưng nó làm tôi khó chịu. Có ai biết tại sao không?iOS - UIToolBar dưới dạng inputAccessoryView cho UITextView
Đây là mã của tôi (ARC):
UIToolbar *toolBar = [[UIToolbar alloc] initWithFrame:CGRectMake(0, self.view.bounds.size.height, 320, 44)];
toolBar.barStyle = UIBarStyleBlack;
toolBar.translucent = YES;
UIBarButtonItem *doneButton = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemDone target:self action:@selector(doneWriting:)];
[toolBar setItems:[NSArray arrayWithObjects:doneButton, nil]];
self.messageTextView.inputAccessoryView = toolBar;
Nếu trường hợp đó xảy ra, đối với tôi, nó giống như lập trình "cẩu thả" có nút phản ứng bên ngoài giới hạn của nó, tốt thôi. –