0

i try to lad a UIViewController on UIButton click

GehaltVIew.m

#import "GehaltVIew.h" #import "Berechnen.h" - (UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section { UIView *footerView = [[UIView alloc] init]; UIButton *berechnenButton = [UIButton buttonWithType:UIButtonTypeRoundedRect]; berechnenButton.frame = CGRectMake(10, 10, 300, 40); [berechnenButton setTitle:@"Berechnen!" forState:UIControlStateNormal]; [berechnenButton addTarget:self action:@selector(berechnenGehalt) forControlEvents:UIControlEventTouchUpInside]; [footerView addSubview:berechnenButton]; return footerView; } - (void)berechnenGehalt { Berechnen *dvController = [[Berechnen alloc] initWithNibName:@"Berechnen" bundle:nil]; self.view = dvController; } 

but i get this error:

2011-07-22 14:51:59.598 Seminar App2[33791:207] -[Berechnen setFrame:]: unrecognized selector sent to instance 0x5d05bd0

1 Answer 1

2

From this statement:

 Berechnen *dvController = [[Berechnen alloc] initWithNibName:@"Berechnen" bundle:nil]; 

it seems to me the Berechnen should be a UIViewController, not a UIView, so the next line should be:

self.view = dvController.view; 

Please, also notice that in tableView:viewForFooterInSection you are possibly leaking footerView. I think that you should autorelease the footerView:

UIView *footerView = [[[UIView alloc] init] autorelease]; 
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.