Reputation: 4111
i am having a view consisting of a tableview and a uibutton like this
when i click on button "add" a new class/xib named "Locsetting" should be open.which i am not able to do. my code: .h file
@interface LocationViewController : UIViewController <UITableViewDelegate,UITableViewDataSource>
{
UITableView *table;
NSMutableArray *menuList;
LocSetting *locSetting;
IBOutlet UIButton *addbutton;
}
@property (nonatomic,retain) NSMutableArray *menuList;
@property (nonatomic,retain) IBOutlet UITableView *table;
@property (nonatomic,retain) LocSetting *locSetting;
@property (nonatomic, retain) IBOutlet UIButton *addbutton;
-(IBAction)gotoLocSetting:(id) sender;
@end
My .m :
@synthesize addbutton;
-(IBAction)gotoLocSetting:(id) sender {
NSLog(@"gotoLocSetting Entered");
locSetting = [[LocSetting alloc]
initWithNibName:@"LocSetting"
bundle:nil];
//locationViewController.menuList = [menuList objectAtIndex:indexPath.row];
[self.navigationController pushViewController:locSetting
animated:YES];
[locSetting release];
}
what wrong i am doing?or please guide me! Thanks
Upvotes: 0
Views: 286
Reputation: 26400
Make sure the IBAction is connected properly to the button. And I think its better to have IBOutlet UIButton *addbutton;
alone and @property (nonatomic, retain) UIButton *addbutton;
Upvotes: 0
Reputation: 6132
On a quick look, there might be one of the following 3 problems:
Is your IBAction linked to the button's outlet?
If not, try removing LocSetting *locSetting;
and its property/synthesize. Next, change your line down there to: Locsetting *locSetting = [[LocSetting alloc] initWithNibName:@"LocSetting" bundle:nil];
If that doesn't work, try changing that to: Locsetting *locSetting = [[LocSetting alloc] initWithNibName:nil bundle:nil];
Upvotes: 1