Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8309155
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T19:01:23+00:00 2026-06-08T19:01:23+00:00

I have a main ViewController: @interface ViewController : UIViewController There i have a property

  • 0

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:

enter image description here

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.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-08T19:01:25+00:00Added an answer on June 8, 2026 at 7:01 pm

    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.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the main View controller which adds 2 subviews. - (void)viewDidLoad { [self
ViewController.h @interface ViewController : UIViewController{ CFSocketRef s; int connectFlag; } ViewController.m void receiveDataCilent(CFSocketRef cs,
I have main table called 'Employee' and another slave table called 'EmployeeTypes' that has
I have a UIViewController called LaunchController that is launched in my iPhone app when
Inside Interface Builder I have a UINavigationController, which contains a UIViewController, which has a
I have subclassed UIViewController like so: @interface MyClass : UIViewController I dont have a
I have a button that open another viewController (familyView) when clicked. In familyView there
I have a main view controller that consists of 1 button that when tapped,
Ok, so here's the situation. I currently have a view controller called MainViewController which
I have main window which has inner grid components. When I press a button

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.