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

The Archive Base Latest Questions

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

I have an Android app with a UI like this for viewing emails: I’m

  • 0

I have an Android app with a UI like this for viewing emails:

Example Layout

I’m trying to port this to iOS and need it to work with iOS 5.0 and above (so can’t use auto-layout in iOS 6.0). Hopefully you can tell how the layout should adjust/flow based on the example.

What would be the best way to handle this type of layout? The From and Re lines need to be variable height as shown (actually the To: line as well). The message body needs to be variable height of course.

My only attempt so far has been trying to use UITableViewController with static cells. I am able to get the variable height that way, by using sizeWithFont inside heightForRowAtIndexPath, to return the required height for each row. Using that method I’m having a heck of a time trying to get the style I want (rounded corners and background only for the top part).

So is there a better way? Maybe something that uses Collection View or Container View? On some other screens I need to port I have similar issues, but they have more levels of nesting (rounded blue section inside a white section inside a rounded blue section). Or would I be better off not using IB and building the entire UI in code from just basic label elements and generic views?

  • 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-12T07:39:09+00:00Added an answer on June 12, 2026 at 7:39 am

    The easiest way I can think of is to manually compute for the label frames inside viewDidLayoutSubviews. Here’s some pseudo-code:

    On creation:

    1. In IB, put all labels as subviews of the blue area. Check that the autoresizing mask of the container sticks to the top, left, and right, as well as have stretchable width. We’ll fix the height and the subview frames in code. The message body can be a label or a textview as a separate view.
    2. In viewDidLoad, set the containing view’s layer cornerRadius, borderColor, etc. as appropriate.

    In viewDidLayoutSubviews:

    1. Time label: Easy. Just set the width to the superview width minus some padding, set the height with sizeWithFont:
    2. For To:, From:, and Re:; call sizeToFit. Get the max width and hold on to that.
    3. To: label: Set the x to 0 and y to the time label’s bottom.
    4. Receiver’s name label: Set x to the width you got from (2.) and y to same as (3.). Set width to (container width – (2.)) and height with sizeWithFont:.
    5. Do the same steps from (3.) to (4.) for the From: and Re: rows.
    6. Set the blue view height to the frame bottom of the subject label.
    7. Fill the rest of the frame with the body textview/label.

    You have to add paddings on your own because sizeToFit and sizeWithFont: won’t do that for you. Also, the body UITextView can scroll on it’s own, but if you are expecting long subject titles then you should wrap the whole thing in another UIScrollView (or in IB just set the main view’s class to UIScrollView)

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

Sidebar

Related Questions

In my android app I need to do something like this: I have 5
I have a custom global class which looks like this import android.app.Application; public class
I have an example like this: package android.uiexample; import android.app.Activity; import android.os.Bundle; import android.os.Handler;
I have tried making a listview for a android app like this tutorial .
I have a database in my Android app that has dates formatted like this:
I have an Android app which uses AdMob. I would like to publish this
I have a 2.3.3 android app that I am developing that I would like
Let's have an example like below: package xliiv.sandbox; import android.app.Activity; import android.os.Bundle; import android.util.Log;
Working on an Android app with FB 4.6, I would like to have the
I have an android app where in my Main activity I can play music

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.