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

  • Home
  • SEARCH
  • 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 8303419
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T17:32:09+00:00 2026-06-08T17:32:09+00:00

Suppose I have a subclass of UIViewController (MyViewController) which has in it’s own view,

  • 0

Suppose I have a subclass of UIViewController (MyViewController) which has in it’s own view, a subclass of UIImageView (MyImageView), and a standard UILabel.

In the code for MyImageView, I am doing some work on the touch events to get the color of a the pixel being touched, and want to update my the UILabel with that contents. What are some typical ways achieve this communication since MyImageView and UILabel both reside as instances in MyViewController?

Coming from C++ I would have added something like this to MyImageView

-(void)registerMyLabel:(UILabel*)label;

Then somewhere in the initialization of MyViewController would have registered the UILabel instance with MyImageView using the method above. I am sure that I can use a similar technique here, but I’m wondering… is there a built in mechanism to do this with UI controls in objective-c?

How would you structure this?

  • 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-08T17:32:10+00:00Added an answer on June 8, 2026 at 5:32 pm

    I would make the view controller do the work of communicating between views.

    Whether the touch handling is the view’s responsibility or that of the controller is subject to different philosophies but let’s say we define the view as having color detecting ability. Once the color is detected, MyImageView should let the controller know either by using a delegate protocol or by posting a NSNotification. Once given that information, the controller does whatever it needs to with the label.

    (I like notifications better than delegates in many cases because of the looser coupling.)

    In any case, it’s more in keeping with MVC if the controller is responsible for communicating events and data among the other pieces that need it.

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

Sidebar

Related Questions

Suppose I have a base class named Visitor, and it has 2 subclass Subscriber
Suppose I have a UIViewController subclass that takes care of some UIViews. These UIViews
Suppose I'm doing some iPhone development and I have a subclass of UIViewController .
I have a common superclass (suppose it's Employee ), which has (amongst others) subclasses
Suppose (for the sake of argument) that I have a view class which contains
So I have a Subclass of UIView that is suppose to detect touches. The
Suppose I have a superclass Item and a subclass MovingItem. If I create an
For example, suppose I have a drawing in a JPanel subclass with JScrollPanes, and
Here's my situation.. Suppose you have the following model entities, which represent single tables
I have a subclass of UIViewController with an NSMutableArray as a property to use

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.