Here i have explained how you can detect which button is clicked:-
1) Assign tag to every button in the properties of button.2) create an IBAction and attach to every button.
-(IBAction)Click:(id)sender
{
NSLog(@"%d",[sender tag]);
}
3) whenever you click a button it would print its tag.
Transfer your tag to next page:
-(IBAction)Click:(id)sender
{
Main *subCat=[[Category alloc]initWithNibName:@"Category" bundle:nil];
subCat.getCatVal=[sender tag];
[self.navigationController pushViewController:subCat animated:YES];
}
// this would assign the tag to the next page getCatVal variable.
Wanna use selecto to call that you can write:-
[btnImage2 addTarget:self action:@selector(Click:)forControlEvents:UIControlEventTouchUpInside];
No comments:
Post a Comment