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
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;