How to call a method in another class?

I would like to have only one class for control my menu. I try used this:

In the .h

 #define Generic ((AppDelegate*)[[UIApplication sharedApplication] delegate])
 #import <UIKit/UIKit.h>

 @interface Generic : UIViewController

 - (IBAction)photo:(id)sender;

 @property (nonatomic, strong) NSString *apareceMenu;

 @end

in the .m

- (IBAction)photo:(id)sender{
    NSLog(@"Ok");

}

Now i need read the - (IBAction)photo in other class, But i don't know how.

I believe to be something

[Generic photo];

Could someone help me please?

Answers


Follow the instructions in this post:

How to call method from one class in another (iOS) http://stackoverflow.com/a/9731162/2274694


[Generic photo:] is correct method to call the function. Before the you must do this steps in another class.

Generic *genericObj = [[Generic alloc]initWithNibName:@"Generic" bundle:nil];

then you call your class like,

[genericObj photo];


create object for Generic class and call photo via that object [genericObj photo];


Need Your Help

Java on-the-fly string replacement

java string replace

I've seen something like this in code

Arrows/HXT and Type Signatures

haskell types monads arrows hxt

I am trying to learn Arrows in Haskell, so I am writing a simple application with the arrow based HXT library for XML. The examples in the HXT wikis and tutorials forgo function type signatures. Ho...

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.