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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T03:08:28+00:00 2026-06-13T03:08:28+00:00

I created a custom view. It has a delegate that it will notify when

  • 0

I created a custom view. It has a delegate that it will notify when some of its buttons are pressed.

I added this to the view controller’s viewDidLoad:

self.myCustomView.delegate=self;

So far everything works fine.

But that’s not cool enough. I want to do it the table view style where I can just right drag from the view to the File’s Owner and (ta-da!) it’s automatically set.

  • 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-06-13T03:08:29+00:00Added an answer on June 13, 2026 at 3:08 am

    Add the IBOutlet keyword to the delegate property of your class:

    @property (nonatomic, assign) IBOutlet id<MyViewDelegate> delegate;
    

    The IBOutlet keyword tells the nib editor to let you make a connection to that property.

    You could also say this:

    @property (nonatomic, assign) IBOutlet MyView *delegate;
    

    And then IB will only allow you to connect it to a MyView. But a protocol or id is more flexible.

    EDIT: One point has been lost due to focus on IB

    You said:

    I created a custom view. It has a delegate that it will notify when some of its buttons are pressed.

    Receiving button events is the role of a view controller, sometimes however a delegate will be used for finer grained control of certain events.

    In general dont create a delegate for button presses on a view that is a primary window in which case you should be handling your button events in a ViewController. Buttons sit on a parent view that will forward events up the responder chain (you still need to connect them to a target). Im not saying you shouldn’t ever use the delegate pattern for button presses but, buttons have their own connections to view controllers in IB with drag and drop as you wish. But there are situations like yours which are perfectly valid.

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

Sidebar

Related Questions

I created my own custom view that extends UIControl. This custom view has its
i'm building a table view that has an external delegate controller, and it's created
So I've created a view controller that creates a custom view that, if it
I have a UIViewController that I've added UITableViewDelegate to. This controller has a corresponding
I have created a custom list view, each row has it's own custom selector,
I created a custom view that uses Json.Simple to serialize the model and write
I created a CUSTOM split view (extends a UISplitviewController) in our application so that
I've created a UIViewController which contains a view with a custom class that I've
I am creating a side menu in a table view that has custom UITableViewCell's.
I create a custom image view by extending ImageView that just draws some text

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.