开发者

Internal compiler error: Bus error

开发者 https://www.devze.com 2023-02-12 02:32 出处:网络
Im trying to make a UITableView with a View with Details but I get two errors. After the following code I got two times the same errors:

Im trying to make a UITableView with a View with Details but I get two errors. After the following code I got two times the same errors: 'Internal compiler error: Bus error' and I have no idea why? Can someone help me? You can find a image of the code under here.

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {

NSInteger row = [indexPath row];
if (self.verwaltungDetailV开发者_开发知识库iewController == nil){
    verwaltungDetailViewController *aVerwaltungDetail = [[verwaltungDetailViewController alloc] initWithNibName:@"VerwaltungDetailView" bundle:nil];
    self.verwaltungDetailViewController = aVerwaltungDetail;
    [aVerwaltungDetail release];

}
verwaltungDetailViewController.title =  [NSString stringWithFormat:@"%@", [verwaltungsArray objectAtIndex:row]];



NatersAppDelegate *delegate = [[UIApplication sharedApplication] delegate];
[delegate.VerwaltungNavController pushViewController:verwaltungDetailViewController animated:YES];

}

Thanks a lot in advance for your help!


It looks to me like you've got a class somewhere called VerwaltungDetailViewController (note the uppercase 'V') and you are mixing it up with an instance variable & property called verwaltungDetailViewController (note the lowercase 'v'). In the first line of the if block, you are attempting to create an instance of the latter, when you should be attempting to create an instance of the former. Your code should look something like this:

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {

NSInteger row = [indexPath row];
if (self.verwaltungDetailViewController == nil){
    VerwaltungDetailViewController *aVerwaltungDetail = [[verwaltungDetailViewController alloc] initWithNibName:@"VerwaltungDetailView" bundle:nil];
    self.verwaltungDetailViewController = aVerwaltungDetail;
    [aVerwaltungDetail release];

}
verwaltungDetailViewController.title =  [NSString stringWithFormat:@"%@", [verwaltungsArray objectAtIndex:row]];



NatersAppDelegate *delegate = [[UIApplication sharedApplication] delegate];
[delegate.verwaltungNavController pushViewController:verwaltungDetailViewController animated:YES];

Edit: You also make the mistake in the last line of code, except in reverse.

0

精彩评论

暂无评论...
验证码 换一张
取 消