29,048
社区成员




-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
static NSString *myIdentifier=@"OnlineCell";
static BOOL nibsRegistered = NO;
if (!nibsRegistered) {
UINib *nib = [UINib nibWithNibName:@"OnlineCell" bundle:nil];
[tableView registerNib:nib forCellReuseIdentifier:myIdentifier];
nibsRegistered = YES;
}
NSLog(@"*********3");
OnlineCell *cell = [tableView dequeueReusableCellWithIdentifier:myIdentifier];
NSUInteger row=[indexPath row];
NSMutableDictionary *classDic = [CLASSNAMES objectAtIndex:[indexPath section]];
NSString *classid = [classDic objectForKey:@"id"];
NSLog(@"classid:%@",classid);
if([classVideoDic count]>0 && classid!=nil){
NSLog(@"*********??");
NSMutableArray *array = [classVideoDic objectForKey:classid];
NSMutableDictionary *dic =[array objectAtIndex:row];
NSLog(@"*********4");
NSString *cellName = [dic objectForKey:@"videoname"];
NSString *pic = [dic objectForKey:@"videopicurl"];
NSLog(@"*********5");
// NSLog(@"%@",cellName);
[cell.onlineLabel setText:cellName];
NSData* imageData = [[NSData alloc]initWithContentsOfURL:[NSURL URLWithString:pic]];
UIImage *image = [[UIImage alloc]initWithData:imageData];
[cell.imageView setImage:image];
}
return cell;
}
classVideoDic = [NSMutableDictionary dictionaryWithCapacity:5];
for (int i=0; i<[classVideoArray count]; i++) {
NSMutableDictionary *dic =[classVideoArray objectAtIndex:i];
NSString *classId = [dic objectForKey:@"videoclassid"];
if([classVideoDic objectForKey:classId]==nil){
NSLog(@"isnil");
NSMutableArray *array = [NSMutableArray arrayWithObjects:dic, nil];
[classVideoDic setObject:array forKey:classId];
}else{
NSLog(@"notnil");
NSMutableArray *array = [classVideoDic objectForKey:classId];
[array addObject:dic];
[classVideoDic setObject:array forKey:classId];
}
};
self.dataItems = classVideoArray;
NSLog(@"cc==%d",[classVideoDic count]);
NSLog(@"bb==%d",[classVideoArray count]);