maddy
maddy

Reputation: 4111

Not able to push next view after clicking a uibutton which is on the top right of the view

i am having a view consisting of a tableview and a uibutton like thisenter image description here

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

Answers (2)

visakh7
visakh7

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

Joetjah
Joetjah

Reputation: 6132

On a quick look, there might be one of the following 3 problems:

  1. Is your IBAction linked to the button's outlet?

  2. 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];

  3. If that doesn't work, try changing that to: Locsetting *locSetting = [[LocSetting alloc] initWithNibName:nil bundle:nil];

Upvotes: 1

Related Questions