这给了我一个错误,“Bad Reciever type 'NSIntegar”(又名'int')。
NSString *tempTag = [((UITextField *)[self.dataSetDictionary objectForKey:key]).tag stringValue];
试图将 uitextfield 的标签强制转换为字符串。我可以很好地使用 [NSString stringWithFormat],只是想不通为什么这种方式行不通。
最佳答案
你必须使用stringWithFormat:
UITextField *textField = (UITextField *)[self.dataSetDictionary objectForKey:key];
NSString *tempTag = [NSString stringWithFormat:@"%d", textField.tag];
just can't figure out why this way won't work.
因为 tag
是标量整数而不是对象。您不能向非对象发送像 stringValue
这样的消息。
关于iphone - 将 UITextField 标签转换为字符串,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8792053/