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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T05:42:58+00:00 2026-05-15T05:42:58+00:00

Newbie Cocoa Touch question: I’m aiming for an interface with a UIPickerView and a

  • 0

Newbie Cocoa Touch question:

I’m aiming for an interface with a UIPickerView and a UIButton.

The picker needs a delegate and dataSource, which I originally wrote as a separate PickerController class implementing the right protocols. However, I’m now unsure as to how to use interface builder to link everything up.

If I have a separate .xib file for the PickerController (with just a UIPickerView in it), and add the PickerController view as a subview in the main controller, the UIPickerView is displayed correctly, but the UIButton (which is in the main .xib file) is not. It’s as if add the PickerController view takes over the whole window and obscures the main view.

I tried getting rid of the separate .xib file, and instead adding the UIPickerView directly into the main .xib file. However, with that configuration, I’m not sure how to set up the delegate and dataSource, as the file’s owner (the main controller) is different from the <UIPickerViewDataSource, UIPickerViewDelegate> class I wrote (the PickerController).

Some help with the following would be great:

  • should I have a separate class per-UIPickerView?
  • should I have a separate .xib file per-UIPickerView?
  • if the delegate and dataSource are in a different class to the file’s owner, how do I connect them?
  • can I add a subview to the main view without it interfering with / obscuring elements in the main view?
  • 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-15T05:42:58+00:00Added an answer on May 15, 2026 at 5:42 am

    It’s possible to do what you want, but it falls well outside of the quickest path to get to the desired result. If you’re a newbie I’d stick with the easy paths for now, because Cocoa Touch is enough of a learning curve already.

    So. The quickest path would be to have your main view subclass the PickerController class. Then you can create your IB file, use your main view class as the file’s owner, and connect up the data sources and delegates.

    I’m guessing from your StackOverflow score that you’re an experienced developer who is starting on iPhone dev. The above quickest approach will probably smell funny, because subclassing doesn’t really feel right. It feels like you should be able to combine controllers, mixing them together to build a UI. And that is possible, but ends up being a lot of work and a bit of a headache if you’re just starting out. I’ve found that the aesthetic payoff of doing a more elegant approach isn’t worth the extra effort in most cases.

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

Sidebar

Related Questions

I'm a newbie Cocoa developer and I'm developing my first application. I want to
I'm a complete Xcode/Objective-C/Cocoa newbie but I'm learning fast and really starting to enjoy
Newbie question. I have a NSMutableArray that holds multiple objects (objects that stores Bezier
Newbie here...can I write one program which incorporates .NET LINQ and also various Java
Total newbie question but this is driving me mad! I'm trying this: myInt =
Sorry for the second newbie question, I'm a developer not a sysadmin so this
Please keep in mind that I'm a really newbie Cocoa developer Scenario: I've a
Disclaimer: Cocoa newbie here. I wrote an app with a Cocoa GUI that acts
I'm quite a newbie to Cocoa & Mac programming. I have a WebView and
Newbie Python question. I have a class that inherits from several classes, and some

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.