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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T14:03:18+00:00 2026-05-13T14:03:18+00:00

I have a small application for displaying several UIImageViews in a UIScroller in a

  • 0

I have a small application for displaying several UIImageViews in a UIScroller in a similar fashion to the Photo app. I have a TableView which, when i select an item, parses an XML document of photos (added to an array) and adds a UIViewController which displays the images.

The problem is I have a tab bar controller which, upon clicking a tab bar item should go back to the TableView after remove the View that displays the images and dealloc all used memory. The problem is I can’t work out how to achieve this. Whether it’s a lack of understanding the memory rules I don’t know.

Here’s the process I’m having issues with.

Table View Controller

This is called after parserDidEndDocument:. backToMenu is called from the tab bar item.

@interface AlbumsViewController : UIViewController <UITableViewDelegate, UITableViewDataSource> {
    AlbumViewController *albumViewController;
}
@property (nonatomic, retain) AlbumViewController *albumViewController;


- (void)displayPhotos {
    albumViewController = [[AlbumViewController alloc] initWithNibName:@"AlbumView" bundle:nil];

    albumViewController.parentView = self;
    albumViewController.arrPhotos = self.arrCurrentSetOfPhotos;

    [self.view addSubview:albumViewController.view];

    [albumViewController populateScroller];
}

- (void)backToMenu {
    [albumViewController.view removeFromSuperview];
}

Album View Controller

This is a UIViewController containing a UIScroller and UIPageControl. It adds several ImageViewControllers.

- (void)populateScroller {

    imagesScroller.pagingEnabled = YES;
    imagesScroller.contentSize = CGSizeMake(imagesScroller.frame.size.width * [self.arrPhotos count], 380);
    imagesScroller.showsHorizontalScrollIndicator = NO;
    imagesScroller.showsVerticalScrollIndicator = NO;
    imagesScroller.scrollsToTop = NO;
    imagesScroller.delegate = self;
    imagesScroller.backgroundColor = [UIColor blackColor];

    pageControl.numberOfPages = [self.arrPhotos count];
    pageControl.currentPage = 0;
    pageControl.backgroundColor = [UIColor blackColor];

    NSMutableArray *controllers = [[NSMutableArray alloc] init];
    for (int i = 0; i < [self.arrPhotos count]; i++) {

        CGRect frame = imagesScroller.frame;
        frame.origin.x = frame.size.width * i;
        frame.origin.y = 0;

        NSString *strImagePath = [self.arrPhotos objectAtIndex:i];

        ImageViewController *imageViewController = [ImageViewController alloc];
        imageViewController.localImage = YES;
        [imageViewController initWithPhotoName:strImagePath];
        [controllers addObject:imageViewController];

        imageViewController.view.frame = frame;
        [imagesScroller addSubview:imageViewController.view];

        [imageViewController release];

    }

    self.viewControllers = controllers;
    [controllers release];

}

ImageViewController

This has one method. It adds an subclassed UIView called ImageView which handles adding a UIImageView.

- (void)loadImage {

    NSString *strRootURL = @"http://www.marklatham.co.uk";

    CGRect rect = CGRectMake(0.0, 0.0, 320.0, 480.0);

    ImageView *imageView = [ImageView alloc];
    imageView.strURL = [strRootURL stringByAppendingString:self.strThisPhoto];
    imageView.strTmpPrefix = (self.localImage) ? @"_tmp_rockphotothumb_" : @"_tmp_rockphotolarge_";
   [imageView initWithFrame:rect];

   [self.view addSubview:imageView];

   [imageView release];
}

The backToMenu function is supposed to remove/dealloc AlbumViewController and call delloc on ALL child subviews freeing up the used memory.

Where am going wrong? Any help would be appreciated.

Thanks.

  • 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-05-13T14:03:18+00:00Added an answer on May 13, 2026 at 2:03 pm

    After convincing my client I managed to get around this by going with the three20 framework.

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

Sidebar

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.