我正在为 iPad 开发一个应用程序,其中包含UITableView
. 该应用程序在模拟器上运行良好,但在安装并第一次运行时会在设备上崩溃。当我第二次尝试运行该应用程序时,它工作正常。我无法弄清楚问题所在。相同的代码在 iPhone 上运行良好,但在 iPad 上崩溃。我正在为表格使用以下代码
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *MythoViewCellIdentifier = @"MythoViewCellIdentifier ";
UITableViewCell *cell=[tableView dequeueReusableCellWithIdentifier:MythoViewCellIdentifier];
if (cell==nil)
{
cell=[[[UITableViewCell alloc] initWithFrame:CGRectZero] autorelease];
}
[self getMythoData];
UIImageView *imgLogo =[[UIImageView alloc] initWithFrame:CGRectMake(-1,0,37,35)];
imgLogo.backgroundColor =[UIColor clearColor];
imgLogo.image=[UIImage imageNamed:@"bullet_swastik.png"];
[cell.contentView addSubview:imgLogo];
UITextView *txtDetails =[[UITextView alloc] initWithFrame:CGRectMake(37,34,740,200)];
txtDetails.backgroundColor =[UIColor clearColor];
txtDetails.editable=NO;
txtDetails.font=[UIFont systemFontOfSize:25.0];
[cell.contentView addSubview:txtDetails];
// adding details to the cell
txtDetails.text = [NSString stringWithFormat:@"%@",[FinalmythoData objectAtIndex:indexPath.row]];
cell.selectionStyle = UITableViewCellSelectionStyleNone;
[txtDetails release];
return cell;
}
I'm getting the following error
Exception Type: EXC_BAD_ACCESS (SIGSEGV) Exception Codes:
KERN_INVALID_ADDRESS at 0x00000000 Crashed Thread: 0
Thanks