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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T00:08:05+00:00 2026-06-18T00:08:05+00:00

I made a view which holds a UIScrollview: self.scrollView = [[UIScrollView alloc] initWithFrame:CGRectMake(10, 65,

  • 0

I made a view which holds a UIScrollview:

self.scrollView = [[UIScrollView alloc] initWithFrame:CGRectMake(10, 65, 300, 188)];
//BackViews will hold the Back Image
BackViews = [[NSMutableArray alloc] init];
for (int i=0; i<BigPictures.count; i++) {
    [BackViews addObject:[NSNull null]];
}
FrontViews = [[NSMutableArray alloc] initWithCapacity:BigPictures.count];
[self.pageControl setNumberOfPages:BigPictures.count];

Then I add several UIImageviews containing images:

//BigPictures holds objects of type UIImage
for (int i = 0; i < BigPictures.count; i++) {
    UIImageView *ImageView = [[UIImageView alloc] initWithImage:[BigPictures objectAtIndex:i]];
    ImageView.frame = [self.scrollView bounds];
    [ImageView setFrame:CGRectMake(self.scrollView.frame.size.width * i, ImageView.frame.origin.y, ImageView.frame.size.width, ImageView.frame.size.height)];
    //this saves the FrontView for later (flip)
    [FrontViews insertObject:ImageView atIndex:i];
    [self.scrollView addSubview:test];
}

// Detect Single Taps on ScrollView
UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(flip)];
[self.scrollView addGestureRecognizer:tap];

self.scrollView.contentSize = CGSizeMake(self.scrollView.frame.size.width * BigPictures.count, self.scrollView.frame.size.height);
self.scrollView.pagingEnabled = YES;
self.scrollView.delegate = self;

Ok so far so good. Now the method which does the flipImage part:

- (void)flip {
    int currentPage = self.pageControl.currentPage;
    UIView *Back = nil;
    if ([BackViews objectAtIndex:currentPage] == [NSNull null]) {
    //CreateBackView is just creating an UIView with text in it.
    Back = [self CreateBackView];
    [BackViews replaceObjectAtIndex:currentPage withObject:Back];
    [UIView transitionFromView:[[self.scrollView subviews] objectAtIndex:currentPage] toView:[BackViews objectAtIndex:currentPage] duration:0.8 options:UIViewAnimationOptionTransitionFlipFromLeft completion:NULL];
} else {
    [UIView transitionFromView:[[self.scrollView subviews] objectAtIndex:currentPage] toView:[FrontViews objectAtIndex:currentPage] duration:0.8 options:UIViewAnimationOptionTransitionFlipFromRight completion:NULL];
    [BackViews replaceObjectAtIndex:currentPage withObject:[NSNull null]];
}
[self.view addSubview:Back];
[self rebuildScrollView];

}

This is what rebuildScrollView does:

- (void)rebuildScrollView
{
    for (UIView *subview in self.scrollView.subviews) {
    [subview removeFromSuperview];
}

for (int i = 0; i < BigPictures.count; i++) {
    if ([BackViews objectAtIndex:i] == [NSNull null]) {
        [self.scrollView addSubview:[FrontViews objectAtIndex:i]];
    } else {
        [self.scrollView addSubview:[BackViews objectAtIndex:i]];
    }
}
self.scrollView.contentSize = CGSizeMake(self.scrollView.frame.size.width * BigPictures.count, self.scrollView.frame.size.height);
self.scrollView.pagingEnabled = YES;
self.scrollView.delegate = self;
}

So the behavior is the following:

  1. If I click on the first image (1 of 3 in scrollview) the effect is the way I want it, meaning the frontimage turns around and shows the empty (white) back with some text in the middle
  2. If I click on the second image, the image turns but the back is completely empty showing the grey background of the window. If I scroll to the other images, the still show the front image (as expected)
  3. Now I click on the third image and its the same as 1) great.
  4. Current layout is now [BackView, Nothing, Backview)
  5. Lets run that again. But now I click on the last image and its the same as 2) 🙁

Any ideas whats going wrong here?

EDIT: Some new findings. I doubled the amount of pictures and this is how Front and Backviews are placed (after flipping each one). P = Picture & B = Backview.

  • P_1(B_1) – actually the only correct one
  • P_2(empty – should be B_2)
  • P_3(B_2 – should be B_3)
  • P_4(empty – should be B_4)
  • P_5(B_3 – should be B_5)
  • P_6(empty – should be B_6)
  • 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-18T00:08:07+00:00Added an answer on June 18, 2026 at 12:08 am

    Did a complete rebuild and now it works. Really strange because I used the exact same code.

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

Sidebar

Related Questions

I have made a view in the application that shows a UITableView. It will
Hi I've made a custom view which represents a graph with axises etc so
I want to pass a view which has been made in 1st view like
Hi i made an application which has 2 views one paging scroll view which
I am wondering how to check in an Action, from which View I made
i made a custom view which should animate a dot on a background according
I've made a view in my storyboard which I've now decided I'd rather display
I had to populate a tree view for which i have made a custom
I have a custom-made view that extends the View class. I would like 2
I have made a list view containing two childs. Now i am trying to

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.