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

The Archive Base Latest Questions

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

Coding against UIKit for iPhone. Setup, with relevant detail: SomeView.h: #import <UIKit/UIKit.h> @interface SomeView

  • 0

Coding against UIKit for iPhone.

Setup, with relevant detail:

SomeView.h:

#import <UIKit/UIKit.h>

@interface SomeView : UIView {
    SomeObject *myObject;
}

@property (assign) SomeObject *myObject;

-(void) doSomething;

@end

SomeView.m:

#import "SomeView.h"

@implementation SomeView

@synthesize myObject;

- (void)doSomething {
    NSLog(@"doing something");
}

- (void) drawRect:(CGRect)rect {
    // drawing is based on myObject
}

@end

Controller.h:

#import <UIKit/UIKit.h>
#import "SomeView.h"

@interface Controller : NSObject {
    IBOutlet UIView *someView;
}

@end

Controller.m:

#import "Controller.h"

@implementation Controller

-(void)awakeFromNib {

    [someView doSomething];
    [someView setSomeObject:someObject]; 
}
@end

I am instantiating the controller object in Interface Builder, and SomeView is the class of one of my custom UIViews in my app’s main window.

Now, the questions:

1) when I run the above, I get warnings for both lines: “Warning: ‘UIView may not respond to ‘doSomething'” and similar warning for setSomeObject. Why? (The code actually seems to work, but I don’t like seeing the warnings.)

2) is this the right way of doing things? What I am really after, is making SomeView aware of someObject, so that when drawRect for SomeView is called, it can change its behavior based on current state of someObject. I don’t need to have the object directly in SomeView; I could have it in the controller, but the view still needs some information from it that may change at runtime.

  • 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-13T05:46:23+00:00Added an answer on May 13, 2026 at 5:46 am

    You declared someView as an instance of UIView, but doSomething is a method of SomeView. So it is correct — the class you told the compiler that the variable points to does not respond to that message. If you don’t want warnings, you’ll have to make it a SomeView * instead of a UIView *.

    Otherwise, your general architecture looks OK to me.

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

Sidebar

Related Questions

There exist tools for comparing code against a custom specified set of coding guidelines/standards
I have a script like this: #!/Python26/ # -*- coding: utf-8 -*- import sys
I am brand new to WCF, and have limited experience coding against web services.
I'm coding against Common Service Locator and I'm having trouble figuring out the semantic
Been coding for 48 hours straight and am banging my head against the wall
Can anyone point me to a good introduction to coding against the paypal API?
Look at the code snippet: This is what I normally do when coding against
I have been coding against a Delphi EXE (win32 desktop app) to access twitter
I'm coding some c# against Active Directory and have tried endlessly to get this
I'm coming up against an unexpected daylight savings time problem in code I thought

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.