UITextField OR UITextView 鍵盤上的toolbar

    UIToolbar *keyboardToolBar = [[UIToolbar alloc] initWithFrame:CGRectMake(10.0f, 0.0f, 320.0f, 44.0f)];
    keyboardToolBar.tintColor = [UIColor blackColor];
    UIBarButtonItem *doneBtn = [[UIBarButtonItem alloc] initWithTitle:@"確定" style:UIBarButtonItemStyleBordered target:self action:@selector(KeyboardDown:)];
    UIBarButtonItem *fiexible = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemFlexibleSpace target:nil action:nil];
    keyboardToolBar.items = [NSArray arrayWithObjects:fiexible, doneBtn, nil];
    [textView setInputAccessoryView:keyboardToolBar];


寫在Willbeginedit or shouldbeginedit

留言

熱門文章