Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/three.js/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Objective c 在iOS 7中,数字键盘上的“完成”按钮绝对可以,但在iOS 8中则不行。我没有';除了更新ios8外,不要更改任何内容_Objective C_Ios8_Uikeyboard - Fatal编程技术网

Objective c 在iOS 7中,数字键盘上的“完成”按钮绝对可以,但在iOS 8中则不行。我没有';除了更新ios8外,不要更改任何内容

Objective c 在iOS 7中,数字键盘上的“完成”按钮绝对可以,但在iOS 8中则不行。我没有';除了更新ios8外,不要更改任何内容,objective-c,ios8,uikeyboard,Objective C,Ios8,Uikeyboard,错误是-找不到支持键盘iPhone纵向数字广告类型4的键盘平面;使用3876877096_肖像_iPhone-Simple-Pad_默认值 将系统版本定义为大于或等于(v)([[UIDevice currentDevice]systemVersion]比较:v选项:NSNumericSearch]!=传感器解除搜索) -(无效)键盘将显示:(NSNotification*)注释 { //NSLog(@“keyboardwillshow”); doneButton=[UIButton按钮类型:UI

错误是-找不到支持键盘iPhone纵向数字广告类型4的键盘平面;使用3876877096_肖像_iPhone-Simple-Pad_默认值

将系统版本定义为大于或等于(v)([[UIDevice currentDevice]systemVersion]比较:v选项:NSNumericSearch]!=传感器解除搜索)
-(无效)键盘将显示:(NSNotification*)注释
{
//NSLog(@“keyboardwillshow”);
doneButton=[UIButton按钮类型:UIButtonTypeCustom];
doneButton.frame=CGRectMake(0,163,106,53);
doneButton.adjustsImageWhenHighlighted=否;
[完成按钮设置标题:@“完成”状态:UIControlStateNormal];
[doneButton setTitleColor:[UIColor blackColor]用于状态:UIControlStateNormal];
[doneButton addTarget:self action:@selector(dismissKeyboard1)for ControlEvents:UIControlEventTouchUpInside];
如果(系统版本大于或等于(@“7.0”)){
dispatch\u async(dispatch\u get\u main\u queue()^{
//UIView*键盘视图=[UIApplication sharedApplication]windows]lastObject]子视图]firstObject];
//[doneButton setFrame:CGRectMake(0,keyboardView.frame.size.height-53106,53)];
//doneButton.frame=CGRectMake(0,([UIScreen mainScreen].bounds.size.height-480)+163、106、53);
doneButton.frame=CGRectMake(0163,106,53);
UIWindow*tempWindow=[[UIApplication sharedApplication]windows]对象索引:1];
UIView*键盘;
对于(int i=0;i=3.2){

如果([[keyboard description]hasPrefix:@“我在使用此解决方案时也遇到了问题,那么我发现了此问题

您只需添加AddButtonKeyboard方法并在TextFieldEditingDidBegen委托中调用它,您也可以在AddButtonKeyboard方法中声明按钮

- (void)addButtonToKeyboard
{
// create custom button
self.doneButton = [UIButton buttonWithType:UIButtonTypeCustom];
self.doneButton.frame = CGRectMake(0, 163+44, 106, 53);
self.doneButton.adjustsImageWhenHighlighted = NO;
[self.doneButton setTag:67123];
[self.doneButton setImage:[UIImage imageNamed:@"doneup1.png"] forState:UIControlStateNormal];
[self.doneButton setImage:[UIImage imageNamed:@"donedown1.png"] forState:UIControlStateHighlighted];

[self.doneButton addTarget:self action:@selector(doneButton:) forControlEvents:UIControlEventTouchUpInside];

// locate keyboard view
int windowCount = [[[UIApplication sharedApplication] windows] count];
if (windowCount < 2) {
    return;
}

UIWindow* tempWindow = [[[UIApplication sharedApplication] windows] objectAtIndex:1];
UIView* keyboard;

for(int i = 0 ; i < [tempWindow.subviews count] ; i++)
{
    keyboard = [tempWindow.subviews objectAtIndex:i];
    // keyboard found, add the button

    if([[keyboard description] hasPrefix:@"<UIPeripheralHost"] == YES){
        UIButton* searchbtn = (UIButton*)[keyboard viewWithTag:67123];
        if (searchbtn == nil)//to avoid adding again and again as per my requirement (previous and next button on keyboard)
            [keyboard addSubview:self.doneButton];

    }//This code will work on iOS 8.0
    else if([[keyboard description] hasPrefix:@"<UIInputSetContainerView"] == YES){

        for(int i = 0 ; i < [keyboard.subviews count] ; i++)
        {
            UIView* hostkeyboard = [keyboard.subviews objectAtIndex:i];

            if([[hostkeyboard description] hasPrefix:@"<UIInputSetHost"] == YES){
                UIButton* donebtn = (UIButton*)[hostkeyboard viewWithTag:67123];
                if (donebtn == nil)//to avoid adding again and again as per my requirement (previous and next button on keyboard)
                    [hostkeyboard addSubview:self.doneButton];
            }
        }
    }
else{}
}
}
-(无效)添加按钮键盘
{
//创建自定义按钮
self.doneButton=[UIButton-buttonwhithtype:UIButtonTypeCustom];
self.doneButton.frame=CGRectMake(0,163+44,106,53);
self.doneButton.adjustsImageWhenHighlighted=否;
[self.doneButton setTag:67123];
[self.doneButton setImage:[UIImage ImageName:@“doneup1.png”]用于状态:UIControlStateNormal];
[self.doneButton setImage:[UIImage ImageName:@“donedown 1.png”]用于状态:UIControlStateHighlighted];
[self.doneButton addTarget:self action:@selector(doneButton:)for controlEvents:UIControlEventTouchUpInside];
//定位键盘视图
int windowCount=[[UIApplication sharedApplication]windows]计数];
如果(windowCount<2){
返回;
}
UIWindow*tempWindow=[[UIApplication sharedApplication]windows]对象索引:1];
UIView*键盘;
对于(int i=0;i<[tempWindow.subviews计数];i++)
{
键盘=[tempWindow.subviews objectAtIndex:i];
//找到键盘后,添加按钮

如果([[keyboard description]hasPrefix:@“您是否可以添加一个错误日志或书面描述,说明什么“不起作用”?它是否没有显示?它是否崩溃?请尽可能多地提供信息,但不要过于宽泛或模糊
- (void)addButtonToKeyboard
{
// create custom button
self.doneButton = [UIButton buttonWithType:UIButtonTypeCustom];
self.doneButton.frame = CGRectMake(0, 163+44, 106, 53);
self.doneButton.adjustsImageWhenHighlighted = NO;
[self.doneButton setTag:67123];
[self.doneButton setImage:[UIImage imageNamed:@"doneup1.png"] forState:UIControlStateNormal];
[self.doneButton setImage:[UIImage imageNamed:@"donedown1.png"] forState:UIControlStateHighlighted];

[self.doneButton addTarget:self action:@selector(doneButton:) forControlEvents:UIControlEventTouchUpInside];

// locate keyboard view
int windowCount = [[[UIApplication sharedApplication] windows] count];
if (windowCount < 2) {
    return;
}

UIWindow* tempWindow = [[[UIApplication sharedApplication] windows] objectAtIndex:1];
UIView* keyboard;

for(int i = 0 ; i < [tempWindow.subviews count] ; i++)
{
    keyboard = [tempWindow.subviews objectAtIndex:i];
    // keyboard found, add the button

    if([[keyboard description] hasPrefix:@"<UIPeripheralHost"] == YES){
        UIButton* searchbtn = (UIButton*)[keyboard viewWithTag:67123];
        if (searchbtn == nil)//to avoid adding again and again as per my requirement (previous and next button on keyboard)
            [keyboard addSubview:self.doneButton];

    }//This code will work on iOS 8.0
    else if([[keyboard description] hasPrefix:@"<UIInputSetContainerView"] == YES){

        for(int i = 0 ; i < [keyboard.subviews count] ; i++)
        {
            UIView* hostkeyboard = [keyboard.subviews objectAtIndex:i];

            if([[hostkeyboard description] hasPrefix:@"<UIInputSetHost"] == YES){
                UIButton* donebtn = (UIButton*)[hostkeyboard viewWithTag:67123];
                if (donebtn == nil)//to avoid adding again and again as per my requirement (previous and next button on keyboard)
                    [hostkeyboard addSubview:self.doneButton];
            }
        }
    }
else{}
}
}
- (void)removeButtonFromKeyboard
{
NSArray *arTemp = [[UIApplication sharedApplication] windows];
if ([arTemp count] <= 1) return;
UIWindow* tempWindow = [[[UIApplication sharedApplication] windows] objectAtIndex:1];
UIView* keyboard;
for(int i=0; i<[tempWindow.subviews count]; i++)
{
    keyboard = [tempWindow.subviews objectAtIndex:i];
    // keyboard found, add the button
    if ([[keyboard description] hasPrefix:@"<UIPeripheralHost"] == YES)
    {
        for (id temp in keyboard.subviews)
        {
            if ([temp isKindOfClass:[UIButton class]])
            {
                UIButton *btnDone = (UIButton*) temp;
                [btnDone removeFromSuperview];
                break;
            }
        }
    }
    //This code will work on iOS 8.0
    else if([[keyboard description] hasPrefix:@"<UIInputSetContainerView"] == YES)
    {
        for(int i = 0 ; i < [keyboard.subviews count] ; i++)
        {
            UIView* hostkeyboard = [keyboard.subviews objectAtIndex:i];
            if([[hostkeyboard description] hasPrefix:@"<UIInputSetHost"] == YES)
            {
                for (id temp in hostkeyboard.subviews)
                {
                    if ([temp isKindOfClass:[UIButton class]])
                    {
                        UIButton *btnNext = (UIButton*) temp;
                        [btnNext removeFromSuperview];
                        break;
                    }
                }
            }
        }
    }
    else{}
}
}