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 4110314
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T21:55:05+00:00 2026-05-20T21:55:05+00:00

In my application, when the user clicks an infoButton, it should add another view

  • 0

In my application, when the user clicks an infoButton, it should add another view to the screen at a specific location. I’m trying to achieve this behavior with the following method:

- (IBAction)showInfo1:(id)sender
  {
    UIView *myView1 = [[UIView alloc] initWithFrame:CGRectMake(25,25,50,20)];   
    [self.view addSubview:myView1]; 
  }

(I declared everything in the header file of my class.)

When I run the code and press the button, nothing appears to happen (I don’t see the new view).

I also noticed that XCode is displaying the following warning:

Local declaration of ‘myView1’ hides instance variable.

Does anyone have any ideas?

  • 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-05-20T21:55:05+00:00Added an answer on May 20, 2026 at 9:55 pm

    How do you know nothing changes?

    It looks like myView1 doesn’t actually contain anything. Try setting the background color of myView1

    - (IBAction) showInfo1: (id) sender
    {
        UIView *myView1 = [[UIView alloc] initWithFrame:CGRectMake(25,25,50,20)];   
        myView1.backgroundColor = [UIColor redColor];
        [self.view addSubview: myView1]; 
    }
    

    To open it at a specific point you need to change the parameters in CGRectMake() for example

    to open it at the very top left with a width of 50 and height of 20 you would do:

    CGRectMake(0, 0, 50, 20)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In my application what is want is when user clicks on button next view
In my ASP.Net application I have a requirement that when a user clicks on
In a fictitious web application ... The user clicks a link The server starts
I have created an application that runs in the taskbar. When a user clicks
I have an ASP.NET MVC application, when a user clicks on the submit button
In a web application I am working on, the user can click on a
I have an application that shows a list of items. The user can click
We have a current application where user login credentials are stored in a SQL
I've got a multi-user application having some critical data of the users. I am
For part of a web application the user needs to import some data from

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.