NSMutableDictionary打印数据的问题
我的 NSMutableDictionary
有问题,我想打印字典中的所有键。
我试过了。
for(id theKey in myDict) {
NSLog(@"Key:%@-Value:%@",theKey,[myDict objectForKey:theKey]);
}
上面的代码可以工作。但我从另一个控制器获取 NSMutableDict 。在该控制器中它有数据。但在新控制器中它是空的。 伙计们帮忙吗? ... :]
@KennyTM:代码在这里:
NewViewController *newCont = [[NewViewController alloc] initWithNibName:@"NewViewController" bundle:nil];
newCont.myDict = [myDict retain];
[self.navigationController pushViewController:newCont animated:YES];
[sign release];
I have a problem with NSMutableDictionary
I want to print all the keys in the dictionary.
I tried this.
for(id theKey in myDict) {
NSLog(@"Key:%@-Value:%@",theKey,[myDict objectForKey:theKey]);
}
The above code is working. But i am getting the NSMutableDict from another controller. In that controller it has Data.But in new controller it is empty.
Guys Help? ... :]
@KennyTM:The code is here:
NewViewController *newCont = [[NewViewController alloc] initWithNibName:@"NewViewController" bundle:nil];
newCont.myDict = [myDict retain];
[self.navigationController pushViewController:newCont animated:YES];
[sign release];
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
你的代码没问题。如果您在日志中看不到任何内容,则字典可能为空。您可以使用
-count
方法。Your code is fine. If you can't see anything in the log, it is possible that the dictionary is empty. You could check if a collection is empty using the
-count
method.