我有五个文本框,它们是子类视图,在触摸时循环来自数组的值。他们都是空白的开始。
如果框中收到@"\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";
}
答案 0 :(得分:1)
试试
self.tncsTapView.text = [self attributeWithName:@"systemTypeTncs"];
if ([self.tncsTapView.text hasPrefix:@"\u2714"])
{
}
答案 1 :(得分: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";
}
答案 2 :(得分:0)
NSString中的反斜杠由两个连续的反斜杠表示。在所有if语句中,请尝试以下操作:
if ([self.tncsTapView.textValue isEqualToString:@"\\u2714"])