You need to do an IBOutlet a @property and define a getter for this property via @synthesize or you can define your own getter, here is an example of the first:
@interface ClassA : NSObject { UIView *someView; } @property (nonatomic, retain) IBOutlet UIView *someView; @end @implementation ClassA @synthesize someView; ... @end
Then in ClassB you can do this:
@implementation ClassB - (void) doSomethingWithSomeView { ClassA *a = [ClassA new]; UIView *someView = [a someView]; //do something with someView... } ... @end
source share