I am trying to trigger a custom delegate method inside the delegate method - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath. Everything looks fine except I have never reached my custom delegate method which should be triggered by tapping a row. here is my implementation of delegation:
@class SettingsList; @protocol SettingsListDelegate - (void) retrieveSettings:(SettingsList*)tableController Nazov:(NSString*)Nazov; @end @interface SettingsList : UITableViewController { id delegate; } @property (nonatomic, assign) id delegate; @end @synthesize delegate; - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { NSString *Nazov = [NSString stringWithString:[[self displayedObjects] objectAtIndex:indexPath.row]]; NSLog(@"Vybral som %@", Nazov); [delegate retrieveSettings:self Nazov:Nazov]; }
The property definition of delegate is correct, but not visible on this site due to <> it is taking as a tag.
in the second class it is like this
@interface ShakeControl : UIViewController - (void) retrieveSettings:(SettingsList*)tableController Nazov:(NSString*)Nazov{ }
but never actually reach it in this case. Not sure what is wrong because use to delegate many times before and work fine and now stucked for hours...any help, will be appreciated ..thanks
You should do it like this: In header:
In code:
In another class - add to definition: