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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T19:13:30+00:00 2026-05-27T19:13:30+00:00

I create an UIView in applicationDidFinishLaunchingWithOptions method: CGRect inputTextViewRect = CGRectMake(0, 420, 320, 80);

  • 0

I create an UIView in applicationDidFinishLaunchingWithOptions method:

CGRect inputTextViewRect = CGRectMake(0, 420, 320, 80);
UIView *inputTextView = [[UIView alloc] initWithFrame:inputTextViewRect];
inputTextView.backgroundColor = [UIColor grayColor];

Then I create two subviews – one UIButton and one UITextView:

UITextView *inputTextField = [[UITextView alloc] initWithFrame:CGRectMake(10, 450, 230, 20)];
UIButton *sendButton = [UIButton buttonWithType:UIButtonTypeRoundedRect];
CGRect buttonFrame = CGRectMake(250, 450, 50, 20);

My problem is if I add my inputTextField and sendButton as subviews to main window – they will be visible and working. If I add them to my UIView:

[inputTextView addSubview:inputTextField];
[inputTextView addSubview:sendButton];

And then add this view to main window:

[self.window addSubview:inputTextView];

In this case i see only gray background of inputTextView and no subviews that were added before.
Could you please help me figure out whats wrong with it?

  • 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-27T19:13:31+00:00Added an answer on May 27, 2026 at 7:13 pm

    The problem is with your CGRectMake call:

    CGRectMake(x, y, width, height); 
    

    x and y and are coordinates where you want to place the element over the super view, so you have the following, which is incorrect:

    CGRect inputTextViewRect = CGRectMake(0, 420, 320, 80);
    UITextView *inputTextField = [[UITextView alloc] initWithFrame:CGRectMake(10, 450, 230, 20)]; 
    CGRect buttonFrame = CGRectMake(250, 450, 50, 20);
    

    Try changing those to

    CGRect inputTextViewRect = CGRectMake(0, 0, 320, 80);
    UITextView *inputTextField = [[UITextView alloc] initWithFrame:CGRectMake(0, 0, 230, 20)];
    CGRect buttonFrame = CGRectMake(0, 0, 50, 20);
    

    After changing this you will be able to see UITextView and UIButton, then you make the x and y position changes according to your need.

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

Sidebar

Related Questions

// Create and add a sub view CGRect viewRect = CGRectMake(0, 0, 200, 200);
I'm planning to create a UIView with UIButtons and I want that UIView to
What is the best way to create a custom UIView that I can consume
I am trying to create a delegate protocol for a custom UIView. Here is
Any recommendations on what UIView to use on the iPhone to create a listed
I am wondering how I can create an outer glow effect outside a UIView
I'd like to be able to create my own container subclasses of UIView which
I would like to create a UIView has multiple UITextFields validates each one as
I need to create my own UIView class and it is not something I
Ahoy! I'm trying to create a reusable UIView (for various reasons) similar to the

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.