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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T08:00:36+00:00 2026-05-20T08:00:36+00:00

I have successfully loaded a view from an xib file on to a window(another

  • 0

I have successfully loaded a view from an xib file on to a window(another xib) dynamically as a subview.
I understand that by default this subview is loaded in the first quadrant of the window i.e.,the subview is at the extreme left bottom of the window. It is the same case with my window as well.
Now the issue is that how do i place the subview elsewhere on the window. In other words, if i want to place the subview on the top of my window, how would i achieve it??

Also I would really appreciate if i can get an explanation for NSRect and frame for NSwindow objects..
If there are any methods in any of the APIs, please direct me to them.. Thanks in advance…

UPDATE:

@interface ViewAvailableItemsWindowController : NSObject {
    IBOutlet NSWindow * viewAvailableItemsWindow; //Window in question
    IBOutlet NSView * viewAvailableItemsView; //View in question

    ItemSearchViewController * instanceItemSearchView; //ViewController object 
}

@end


@implementation ViewAvailableItemsWindowController

-(void)awakeFromNib{
    [viewAvailableItemsWindow makeKeyAndOrderFront:nil];
    instanceItemSearchView = [[ItemSearchViewController alloc]initWithNibName:@"ItemSearchView" bundle:nil] ; //Initiating the viewController with the nib for the view.
    [viewAvailableItemsView addSubview:[instanceItemSearchView view]];  //Adding the subview to the window..

}

-(void)dealloc{
    [instanceItemSearchView release];
    [super dealloc];
}

@end

This loads the view on the first quadrant of the window- i mean the bottom left corner of the window. I want the view to be placed on the top center of the window.

  • 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-20T08:00:37+00:00Added an answer on May 20, 2026 at 8:00 am

    An NSRect is a rectangle. It’s composed of an origin and a size. An origin is a point, x and y. A size is width and height. From now on I’ll type rects as {{x, y}, {width, height}}

    Each view has a frame. The frame of a view is the position of that view within its superview. Each view also has a bounds. The bounds of a view defines the internal coordinate system of the view. By default 0, 0 is in the lower left corner, and as X and Y increase you move to the right and up.

    Example: If one view had a bounds of {{0, 0}, {100, 100}}, and you put another view inside of that view and set its frame to {{25, 50}, {10, 10}} then the subview would have the size 10×10, and be position 25 points to the right of the left edge, and 50 points up from the bottom.

    The bounds size is almost always the same as the frame size. You typically do not set or adjust the bounds of a view unless you intend to scale or shift all of the subviews and custom drawing – this is an advanced thing to do.

    So if you had something like this:

    +-------------------+
    |     +----------+  |
    |     |   +---+  |  |
    |  A  | B | C |  |  |
    |     |   +---+  |  |
    |     +----------+  |
    |                   |
    |                   |
    +-------------------+
    

    Where each box represents an NSView, and each view is a subview of the next. So A contains B, contains C. The bounds and frames of each of the views might be something like this:

          Bounds                Frame
          {{X, Y},  {W,  H}}    {{ X,  Y},  {W,  H}}
    A     {{0, 0}, {30, 30}}    {{ 0,  0}, {30, 30}}
    B     {{0, 0}, {20, 15}}    {{20, 20}, {20, 15}}
    C     {{0, 0}, {10, 10}}    {{10, 10}, {10, 10}}
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have created thumbnail view using Three20 bundle. I have successfully loaded and displayed
I have successfully connected to an Oracle database (10g) from C# (Visual Studio 2008)
I have a Rails app that I have successfully tested with Mongrel and Webkit.
I believe that I have successfully impersonated my own user account while running an
What I have now (which successfully loads the plug-in) is this: Assembly myDLL =
I have a script that successfully encrypts a credit card. I need it to
I have a working UITableView in my view controller. It is being successfully populated
I'm familiar with the LAMP stack and over the years have successfully deployed a
using the Code Snippet for sending email in VB.Net I have successfully sent an
I'm just learning Qt with C++. I have successfully implemented signals and slots to

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.