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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T18:27:10+00:00 2026-05-27T18:27:10+00:00

I have a picker view,when the row component of a picker view is selected,it

  • 0

I have a picker view,when the row component of a picker view is selected,it navigates to a view,there I have a button changeGroup.On clicking the button the picker view must appear,but it is not happening! Its crashing

Here is my code:

- (void)viewDidLoad
{
groupArr = [[[NSMutableArray alloc]initWithObjects:@"Family",@"Friends",@"Office",@"Acquaintances", nil]autorelease];
    agrpPicker.hidden  = YES;
}

#pragma mark-
#pragma mark PickerView Datasource

-(NSInteger)numberOfComponentsInPickerView:(UIPickerView *)pickerView
{
    int number = 0;

    if (agrpPicker.hidden == NO) 
    {
        number = 1;
    }

    return number;
}
-(NSInteger)pickerView:(UIPickerView *)pickerView numberOfRowsInComponent:(NSInteger)component
{
    int count = 0;
    if (agrpPicker.hidden == NO) 
    {
        count = [self.groupArr count];
    }
    return count;
}

#pragma mark-
#pragma mark PickerView Delegate

-(NSString *)pickerView:(UIPickerView *)pickerView titleForRow:(NSInteger)row forComponent:(NSInteger)component
{
    NSString *str = [[[NSString alloc]init]autorelease];

    if (agrpPicker.hidden == NO) 
    {
        str = [self.groupArr objectAtIndex:row];
    }

    return str;
}

This is the action for the button for the picker view to appear:

-(IBAction)groupButtonSelceted:(id)sender
{
    [UIView beginAnimations:nil context:nil];
    [UIView setAnimationDuration:0.6];
    CGAffineTransform transfrom = CGAffineTransformMakeTranslation(0, 200);
    agrpPicker.transform = transfrom;
    [UIView commitAnimations];
    agrpPicker.hidden = [agrpPicker isHidden] ? NO : YES;
    [self.view addSubview:agrpPicker];
}

connected that picker view to the picker view present in IB.

Here is the screen shot of where it got crashed

enter image description here

and in the console,the message appears as in snap shot below:

enter image description here

Can any expert point me out at where I went wrong….

Please help me out with your valuable suggestions,thanks in advance 🙂

Sorry guys,I found out what was the mistake,I haven’t retained the array once it is autoreleased,instead of:

groupArr = [[[NSMutableArray alloc]initWithObjects:@”Family”,@”Friends”,@”Office”,@”Acquaintances”, nil]autorelease];

it is self.groupArr = ….;

Thanks for all who viewed and for those who contributed in fixing the issue 🙂

  • 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-27T18:27:11+00:00Added an answer on May 27, 2026 at 6:27 pm

    your groupArr array is loosing its contant due to autorelease. so change this

    groupArr = [[NSMutableArray alloc]initWithObjects:@”Family”,@”Friends”,@”Office”,@”Acquaintances”, nil];

    [groupArr retain];

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

Sidebar

Related Questions

I have a picker view that has a list of numbers to pick from.
I have picker controls on a single view with two outlets for each. When
I have one issue with Datetime Picker In my firstview i have button.If i
I have a custom UIPickerView where I use: -(UIView *)pickerView:(UIPickerView *)pickerView viewForRow:(NSInteger)row forComponent:(NSInteger)component reusingView:(UIView
- (UIView *)pickerView:(UIPickerView *)pickerView viewForRow:(NSInteger)row forComponent:(NSInteger)component reusingView:(UIView *)view { UILabel *retval = (id)view; if
I have a picker view in a view controller page,say view controller1.Now I have
I have a picker view where the user is entering a time. When they
I have a UIPicker that triggers a UIAlert when a row is selected. I'm
I have one music player with multiple sounds using picker view. My problem is
I have three labels, which I want to fill with selected row from pickerview.

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.