【发布时间】:2012-04-15 14:30:03
【问题描述】:
我在循环一组动态创建的 UITextField 并将这些值存储为双精度值以便稍后添加到数组时遇到问题。我对 obj-c 编程还是很陌生,所以如果这个问题看起来微不足道,请耐心等待。谢谢。这是我目前所拥有的。
NSMutableArray *textFieldCashArray = [[NSMutableArray alloc] init];
double textFieldCash;
for (int y=0; y<25; y++) {
UITextField *myLabel = (UITextField *)[self.view viewWithTag:y];
textFieldCash = [myLabel.text doubleValue];
[textFieldCashArray addObject:[NSNumber numberWithDouble:textFieldCash]];
}
P.S,这是我收到的错误消息
Pro[962:b303] -[UIControl text]: unrecognized selector sent to instance 0x680f850
2012-04-01 16:05:46.305 iFinance Pro[962:b303] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[UIControl text]: unrecognized selector sent to instance 0x680f850'
*** Call stack at first throw:
【问题讨论】:
-
这段代码在你的 ViewController 中到底在哪里?
-
这些
UITextField是否在UITableView中?
标签: iphone objective-c xcode cocoa-touch ipad