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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T23:19:23+00:00 2026-05-15T23:19:23+00:00

For an app that I am writing I need to display several views (in

  • 0

For an app that I am writing I need to display several views (in my case images, yet I guess that should not matter all that much) in a style similar to the way images are displayed in the Fotos app for the iPad. Consider this graphic:

alt text

Obviously on portrait view fewer slides can fit in per row than on Landscape view. What I have/want to do now:

  • Animate the addition of each slide by using a sliding animation
  • I already have a UIView subclass that represents a slide and that responds to touches the way I need it.

Where I am unsure is as to what is the best way of actually putting the slides onto the screen. I was originally just going to loop through them and place them onto the viewControllers view using the Frame of each slide (then I can do a count and increase the y-value after every 5 slides or so). Yet if I do it like that, I fear that my View will basically only support one screen orientation as I would need to relayout all the slides if the orientation changes, which seems rather a waste of resources to me (?).

How would you solve this problem? Is there maybe any “linebreak on overflow” ability such as with CSS (where a container automatically drops onto the next line if the float property is set and the parent container does not provide enough space)?

I am surely not the first person to think about this 🙂

Thanks for your answers!

  • 1 1 Answer
  • 2 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-15T23:19:23+00:00Added an answer on May 15, 2026 at 11:19 pm

    There’s no “linebreak on overflow” setting in Cocoa. If you want to make something that does that, you’ll need to write code that lays out the slides. Here’s a sample of the code I use to do it:

    CGRect frame = CGRectMake(margins.left, margins.top, cellSize.width, cellSize.height);
    for (UIButton *button in self.buttons) {
        button.frame = frame;
    
        // Move frame to next position
        frame.origin.x += cellSize.width + cellSpacing;
        if (frame.origin.x + frame.size.width > margins.left + contentWidth) {
            frame.origin.x = leftMargin;
            frame.origin.y += cellSize.height + cellSpacing;
        }
    }
    

    I’m using UIButtons for each image, hence the self.buttons ivar.

    Yes, you will need to relayout when the screen orientation changes. To do that, have a method like this:

    - (void)layoutSubviews {
        [super layoutSubviews];
        [self layoutButtons];
    }
    

    Which calls your layout code. In my case, it’s layoutButtons. This is in a subclass of UIScrollView, so when the view is autoresized after an autorotation, the layoutSubviews method gets called.

    If you’re using a UIScrollView, make sure you update the self.contentSize ivar too.

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

Sidebar

Related Questions

I am writing an app that will need to unzip user uploaded archives. PHP
I am writing an App that will allow users to browse through all files
Currently writing an app that should be able to quicklook webarchive. Copied data from
I am writing an app that generates and saves color schemes. I need to
I am writing an Android app that uses a WebView to display content. The
I have an iPhone app that I am writing and it has 2 targets
I have the following section of code in an app that I am writing:
I am writing an app that uses Highcharts, and in one instance I want
i'm writing an app that needs a calculation support (Fun project). However, is there
I am writing an app that plays a url using MPMoviePlayerController. The app works

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.