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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T04:24:11+00:00 2026-06-18T04:24:11+00:00

Does a UIView create an intrinsicContentSize ? I create a UIView contentView. I do

  • 0

Does a UIView create an intrinsicContentSize?

I create a UIView contentView. I do not give it constraints size:

UIView *contentView = [UIView new];
[contentView setTranslatesAutoresizingMaskIntoConstraints:NO];
contentView.backgroundColor = [UIColor orangeColor];

I create another UIView subview01. I give it constraints size and add it to my contentView:

UIImageView *imageView = [[UIImageView alloc] initWithImage:image];
[imageView setTranslatesAutoresizingMaskIntoConstraints:NO];
imageView.userInteractionEnabled = TRUE;
imageView.backgroundColor = [UIColor clearColor];

[imageView addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"H:[imageView(WIDTH)]"
                                                                  options:0
                                                                  metrics:@{@"WIDTH" : [NSNumber numberWithFloat:imageSize.width]}
                                                                    views:NSDictionaryOfVariableBindings(imageView)]];

[imageView addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"V:[imageView(HEIGHT)]"
                                                                  options:0
                                                                  metrics:@{@"HEIGHT" : [NSNumber numberWithFloat:imageSize.height]}
                                                                    views:NSDictionaryOfVariableBindings(imageView)]];


[contentView addSubview:imageView];

contentView does does not gain any size. I thought the intrinsicContentSize is suppose to calculate the size needed to show all subviews and resize itself? Like how a UILabel will resize to show all of its text?

  • 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-18T04:24:13+00:00Added an answer on June 18, 2026 at 4:24 am

    No, a UIView does not have an intrinsicContentSize. Buttons and labels do, since it’s easy for the system to calculate that size based on the string and or image in them. For a UIView, you generally need 4 constraints to fully describe its position and size.

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

Sidebar

Related Questions

According to the documentation for -[UIView setNeedsLayout] : Because this method does not force
I have a UIView parentView which implements a UITapGuestureRecognizer and does something when tapped.
Autofocus is not working on the first AVCaptureSession when I create a second AVCaptureSession.
I am attempting to create a UIView (and associated UIViewController ) which mimic the
For instance: Create a new UIVC using initWithNibName, using nib-v1 Display it, e.g. using
I have a UIView of size width=320px height=40px which I want to display at
I have customized UIView to create a custom UI component. The hierarchy of views
I create & present modally an UITableViewController(say Table2) class from another UITableViewController class(say Table1)
I'm trying to create a simple animation when switching from a view to another
I'm trying to create my own UIView subclass. I've placed it on my view

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.