Add completion button in the lower left corner of iOS8 keypad

Source: Internet
Author: User

Add completion button in the lower left corner of iOS8 keypad

The core code of the add completion button in the lower left corner of the iOS8 numeric keypad is as follows:

-(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: @ "for" forState: UIControlStateNormal]; [DoneButton setTitleColor: [UIColor blackColor] forState: UIControlStateNormal]; [doneButton addTarget: self action: @ selector (doneButton :) forControlEvents: UIControlEventTouchUpInside]; NSArray * export Warr = [[UIApplication sharedApplication] windows]; if (export Warr! = Nil & Warr. count> 1) {UIWindow * needWindow = [Export Warr 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 = [Export Warr objectAtIndex: 1]; UIView * keyboard; for (int I = 0; I <[needWindow. subviews count]; I ++) {keyboard = [needWindow. subviews objectAtIndex: I]; if ([[keyboard description] hasPrefix :@"
  
   




Note:

1. After iOS8, the description of the keyboard view is changed

2. After iOS8, the size of the keyboard view changes to the size of the entire screen. Therefore, you need to adapt the position added by the button.



Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.