Initial commit
This commit is contained in:
@@ -0,0 +1,39 @@
|
||||
//
|
||||
// UITextView+AddKeybordDoneVIew.m
|
||||
// KeyBordViewExtern
|
||||
//
|
||||
// Created by imac on 16/11/21.
|
||||
// Copyright © 2016年 xiang. All rights reserved.
|
||||
//
|
||||
|
||||
#import "UITextView+AddKeybordDoneVIew.h"
|
||||
|
||||
@implementation UITextView (AddKeybordDoneVIew)
|
||||
|
||||
-(void)keybordViewAddDoneView
|
||||
{
|
||||
UIToolbar * topView = [[UIToolbar alloc]initWithFrame:CGRectMake(0, 0, 320, 30)];
|
||||
[topView setBarStyle:UIBarStyleBlackTranslucent];
|
||||
|
||||
UIBarButtonItem * btnSpace = [[UIBarButtonItem alloc]initWithBarButtonSystemItem:UIBarButtonSystemItemFlexibleSpace target:self action:nil];
|
||||
|
||||
UIButton *btn = [UIButton buttonWithType:UIButtonTypeCustom];
|
||||
btn.frame = CGRectMake(2, 5, 50, 25);
|
||||
[btn addTarget:self action:@selector(dismissKeyBoard) forControlEvents:UIControlEventTouchUpInside];
|
||||
// [btn setImage:[UIImage imageNamed:@"shouqi"] forState:UIControlStateNormal];
|
||||
[btn setTitle:@"完成" forState:UIControlStateNormal];
|
||||
UIBarButtonItem *doneBtn = [[UIBarButtonItem alloc]initWithCustomView:btn];
|
||||
NSArray * buttonsArray = [NSArray arrayWithObjects:btnSpace,doneBtn,nil];
|
||||
[topView setItems:buttonsArray];
|
||||
[self setInputAccessoryView:topView];
|
||||
|
||||
}
|
||||
|
||||
-(void)dismissKeyBoard
|
||||
{
|
||||
|
||||
[self resignFirstResponder];
|
||||
|
||||
}
|
||||
|
||||
@end
|
||||
Reference in New Issue
Block a user