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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T02:45:57+00:00 2026-05-28T02:45:57+00:00

I have an iPad project I’m working on that dynamically creates a number of

  • 0

I have an iPad project I’m working on that dynamically creates a number of buttons that I need to add to the main view of my application. I was planning on firing a method that lives inside my View from my ViewController…say it’s called add_buttons. It’s my impression that in the MVC pattern, the view should handle the rendering of buttons and the general display, but the controller should handle the interaction. I’m also under the impression that it’s bad design for the view to “know” about the view controller.

So I guess my question is, should I have my button tap logic contained in my controller? If so, how do I handle the separation? If I’m creating the buttons in my view, then it would have to have a reference to the view controller to use as the delegate for the event handler. If I create them in the controller, then I feel like I need to set certain UI elements in the controller which seems wrong to me. I know I’m missing something obvious but searching so far has proven fruitless.

Can anyone point me in the right direction?

  • 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-28T02:45:58+00:00Added an answer on May 28, 2026 at 2:45 am

    The button tap logic most certainly belongs in the controller.

    The code that creates the buttons probably belongs in the controller too. However, it would make sense to include a view method that returns a button with its appearance configured but not its behaviour.

    Some general pointe:

    • View controllers and their view are very tightly coupled.
    • If in doubt it’s best to put the code in the view controller.
    • A views interface should deal with primitive data types (e.g. strings, numbers, images). Views should not need to know the specifics of model objects.

    Also, the naming convention for methods lowerCamelCase. Eg:add_button should be addButton.

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

Sidebar

Related Questions

I have an iPad application that pulls in all of its data from an
I have started using the Three20 project for an iPhone/iPad application. Did anyone face
I have an iPad project structured as: - AppDelegate - MainWindow - View Controller
An iPad project I have been working on has become bloated with a huge
I'm working on an iPad project where i have to play short video files
I'm converting and iphone project to ipad. On iphone I have a mainViewController that
I have developed a iPhone/iPad project in XCode 3.2.5 version. I is working fine
A have a iOS-project that I send to my iPad. But when I'm trying
I have an OpenGL-based iPad project. In one view I have objects being rendered
I have a project that shares some files between a Mac application and an

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.