我尝试了很多变化而没有运气。我可以NSLog数组,我得到了这个:
2011-07-17 00:54:54.886 Widgets[13444:207] <Widget: 0x5e2aad0> (entity: Widget; id: 0x5e0d8e0 <x-coredata://E64A0BCE-2344-4EE1-89CC-164ACD8995D6/Recipe/p115> ; data: {
success = 1;
coconutscarried = nil;
name = "African Swallow";
uidnumber = "105 ";
})
如何简单设置文本字段?
原谅这个烂摊子,但这是我尝试过的各种代码(凌乱)。数组和文本字段已设置为.h / m并绑定在IB
中- (void)viewDidLoad {
[super viewDidLoad];
//NSLog(@"%@",[[swallowArray name] text]); // doesnt work
//NSLog(@"The string at index is %@.", [self.swallowArray objectAtIndex:0]);//nope...
for (int i = 0; i < [swallowArray count]; i++) {
//nameTextField.text = [[swallowArray objectAtIndex:i] uidnumber];
//NSLog(@"%@",swallowArray.name);
//}
//nameTextField.text = [[swallowArray objectAtIndex:0] uidnumber];
//NSString* strRate = [[swallowArray object] uidnumber];
nameTextField.text = [nameTextField.text stringByAppendingString:[NSString localizedStringWithFormat:@", %@", [[swallowArray objectAtIndex:i] name]]];
}
还有更多。这一定很简单,但我有点像菜鸟。
谢谢!
博
答案 0 :(得分:0)
NSString *nameFromArray = [NSString stringWithFormat:@"%@", [eventArray valueForKey:@"name"]];
NSLog(@"%@", nameFromArray);
希望这有助于其他人!