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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T17:26:23+00:00 2026-05-13T17:26:23+00:00

I have a xib in which I have added a UIViewController named delta. The

  • 0

I have a xib in which I have added a UIViewController named delta. The view under delta is controlled by the delta viewcontroller, not the file owner. On the delta view, I have a UIViewPicker. My issue is that I am programming in the UIPickerView in the deltaviewcontroller and I’m issuing deltaviewcontroller as the delegate and data source for the UIPickerView. Everything should work, but when I load the deltaviewcontroller’s view, the application crashes. If I carry out everything the same way under the file’s owner view, it works fine. I’m wondering if there is really a way to make the UIPickerView work with a UIViewController and no necessarily a file’s owner.

For references, the code:

Header

@interface DeltaViewController : UIViewController <UIPickerViewDelegate, UIPickerViewDataSource> {
    NSMutableArray *arrayNo;
    IBOutlet UIPickerView *pickerView;
}
@property (nonatomic, retain) UIPickerView *pickerView;
@property (nonatomic, retain) NSMutableArray *arrayNo;

@end

Implementation

#import "DeltaViewController.h"

@implementation DeltaViewController

@synthesize pickerView;
@synthesize arrayNo;

- (void)viewDidLoad
{
    NSMutableArray *dollarsArray = [[NSMutableArray alloc] init];

    for (int i = 0; i < 100; i++)
    {
        NSString *item = [[NSString alloc] initWithFormat:@"%i", i];
        [dollarsArray addObject:item];
    }

    self.arrayNo = dollarsArray;

    [dollarsArray release]; 
}

#pragma mark -
#pragma mark Picker Data Source Methods

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

- (NSInteger)pickerView:(UIPickerView *)pickerView numberOfRowsInComponent:(NSInteger)component
{
    return [arrayNo count];
}

#pragma mark Picker Delegate Methods

- (NSString *)pickerView:(UIPickerView *)pickerView titleForRow:(NSInteger)row forComponent:(NSInteger)component
{
    return [arrayNo objectAtIndex:row];
}

- (void)dealloc {
    [arrayNo release];
    [pickerView release];
    [super dealloc];
}

@end

Please point out if I’m doing anything wrong. Help is much appreciated.

  • 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-13T17:26:23+00:00Added an answer on May 13, 2026 at 5:26 pm

    If you search how to add a UIPickerView in a UIView, just check out the Apple sample code for UIPickerView. I think it’s one of the best ways learning to use the different classes correctly. There are five project which includes an UIPickerView. Here’s the link

    UIPickerView class reference and sample code

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

Sidebar

Related Questions

I have a XIB file with a UITextView, which I'm associating with a UITextView*
I have added an NSOpenGLView to my MainMenu.xib file, and have implemented drawRect to
I have a UITableViewController, which is RootViewController. It's XIB only has a table view.
I have a .xib file containing a UIView and 2 UILabel subviews linked to
If I have something like a UILabel linked to a xib file, do I
I have two NIB's ParentViewController.xib ChildViewController.xib ParentViewController.xib contains a UIView and a UIViewController. ChildViewController.xib
I have a root UIViewController which has a property called webView. WebView is a
I have a button in a view which refuses to work. I've got in
Have just started using Visual Studio Professional's built-in unit testing features, which as I
I'm making a simple Todo application in Cocoa. I have added a class (and

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.