Objective c 如果没有崩溃消息,我的表视图将崩溃
这是我的代码,请验证它,朋友:Objective c 如果没有崩溃消息,我的表视图将崩溃,objective-c,uitableview,Objective C,Uitableview,这是我的代码,请验证它,朋友: -(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView { NSInteger count=[[arrParsingProduct valueForKey:@"description"] count]; return count; } -(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(
-(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
NSInteger count=[[arrParsingProduct valueForKey:@"description"] count];
return count;
}
-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
NSInteger count=[[arrParsingProduct valueForKey:@"description"]count];
return count;
}
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
productSub=[tableView dequeueReusableCellWithIdentifier:@"cell1"];
NSLog(@"entering");
productSub.lblSubProduct.text=[NSString stringWithFormat:@"%@",[[arrParsingProduct objectAtIndex:indexPath.row] valueForKey:@"description"]];
return productSub;
}
-(UIView*)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section
{
NSString *str=[NSString stringWithFormat:LocalImage@"%@",[[arrParsingProduct objectAtIndex:section] valueForKey:@"image"]];
self.imgHeader.image=[UIImage imageWithData:[NSData dataWithContentsOfURL:[NSURL URLWithString:str]]];
self.lblHeaderproduct.text=[NSString stringWithFormat:@"%@",[[arrParsingProduct objectAtIndex:section] valueForKey:@"name"]];
self.lblHeaderCost.text=[NSString stringWithFormat:@"%@",[[arrParsingProduct objectAtIndex:section]valueForKey:@"price"]];
[self.btnHeader addTarget:self action:@selector(touchup:) forControlEvents:UIControlEventTouchUpInside];
return self.view;
}
没有崩溃消息。我试图用断点来找出问题所在。我感到困惑。请任何人告诉我可能是什么问题?在viewforheaderin部分,您正在返回self.view;这不是创建UIView对象并返回该对象的正确方法
UIStoryboard *objStoryboard = [UIStoryboard storyboardWithName:@"Main" bundle:nil];
ViewController *objVC = [objStoryboard instantiateViewControllerWithIdentifier:@"headerView_identifier"];
return objVC.view;
数组[arrParsingProduct]中的“description”包含哪个值?它包含字符串值@meghsdhameliya我看不到productSub的类型(UItableViewCell*productSub),另一个问题是dequeueReusableCellWithIdentifier,您应该使用DequeueReusableCellWithIdentifier来扩展字典值的数组组是否存在…@meghsdhameliya这是表视图单元格类@MohamadFarhand