I have a main view to which I have added a subview using the following code:
-(IBAction)launchPage:(id) sender
{
ActivityViewController *activityViewController = [[ActivityViewController alloc] initWithNibName:@"ActivityViewController" bundle:nil];
activityViewController.view.frame = CGRectMake(183, 104, 841, 573);
activityViewController.view.backgroundColor = [UIColor colorWithPatternImage:[UIImage imageNamed:@"activity_bckgrnd.png"]];
[self.view addSubview:activityViewController.view];
}
I have buttons on this xib file to which I am trying to add button events. But when I click on the button after assigning IBAction, I am getting an EXEC BAD ACCESS error at
int main(int argc, char *argv[])
{
@autoreleasepool {
return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class]));
}
Can anyone please let me know what the mistake might be. I have enabled ARC for the project.
In .h file of view controller that I have added as subview, I have declared
@property(strong,retain) UIButton *billingAddressChkBox;
and in the .m file, The IBAction looks like
- (IBAction)checkboxButton:(id)sender{
if (checkboxSelected == 0){
[billingAddressChkBox setSelected:YES];
checkboxSelected = 1;
} else {
[billingAddressChkBox setSelected:NO];
checkboxSelected = 0;
}
}
I have enabled zombies and I get the following message.
message sent to deallocated instance
Can I know which instance is getting deallocated from its address?
I had to just initialize
in the header file and access it from the .m file. That solved the issue.