uitableview – 将NSMutablearray值加载到表视图中时出现问题?

uitableview – 将NSMutablearray值加载到表视图中时出现问题?,第1张

概述我是 iphone开发的新手,我正在尝试将NSMutableArray值加载到表视图中,我正在使用下面的代码来生成指定的错误.有人可以帮我纠正这个错误. 代码: – - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { // Return the number o 我是 iphone开发的新手,我正在尝试将NSMutableArray值加载到表视图中,我正在使用下面的代码来生成指定的错误.有人可以帮我纠正这个错误.

代码: –

- (NSInteger)tableVIEw:(UItableVIEw *)tableVIEw numberOfRowsInSection:(NSInteger)section {    // Return the number of rows in the section.    return [ShowList count];}// Customize the appearance of table vIEw cells.- (UItableVIEwCell *)tableVIEw:(UItableVIEw *)tableVIEw cellForRowAtIndexPath:(NSIndexPath *)indexPath {    static Nsstring *CellIDentifIEr = @"Cell";    UItableVIEwCell *cell = [tableVIEw dequeueReusableCellWithIDentifIEr:CellIDentifIEr];    if (cell == nil) {        cell = [[[UItableVIEwCell alloc] initWithStyle:UItableVIEwCellStyleDefault reuseIDentifIEr:CellIDentifIEr] autorelease];    }    // Configure the cell...    Nsstring *cellValue = [ShowList objectAtIndex:indexPath.row];    cell.textLabel.text = cellValue;       return cell;}

错误: –

2011-02-25 07:22:24.470 iPhone[1032:207] -[__NSArrayM isEqualToString:]: unrecognized selector sent to instance 0xab15d302011-02-25 07:22:24.471 iPhone[1032:207] *** Terminating app due to uncaught exception 'NSinvalidargumentexception',reason: '-[__NSArrayM isEqualToString:]: unrecognized selector sent to instance 0xab15d30'*** Call stack at first throw:

打印我的NSMutableArray的描述: –

2011-02-25 07:21:54.806[1032:207] (        (        "viral_tweeter",default1571546,default1570056,twilightsaga,"wp-monetizer",viraltweetbuild,"building_a_List",yourtwittertips,"twitter_profit",mikesbi,mikesbizz,default1164341,incbizztest,default1164319,iprotv,iwantafreecopy1,tweeterbuilder,trafficLists,myadsensenews,mysafeListnews,myviralnews,safeListology,slmembers,slpmembers,twonderlandList,noSEOspIDer,ySEOspIDer,digitallockdown,aListblueprint,classifIEdtips,incbizzblog,"xit-trafficbeta",twWidget,jvtrafficfunnel,instantmlmspage,Listbuldingmax,"incbizz_tips"    ))

用于解析http的代码获取响应: –

- (voID)requestDataFetcher:(GTMhttpFetcher *)fetcher finisheDWithData:(NSData *)data error:(NSError *)error {    // this is only for testing whether the data is coming or not    // NSDictionary *tempDict = [GTMOAuthAuthentication dictionaryWithResponseData:data];    if (error)     {        NSLog(@"Error: in getting data after authentication : %@",[error description]);    }     else     {        // NSLog(@"Succcess: in getting data after authentication \n data: %@",[tempDict description]);        Nsstring* aStr;        aStr = [[Nsstring alloc] initWithData:data enCoding:NSASCIIStringEnCoding];        NSDictionary *dictionary = [aStr JsONValue];        NSArray *keys = [dictionary allKeys];        names = [[NSMutableArray alloc]init];        int i = 0;        // values in foreach loop        for (Nsstring *key in keys)         {            i++;            NSArray *items = (NSArray *) [dictionary objectForKey:key];              // NSLog(@" test %@",items);            if (i==3)             {                for (Nsstring *item in items)                 {                     Nsstring* aStrs=  item;                    // NSLog(@" test %@",aStrs);                    NSDictionary *dict = aStrs;                    NSArray *k = [dict allKeys];                    for (ID *it in k)                     {                          // NSLog(@"the  child item: %@",[Nsstring stringWithFormat:@"Child Item -> %@ value %@",(NSDictionary *) it,[dict objectForKey:it]]);                          Nsstring *value = [it description];                         if ( [value isEqualToString:@"name"])                         {                            Nsstring * value = (Nsstring*)[[dict objectForKey:it] description];                            NSLog(value);                            [names addobject:value];                            [[MySingletonClass sharedMySingleton] SetaweberList: value];                        }                    }                }            }        }        mShowList.hIDden = FALSE;    }}
解决方法 @ravi你的数组是数组的数组,ShowList是一个数组,它有第一个对象作为数组,那个数组是那个

"viral_tweeter","incbizz_tips"

所以你可以做这样的事情.

Nsstring *cellValue = [[ShowList objectAtIndex:0] objectAtIndex:indexPath.row];
总结

以上是内存溢出为你收集整理的uitableview – 将NSMutablearray值加载到表视图中时出现问题?全部内容,希望文章能够帮你解决uitableview – 将NSMutablearray值加载到表视图中时出现问题?所遇到的程序开发问题。

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

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

原文地址: http://outofmemory.cn/web/1051234.html

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

发表评论

登录后才能评论

评论列表(0条)

保存