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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T02:41:03+00:00 2026-05-14T02:41:03+00:00

I am working on a view that selects an image (chart) based on user

  • 0

I am working on a view that selects an image (chart) based on user input through a dependent picker which uses a plist file that contains three arrays containing about 40 strings each.

About 50% of the time when I run the app, it just shuts down immediately, but the other times that it does run, it will work fine until I start scrolling through the picker at which point it crashes after about 4 seconds. It also wont show one of the array names on the left component.

I tried running the app with the analyzer to check on a memory leak, but it wont run at all if I am using analyzer in memory leak mode. The code is almost straight out of a book.

Here is the relevant code:

    -(void) viewDidLoad {
        [super viewDidLoad];
        UIImageView *tempImageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"US High Index.jpg"]];
        self.imageView = tempImageView;
        NSString *string = @"US High Index";
        self.chartNameLabel.text = string;
        [string release];
        [tempImageView release];


    scrollView.contentSize = CGSizeMake(imageView.frame.size.width , imageView.frame.size.height);
    scrollView.maximumZoomScale = 4.0;
    scrollView.minimumZoomScale = .05;
    scrollView.clipsToBounds = YES;
    scrollView.delegate = self;

    [scrollView addSubview:imageView];

    NSBundle *bundle = [NSBundle mainBundle];
    NSString *plistPath = [bundle pathForResource:@"ChartTypes" ofType:@"plist"];

    NSDictionary *dictionary = [[NSDictionary alloc]initWithContentsOfFile:plistPath];

    self.chartsDictionary   = dictionary;


    NSArray *components = [self.chartsDictionary allKeys];
    self.chartTypes = components;


    NSString *selectedChartType = [self.chartTypes objectAtIndex:0];
    NSArray *array = [chartsDictionary objectForKey:selectedChartType];
    self.charts = array;

    [dictionary release];
    [array release];

    [selectedChartType release];
    [plistPath release];
    [bundle release];
}



-(NSInteger)numberOfComponentsInPickerView:(UIPickerView *)pickerView {
    return 2;
}

    -(NSInteger)pickerView:(UIPickerView *)pickerView
    numberOfRowsInComponent:(NSInteger)component {
        if (component == kChartTypeComponent ) 
            return [self.chartTypes count];

            return [self.charts count];

    }

    #pragma mark Picker delegate methods
    -(NSString *)pickerView:(UIPickerView *)pickerView
    titleForRow:(NSInteger)row
               forComponent:(NSInteger)component {
        if (component == kChartTypeComponent ) 
            return [self.chartTypes objectAtIndex:row];

            return [self.charts objectAtIndex:row];



    }

    -(void)pickerView:(UIPickerView *)pickerView
          didSelectRow: (NSInteger)row
          inComponent:(NSInteger)component {
        if (component == kChartTypeComponent ) {
            NSString *selectedChartType = [self.chartTypes objectAtIndex:row];
            NSArray *array = [chartsDictionary objectForKey:selectedChartType];
            self.charts = array;
            [picker selectRow: 0 inComponent:kChartComponent animated: YES];
            [picker reloadComponent:kChartComponent];

        }
        }
  • 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-14T02:41:03+00:00Added an answer on May 14, 2026 at 2:41 am

    I think you don’t have to call

    [array release];
    [selectedChartType release];
    

    in your viewDidLoad method, because both objects are autoreleased. Maybe that could cause the crash.

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

Sidebar

Related Questions

I'm working on a page that, when I load into IE8 and view the
I have a View set to grab the latest forum posts. That's working fine,
I have a DatePicker working on a View which also has a ViewModel associated
Could you please help me to get image upload working on a view with
I'm new to xcode and the iphone sdk. I've been working with the view-based
I have a view which was working fine when I was joining my main
I am working on an application that requires user authentication to access a profile.
I'm making a navigation based application. When the user selects a row on the
I am working on an app that have this code on a view file
I'm working on a band website that has a Flash-based music player always visible.

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.