@ leonid3452 , Good time of day! I will try to explain with my own example. Suppose there are two classes:
"ViewController : UIViewController" и "DetailController : UIViewController"
And we need to pass a method:
- (void)displayLog Ń "ViewController" в "DetailController"
And so, let's proceed to the implementation: 1 What needs to be done is to make sure that the method is declared in "ViewController.h" approximately looks like this:
//ViewController.h @interface ViewController : UIViewController { } - (void) displayLog; @end
Go to ViewController.m. Implement the method:
//ViewController.m @interface ViewController () @end @implementation ViewController - (void) displayLog { NSLog(@"Hello"); } @end
Next, you need to call this method (- (void) displayLog;) in the DetailController, say by pressing a button, implement:
//DetailController.h @interface DetailController : UIViewController { } - (IBAction)button:(id)sender; @end
Go to .m:
//DetailController.m @interface DetailPassword () @end @implementation DetailPassword - (IBAction)button:(id)sender { ViewController *viewCon = [[ViewController alloc] init]; [viewCon displayLog]; } @end
I hope that explained clearly. If you do not understand, ask questions.