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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T07:50:39+00:00 2026-06-14T07:50:39+00:00

I have UIViewController with UIScrollView and two labels and a button inside it: UIView

  • 0

I have UIViewController with UIScrollView and two labels and a button inside it:

UIView
  -UIScrollView
    -UILabel
    -UILabel
    -UIButton

I need to align my UILabels and UIButton after each other dynamically, as every view can have different size. UILabels are okay, but my UIButton goes into the middle of my second UILabel
Here is my code:

self.header.text = event.title;
self.header.numberOfLines = 0;
CGFloat headerHeight = [event.title sizeWithFont:[UIFont fontWithName:@"Arial" size:20] constrainedToSize:CGSizeMake(280, 100000) lineBreakMode:UILineBreakModeWordWrap].height;
self.header.frame = CGRectMake(19, 20, 280, headerHeight);

CGFloat positionY = 40 + [self.header.text sizeWithFont:[UIFont fontWithName:@"Arial" size:20] constrainedToSize:CGSizeMake(280, 100000) lineBreakMode:UILineBreakModeWordWrap].height;

CGFloat descriptionHeight = [event.descr sizeWithFont:[UIFont systemFontOfSize:17] constrainedToSize:CGSizeMake(280, 100000) lineBreakMode:UILineBreakModeWordWrap].height;
self.descr.frame = CGRectMake(19, positionY, 280, descriptionHeight);
self.descr.text = event.descr;
self.descr.numberOfLines = 0; 

positionY =  self.descr.frame.origin.y + self.descr.frame.size.height + 40;

buyButton.frame = CGRectMake(19, positionY, 72, 37);

scrollView.contentInset = UIEdgeInsetsMake(contentInset, 0, 0, 0);
[scrollView setContentSize:CGSizeMake(320, positionY+80)];

UIScrollView has flexible height autoresizing mask set in IB.

Here is how it looks:

enter image description here

Can anyone tell me what am I doing wrong?

UPDATE:

If I remove autoresizing mask for my UIScrollView – everything works okay

  • 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-14T07:50:40+00:00Added an answer on June 14, 2026 at 7:50 am

    If your problem resolves itself by changing the autoresizing mask on the scroll view, be sure to check the autoresizing mask on your buttons and labels to make sure they all agree.

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

Sidebar

Related Questions

I got a UIViewController and I have a UIScrollView with a few UITextFields inside.
So I have a UIViewController subclass called MyTabBarViewController that has a UIScrollView. Inside of
At the moment I have a UIViewController subclass with a UIScrollView and a UIView
I have a UIViewController , it's a view ( UIView ) containing two elements
I have a UIViewController with a UIScrollView inside, all the content is displayed in
I'm a little stuck on this one, I have a UIButton inside a UIViewController
I made a UIScrollView inside a UIViewController I have like 5 ViewControllers my problem
I have an application where I'm trying to pass a UIScrollView from one UIViewController
I have a series of UIViews inside a UIScrollView, and the UIViewControllers for those
I have a uiviewcontroller with two properties: trackName and playerObject. PlayerObject also has a

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.