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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T03:25:24+00:00 2026-06-12T03:25:24+00:00

I am trying to figure this out despite reading Apple docs such as the

  • 0

I am trying to figure this out despite reading Apple docs such as the guide for Windows and Views.

My issue is best illustrated by this screen capture:

enter image description here

As you can see the blog post has a picture with variable height (but fixed width = 320px), which may or may not overlap with the view element below it, which is a label.

Similar to what one would do with CSS, I would need the UIImageView to be “display:block”, as well as the label.

So if the image occupies more or less vertical space, the element below would adjust its position accordingly. Is this only done programatically?

I’ve tried to do this hierarchically by placing each in their separate view to no avail.
“Clip subviews” is unticked.

Any advice on the general procedure to get this done, or links to relevant material is greatly appreciated.


Controller code (postTextLabel and postPicture are connected IBOutlets)

#import "DetailViewController.h"

@interface DetailViewController ()

- (void)configureView;

@end

@implementation DetailViewController;

@synthesize scroller;

- (void)viewDidLoad
{
    [super viewDidLoad];
    [self configureView];

        CGRect label_frame = CGRectMake(postTextLabel.frame.origin.x,
                                        postPicture.frame.origin.y + postPicture.frame.size.height,
                                        postTextLabel.frame.size.width,
                                        postTextLabel.frame.size.height);

        postTextLabel.frame = label_frame;

}

- (void)configureView
{
    if (self.detailItem) {
        NSDictionary *post           = self.detailItem;
        NSString     *postText       = [post objectForKey:@"post_text"];
        NSString     *postAuthorName = [post objectForKey:@"post_author_name"];

        postTextLabel.numberOfLines = 0;
        postTextLabel.text       = postText;
        postAuthorNameLabel.text = postAuthorName;

        dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
            NSString *pictureUrl = [post objectForKey:@"post_picture"];
            NSData   *data       = [NSData dataWithContentsOfURL:[NSURL URLWithString:pictureUrl]];

            dispatch_async(dispatch_get_main_queue(), ^{
                postPicture.image = [UIImage imageWithData:data];
            });
        });
    }
}

- (void)didReceiveMemoryWarning
{
    [super didReceiveMemoryWarning];
}
@end

enter image description here

  • 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-12T03:25:26+00:00Added an answer on June 12, 2026 at 3:25 am

    Assuming what you’re aiming for is just to have the label snap to the bottom of the image, programmatic is your best approach – I don’t think there’s a way to do it in Interface Builder. If you set up the image and label as IBOutlets named image and label respectively, code like the following should give you what you’re aiming for:

    CGRect label_frame = CGRectMake(label.frame.origin.x, image.frame.origin.y + image.frame.size.height, label.frame.size.width, label.frame.size.height);
    label.frame = label_frame;
    

    Call this whenever the image is changed and the text should be positioned below it, top edge of the label aligned with the bottom of the image. Remember you may need to alter the scroll view’s contentSize to match if the image/text becomes larger.

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

Sidebar

Related Questions

I'm trying to figure out how to do this programatically, but despite all of
Trying to figure this out... I'm trying to accessthe top level of the dom
Been trying to figure this out, but can't come up with a good solution
Still trying to figure this out from yesterday. I am trying to scroll an
Been trying to figure this out.. I am new to Adroid and trying to
I've been trying to figure this out now for a few hours and its
I've been trying to figure this out for quite some time, and it seems
I've been trying to figure this out for hours, so thought I should ask
I have been trying to figure this out for quite a while, but what
I have been trying to figure this out for way to long tonight. I

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.