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

  • Home
  • SEARCH
  • 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 6701745
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T06:58:15+00:00 2026-05-26T06:58:15+00:00

There are 4 items on MyViewController.xib window: File’s Owner (of type MyViewController) First Responder

  • 0

There are 4 items on MyViewController.xib window:

  1. File’s Owner (of type MyViewController)
  2. First Responder (of type UIResponder)
  3. View (of type UIScrollView)
  4. FloatingView (of type UIView)

Both View and FloatingView contain some controls (such as labels and text fields…), and are designed using IB. The FloatingView must NOT occupy the full screen; and my app functionality requires the FloatingView to move to a newly tapped location when user taps on the screen.

An instance variable UIView *myFloatingView; is defined as a property/IBOutlet and synthesized, which is connected to the FloatingView view on IB.

On viewDidLoad method, I am adding myFloatingView to my view controller’s view as its subview as:

-(void)viewDidLoad {
    [super viewDidLoad];

    CGRect myFrame = CGRectMake(50, 50, 150, 150); //initial location
    self.myFloatingView.frame = myFrame;
    [self.view addSubview:self.myFloatingView];
}

Apple documentation says each UIViews should have a corresponding view controller. However, I am using only one view controller here. I am treating the floating UIView object as a regular control, or say as a panel. I might in future allow user to hide/unhide this floating view.

Is this a good practice, or is there a better way (any example) to do what I am trying to do?

Thank you very much for your help.

  • 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-26T06:58:16+00:00Added an answer on May 26, 2026 at 6:58 am

    What you are doing is fine. In fact, a viewController can often control a whole hierarchy. Also, you said your floatingView was in the same nib as your root view? If so, you can probably make it a subview there, instead of adding as a subview in viewdidLoad.

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

Sidebar

Related Questions

Assuming there are 5 items in the settings file ( MySetting1 to MySetting5 ),
Are there any handy general items you put in your .procmailrc file?
I have a tabBarController xib. I've set the first item's class to a view
I have a requirement to display a table view if there are items to
I have a form where there are 6 items, each of which can be
In FlexBuilder 3, there are two items under the 'Data' menu to import and
There is an XMLList of items, each item has three properties: prop1, prop2, and
Is there anyway to have items in an ASP.NET DropDownList have either their Text
There exists an RSS feed with over 1000 items. I want to create a
There's a ListBox with some long items. These long items are getting beyond 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.