Tôi đang cố gắng tìm cách đánh dấu nút quay lại trên bàn phím ios tiêu chuẩn, nhưng tôi không tìm thấy bất kỳ tài liệu nào.làm nổi bật nút 'quay lại' trên bàn phím iOS
Có ai biết cách làm điều đó không?
Cảm ơn rất nhiều câu trả lời.
Tôi đang cố gắng tìm cách đánh dấu nút quay lại trên bàn phím ios tiêu chuẩn, nhưng tôi không tìm thấy bất kỳ tài liệu nào.làm nổi bật nút 'quay lại' trên bàn phím iOS
Có ai biết cách làm điều đó không?
Cảm ơn rất nhiều câu trả lời.
Nút lại không thể được đánh dấu, tình trạng nổi bật tồn tại cho các giá trị khác nhau của UIReturnKeyType
:
typedef enum {
UIReturnKeyDefault,
UIReturnKeyGo,
UIReturnKeyGoogle,
UIReturnKeyJoin,
UIReturnKeyNext,
UIReturnKeyRoute,
UIReturnKeySearch,
UIReturnKeySend,
UIReturnKeyYahoo,
UIReturnKeyDone,
UIReturnKeyEmergencyCall,
} UIReturnKeyType;
Điểm nổi bật màu xanh xuất hiện trên tất cả các ngoại trừ UIReturnKeyDefault
(mà tình cờ là một trong đó nói "Return").
Bạn có thể đặt UIReturnKeyType
trên bất kỳ điều khiển nhập văn bản nào phù hợp với UITextInputTraits
(ví dụ: UITextField
, UITextView
) [id <UITextInputTraits> returnKeyType]
.
Trường hợp tôi muốn tùy chỉnh textView của bạn nhiều hơn một chút, tôi đã tìm thấy ví dụ về how to add a custom button to the keyboard. Mã đó là ngày tháng 3 năm 2008 và tôi không thể làm cho nó hoạt động trên iOS5, nhưng bạn có thể nhận được ý tưởng:
@synthesize window;
@synthesize viewController;
- (void)applicationDidFinishLaunching:(UIApplication *)application {
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyboardWillShow:) name:UIKeyboardWillShowNotification object:nil];
window.backgroundColor = [UIColor blackColor];
[window addSubview:viewController.view];
[window makeKeyAndVisible];
}
- (void)keyboardWillShow:(NSNotification *)note {
//The UIWindow that contains the keyboard view
UIWindow* tempWindow;
//Because we cant get access to the UIKeyboard throught the SDK we will just use UIView.
//UIKeyboard is a subclass of UIView anyways
UIView* keyboard;
//Check each window in our application
for(int c = 0; c < [[[UIApplication sharedApplication] windows] count]; C++)
{
//Get a reference of the current window
tempWindow = [[[UIApplication sharedApplication] windows] objectAtIndex:c];
//Get a reference of the current view
for(int i = 0; i < [tempWindow.subviews count]; i++)
{
keyboard = [tempWindow.subviews objectAtIndex:i];
if([[keyboard description] hasPrefix:@"(lessThen)UIKeyboard"] == YES)
{
//Keyboard is now a UIView reference to the UIKeyboard we want. From here we can add a subview
//to th keyboard like a new button
dot = [UIButton buttonWithType:UIButtonTypeCustom];
dot.frame = CGRectMake(0, 163, 106, 53);
[dot setImage:[UIImage imageNamed:@"period.gif"] forState:UIControlStateNormal];
[dot setImage:[UIImage imageNamed:@"period2.gif"] forState:UIControlStateHighlighted];
[keyboard addSubview:dot];
[dot addTarget:self action:@selector(addDot:) forControlEvents:UIControlEventTouchUpInside];
return;
}
}
}
}
Lần sau, trước khi bạn đăng, hãy nhớ rằng chữ ký không được phép, theo Câu hỏi thường gặp và vui lòng kiểm tra bài đăng của bạn để tìm lỗi chính tả & ngữ pháp. –
ok, thanx, tôi không biết rằng ... – reinvdo
tài liệu chính thức của apple hiển thị 'Tìm kiếm' nhưng được tối ưu hóa (http://developer.apple.com/library/IOs/#documentation/StringsTextFonts/Conceptual/TextAndWebiPhoneOS/KeyboardManagement/ KeyboardManagement.html # // apple_ref/doc/uid/TP40009542-CH5-SW3). cách thực hiện điều này? – reinvdo