I have a main ViewController:
@interface ViewController : UIViewController
There i have a property with my ScreenView: @property (strong,nonatomic) MUIScreenView* screenView;
And it will called by:
- (void)viewDidLoad
{
[super viewDidLoad];
[self.view addSubview:_screenView];
}
Now take a look in my MUIScreenViewClass:
@interface MUIScreenView : MUIView
@interface MUIView : UIView
In my MUIScreenView i have a method:
-(void)addScreenObjectToView
{
MUIButton *button = [[MUIButton alloc] initWithButtonModel:(ButtonModel*)MUIElement
[self addSubview:button];
UIButton *myButton = [UIButton buttonWithType:UIButtonTypeRoundedRect];
myButton.frame = CGRectMake(10, 220, 300, 40);
[myButton setTitle:@"This is Standard UIButton!" forState:UIControlStateNormal];
[myButton addTarget:self action:@selector(buttonPressed:) forControlEvents:UIControlEventTouchUpInside];
[self addSubview:myButton];
}
And this is my MUIButton method to draw something:
-(void)addButtonToView
{
UIButton *myButton = [UIButton buttonWithType:UIButtonTypeRoundedRect];
myButton.frame = CGRectMake(10, 50, 300, 40);
[myButton setTitle:@"This is a MUIButton!" forState:UIControlStateNormal];
[myButton addTarget:self action:@selector(buttonPressed:) forControlEvents:UIControlEventTouchUpInside];
[self addSubview:myButton];
}
And finally i have:
How it’s possible that top button is dead? if i touch on it nothing happend. I created it excatly the same way.
summarizing – what I currently display as a “This is a MUIButton!” is a View contains another View and in second view i have UIButton.
as a “This is a Standard UIButton!” is a View contains UIButton.

You need to pass a reference to your main view controller’s view to your subview and then add the button to that view. You can’t call a selector on a different view and have the correct view receive it.