0

我有五个文本框,它们是子类视图,当被触摸时,它们会循环数组中的值。他们一开始都是空白的。

如果该框收到值@"\u2714"我想用 N/A 自动填充其他框。

到目前为止,我尝试过的内容会在@"\u2714"收到时更改文本框的值。不知道我在这里做错了什么?

这是我的nsarray: //self.valuesArray = [NSArray arrayWithObjects:@"\u2714", @"X", @"LIM", @"N/A", nil];

如果我将字符串设置为数组中的任何值,则文本框不会填充 N/A。如果我设置isEqualToString:sting@""我可以让我的文本框值全部默认为 N/A,但不是基于循环遍历数组时的任何输入

    self.tncsTapView.textValue = ([self attributeWithName:@"systemTypeTncs"]).value;
    if ([self.tncsTapView.textValue isEqualToString:@"X"]){
    self.tncTapView.textValue = @"N/A";
    self.tnsTapView.textValue = @"N/A";
    self.itTapView.textValue = @"N/A";
    self.ttTapView.textValue = @"N/A";
    }
    self.tnsTapView.textValue = ([self attributeWithName:@"systemTypeTns"]).value;
    if ([self.tnsTapView.textValue isEqualToString:@""]){
    self.tncsTapView.textValue = @"N/A";
    self.tncTapView.textValue = @"N/A";
    self.itTapView.textValue = @"N/A";
    self.ttTapView.textValue = @"N/A";
    }
    self.tncTapView.textValue = ([self attributeWithName:@"systemTypeTnc"]).value;
    if ([self.tncTapView.textValue isEqualToString:@""]){
    self.tncsTapView.textValue = @"N/A";
    self.tnsTapView.textValue = @"N/A";
    self.itTapView.textValue = @"N/A";
    self.ttTapView.textValue = @"N/A";
    }

    self.itTapView.textValue = ([self attributeWithName:@"systemTypeIt"]).value;
    if ([self.itTapView.textValue isEqualToString:@""]){
    self.tncTapView.textValue = @"N/A";
    self.tnsTapView.textValue = @"N/A";
    self.tncsTapView.textValue = @"N/A";
    self.ttTapView.textValue = @"N/A";
    }

    self.ttTapView.textValue = ([self attributeWithName:@"systemTypeTt"]).value;
    if ([self.ttTapView.textValue isEqualToString:@""]){
    self.ttTapView.textValue = @"N/A";
    self.tnsTapView.textValue = @"N/A";
    self.itTapView.textValue = @"N/A";
    self.tncsTapView.textValue = @"N/A";
    }




    self.tncsTapView.textValue = ([self attributeWithName:@"systemTypeTncs"]).value;
    if ([self.tncsTapView.textValue isEqualToString:@"\u2714"]){
    self.tncTapView.textValue = @"N/A";
    self.tnsTapView.textValue = @"N/A";
    self.itTapView.textValue = @"N/A";
    self.ttTapView.textValue = @"N/A";
    }
    self.tnsTapView.textValue = ([self attributeWithName:@"systemTypeTns"]).value;
    if ([self.tnsTapView.textValue isEqualToString:@"\u2714"]){
    self.tncsTapView.textValue = @"N/A";
    self.tncTapView.textValue = @"N/A";
    self.itTapView.textValue = @"N/A";
    self.ttTapView.textValue = @"N/A";
    }
    self.tncTapView.textValue = ([self attributeWithName:@"systemTypeTnc"]).value;
    if ([self.tncTapView.textValue isEqualToString:@"\u2714"]){
    self.tncsTapView.textValue = @"N/A";
    self.tnsTapView.textValue = @"N/A";
    self.itTapView.textValue = @"N/A";
    self.ttTapView.textValue = @"N/A";
    }

    self.itTapView.textValue = ([self attributeWithName:@"systemTypeIt"]).value;
    if ([self.itTapView.textValue isEqualToString:@"\u2714"]){
    self.tncTapView.textValue = @"N/A";
    self.tnsTapView.textValue = @"N/A";
    self.tncsTapView.textValue = @"N/A";
    self.ttTapView.textValue = @"N/A";
    }

    self.ttTapView.textValue = ([self attributeWithName:@"systemTypeTt"]).value;
    if ([self.ttTapView.textValue isEqualToString:@"\u2714"]){
    self.ttTapView.textValue = @"N/A";
    self.tnsTapView.textValue = @"N/A";
    self.itTapView.textValue = @"N/A";
    self.tncsTapView.textValue = @"N/A";
    }
4

3 回答 3

1

你试一试

self.tncsTapView.text = [self attributeWithName:@"systemTypeTncs"];

    if ([self.tncsTapView.text hasPrefix:@"\u2714"])
    {
    }
于 2012-11-30T12:57:30.940 回答
0

我猜你必须在任何地方删除 Value ......当你分配时,你将它分配为文本,并且在检查时你也检查它作为文本。

self.tncsTapView.text = [self attributeWithName:@"systemTypeTncs"];
if ([self.tncsTapView.text isEqualToString:@"\u2714"]){
self.tncTapView.text = @"N/A";
self.tnsTapView.text = @"N/A";
self.itTapView.text = @"N/A";
self.ttTapView.text = @"N/A";
}
self.tnsTapView.text = [self attributeWithName:@"systemTypeTns"];
if ([self.tnsTapView.text isEqualToString:@"\u2714"]){
self.tncsTapView.text = @"N/A";
self.tncTapView.text = @"N/A";
self.itTapView.text = @"N/A";
self.ttTapView.text = @"N/A";
}
self.tncTapView.text = [self attributeWithName:@"systemTypeTnc"];
if ([self.tncTapView.text isEqualToString:@"\u2714"]){
self.tncsTapView.text = @"N/A";
self.tnsTapView.text = @"N/A";
self.itTapView.text = @"N/A";
self.ttTapView.text = @"N/A";
}

self.itTapView.text = [self attributeWithName:@"systemTypeIt"];
if ([self.itTapView.text isEqualToString:@"\u2714"]){
self.tncTapView.text = @"N/A";
self.tnsTapView.text = @"N/A";
self.tncsTapView.text = @"N/A";
self.ttTapView.text = @"N/A";
}

self.ttTapView.text = [self attributeWithName:@"systemTypeTt"];
if ([self.ttTapView.text isEqualToString:@"\u2714"]){
self.ttTapView.text = @"N/A";
self.tnsTapView.text = @"N/A";
self.itTapView.text = @"N/A";
self.tncsTapView.text = @"N/A";
}
于 2012-11-30T12:50:27.040 回答
0

NSString 中的反斜杠由两个连续的反斜杠表示。在所有 if 语句中,尝试以下操作:

if ([self.tncsTapView.textValue isEqualToString:@"\\u2714"])
于 2012-11-30T12:53:35.623 回答