我可以显示数组中的第一项,但不显示其余项.
- (UItableVIEwCell *)tableVIEw:(UItableVIEw *)tableVIEw cellForRowAtIndexPath:(NSIndexPath *)indexPath object:(PFObject *)object { static Nsstring *CellIDentifIEr = @"Cell"; UItableVIEwCell *cell = [tableVIEw dequeueReusableCellWithIDentifIEr:CellIDentifIEr]; if(cell==nil){ cell = [[UItableVIEwCell alloc] initWithStyle:UItableVIEwCellStyleSubTitle reuseIDentifIEr:CellIDentifIEr]; } _ListArray = [object objectForKey:@"content"]; NSLog(@"OBJECT = %@",_ListArray); Nsstring *cellValue = [Nsstring stringWithFormat:@"%@",[_ListArray objectAtIndex:indexPath.row]]; cell.textLabel.text = cellValue; if(refresh <counter) { Nsstring *br = @"<br>"; List = [Nsstring stringWithFormat:@"%@%@%@",List,br,cell.textLabel.text]; NSLog(@"%@",List); refresh ++; } cell.accessoryType =UItableVIEwCellAccessorydisclosureIndicator; return cell;}
如果我尝试使用:
-(NSInteger)tableVIEw:(UItableVIEw *)tableVIEw numberOfRowsInSection:(NSInteger)section { return [_ListArray count];}
我在桌子上什么也没得到.
编辑更新:
确实删除了self.ListArray并使用_ListArray.
在h文件中:
NSMutableArray *ListArray;...@property (retain,atomic) NSMutableArray *ListArray;
然后在m文件中:
@synthesize ListArray = _ListArray;
关于:
self.ListArray = [object objectForKey:@"content"];
对象是PFObject.
我有queryFortable,我从解析中获取数据.
- (PFquery *)queryFortable { PFquery *query = [PFquery queryWithClassname:@"List"]; [query whereKey:@"user" equalTo:[PFUser currentUser]]; // user [query whereKey:@"objectID" equalTo:[theListID objectID]]; // the specific List counter =[query countObjects]; NSLog(@"%d",counter); // If Pull To Refresh is enabled,query against the network by default. if (self.pullToRefreshEnabled) { query.cachePolicy = kPFCachePolicyNetworkOnly; } // If no objects are loaded in memory,we look to the cache first to fill the table // and then subsequently do a query against the network. if ([self.objects count] == 0) { query.cachePolicy = kPFCachePolicyCacheThenNetwork; } [query orderByDescending:@"createdAt"]; return query;}
而对于objectForKey:@“content”];
content是我的类在解析时的列的名称
所以我需要说出我想要的类中的哪个对象,那就是名为“content”的数组列
logg(当NSLog在阵列上处于活动状态时).
InköpsLista[7856:12e03] Warning: A long-running Parse operation is being executed on the main thread. Break on warnParSEOperationOnMainThread() to deBUG.2013-10-21 14:23:31.008 InköpsLista[7856:12e03] 12013-10-21 14:23:31.017 InköpsLista[7856:12e03] OBJECT = ( "Br\U00f6d",Anka,Boll,Sko)2013-10-21 14:23:31.017 InköpsLista[7856:12e03] <HTML><body><br>Bröd2013-10-21 14:23:31.545 InköpsLista[7856:12e03] OBJECT = ( "Br\U00f6d",Sko)解决方法 得到它的工作,确实把数组从解析中获取数据,然后只调用
cell.textLabel.text = [_ListArray objectAtIndex:indexPath.row];
然后我可以使用:
-(NSInteger)tableVIEw:(UItableVIEw *)tableVIEw numberOfRowsInSection:(NSInteger)section { return [_ListArray count];}总结
以上是内存溢出为你收集整理的在tableview(iOS)中显示来自parse.com的数组全部内容,希望文章能够帮你解决在tableview(iOS)中显示来自parse.com的数组所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)