—[NSConcreteMutableAttributedString _UIKBStringWideAttribute



我有一个应用程序,当我点击iOS6的文本框时,应用程序会崩溃。出现如下消息:

-[NSConcreteMutableAttributedString _UIKBStringWideAttributeValueForKey:]: message sent to deallocated instance 0x11ba0740

我有一个英语和阿拉伯语版本的应用程序。对于阿拉伯语,我使用NSMutableAttributedString并将文本设置为textField.attributedText

它在iOS 7上运行良好。

不知道是什么问题,但下面是我如何解决的。

viewDidLoad中我在下面添加了

[fullName addTarget:self action:@selector(handleTouchValueChangedUN) forControlEvents: UIControlEventEditingDidEnd];

然后使用handleTouchValueChangedUN

-(void) handleTouchValueChangedUN {
    [User_FullName setString:fullName.text];
}

添加了textFieldShouldBeginEditing,我将文本设置为空白,然后将其值设置为实际值。

- (BOOL)textFieldShouldBeginEditing:(UITextField *)textField
{
    textField.text = @"";
    if (textField==fullName) {
        attributedString = [[NSMutableAttributedString alloc] initWithString:User_FullName attributes:@{ NSFontAttributeName : [UIFont fontWithName:localize(@"myFontName") size:[localize(@"fontSize001") floatValue]], NSLigatureAttributeName: @2}];
        textField.attributedText = attributedString;
    }
    return YES;
}

然而,我更关心这个,因为这从来没有发生在我之前。这是我第一次经历。

相关内容

  • 没有找到相关文章

最新更新