何らかのクラスをつくり、ViewControllerからクラスを生成して そのクラス(以下TestClass)のメソッドにアクセスします。 TestClassのメソッドから呼び出し元のViewControllerの変数若しくはメソッドに アクセスすることはできるのでしょうか? 例) @interface ViewController : UIViewController{ UIlabel *label; //TestClassから書き込みたい } @end @implementation ViewController -(void)viewDidLoad{ TestClass *class = [[TestClass alloc] init]; [class labelWrite];//クラス呼び出し } - (void)hoge{ //TestClassからここにアクセスしたい //処理 } @end @interface TestClass : NSObject @end @implementation TestClass - (void)labelWrite{ //ここからViewControllerのlabelに書き込みたい //もしくはViewControllerのhogeメソッドにアクセスしたい } @end
↧