IOS数字键盘左下角添加完成按钮的实现方法-创新互联
IOS数字键盘左下角添加完成按钮的实现方法

实现代码:
- (void)addDoneButtonToNumPadKeyboard
{
UIButton *doneButton = [UIButton buttonWithType:UIButtonTypeCustom];
if (systemVersion < 8.0){
doneButton.frame = CGRectMake(0, 163, 106, 53);
}else{
doneButton.frame = CGRectMake(0, SCREEN_SIZE.height-53, 106, 53);
}
doneButton.tag = NUM_PAD_DONE_BUTTON_TAG;
doneButton.adjustsImageWhenHighlighted = NO;
[doneButton setTitle:@"完成" forState:UIControlStateNormal];
[doneButton setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
[doneButton addTarget:self action:@selector(doneButton:) forControlEvents:UIControlEventTouchUpInside];
NSArray *windowArr = [[UIApplication sharedApplication] windows];
if (windowArr != nil && windowArr.count > 1){
UIWindow *needWindow = [windowArr objectAtIndex:1];
UIView *keyboard;
for(int i = 0; i < [needWindow.subviews count]; i++) {
keyboard = [needWindow.subviews objectAtIndex:i];
NSLog(@"%@", [keyboard description]);
if(([[keyboard description] hasPrefix:@" 1){
UIWindow *needWindow = [windowArr objectAtIndex:1];
UIView *keyboard;
for(int i = 0; i < [needWindow.subviews count]; i++) {
keyboard = [needWindow.subviews objectAtIndex:i];
if(([[keyboard description] hasPrefix:@"另外有需要云服务器可以了解下创新互联建站www.cdcxhl.com,海内外云服务器15元起步,三天无理由+7*72小时售后在线,公司持有idc许可证,提供“云服务器、裸金属服务器、高防服务器、香港服务器、美国服务器、虚拟主机、免备案服务器”等云主机租用服务以及企业上云的综合解决方案,具有“安全稳定、简单易用、服务可用性高、性价比高”等特点与优势,专为企业上云打造定制,能够满足用户丰富、多元化的应用场景需求。
当前标题:IOS数字键盘左下角添加完成按钮的实现方法-创新互联
文章位置:http://www.scyingshan.cn/article/ccpech.html


咨询
建站咨询
