ios – 在NSMutableArray中删除NSMutableDictionary内部

ios – 在NSMutableArray中删除NSMutableDictionary内部,第1张

概述我一直在寻找一段时间如何删除nil,null,值在这里和谷歌尝试所有我所看到的但我总是有一个例外,说选择器不兼容. 这是我的Array和带有NSMutableDictionary的NSMutableArray Array Value = ( { "sub_desc" = "sub cat description of Laptop"; " 我一直在寻找一段时间如何删除nil,null,值在这里和谷歌尝试所有我所看到的但我总是有一个例外,说选择器不兼容.
这是我的Array和带有NSMutableDictionary的NSMutableArray

Array Value = (        {           "sub_desc" = "sub cat description of Laptop";           "sub_name" = Laptop;        },{           "sub_desc" = "sub cat description of Printers";           "sub_name" = Printers;        },"<null>","<null>")

我试图删除价值观,任何想法?

我的segue是这样的

-(voID) prepareForSegue:(UIStoryboardSegue *)segue sender:(ID)sender{    if ([segue.IDentifIEr isEqualToString:@"MySegue"]) {        ChildtableVIEwController *myNextPage = [segue destinationVIEwController];        if ([myNextPage isKindOfClass:[ChildtableVIEwController class]]){              Nsstring *key = [[[parsedData ListPopulated]objectAtIndex:self.tableVIEw.indexPathForSelectedRow.row]valueForKey:@"name"];            myNextPage.childData = [[parsedData childPopulated]valueForKey:key];         }    }}

和childData是我的Child VIEw Controller中的NSMutableArray,childPopulated也是一个NSMutableArray,我插入NSMutableDictionary.

解决方法 使用 [NSMutableArray removeObject:]

Removes all occurrences in the array of a given object.

NSMutableArray *array = ...;[array removeObject:@"<null>"];

注意:您的数组包含字典和字符串对象的混合;不仅仅是字典对象.

总结

以上是内存溢出为你收集整理的ios – 在NSMutableArray中删除NSMutableDictionary内部全部内容,希望文章能够帮你解决ios – 在NSMutableArray中删除NSMutableDictionary内部所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址:https://54852.com/web/1065254.html

(0)
打赏 微信扫一扫微信扫一扫 支付宝扫一扫支付宝扫一扫
上一篇 2022-05-26
下一篇2022-05-26

发表评论

登录后才能评论

评论列表(0条)

    保存