• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Newbie Question on a method signature
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Newbie Question on a method signature


  • Subject: Re: Newbie Question on a method signature
  • From: James Cicenia <email@hidden>
  • Date: Wed, 4 Jun 2008 15:38:08 -0500

OK -

When I put the method ahead of the call it compiled and work.
So I decided to declare it in my header as:

- (UIColor *) returnUIForFont: (NSString *) theString;

Now the compiler complains:

/Users/jcicenia/Documents/iPhone/TOSPhone/ProjectViewController.m:142: warning: incomplete implementation of class 'ProjectViewController'
/Users/jcicenia/Documents/iPhone/TOSPhone/ProjectViewController.m:142: warning: method definition for '-returnUIForFont:' not found


What the heck is wrong with my declaration?

Thanks
James


Wh On Jun 4, 2008, at 3:22 PM, Michael Vannorsdel wrote:

You have to make sure your header has - (UIColor *) returnUIColorForFont:(NSString *) theString in it so when you use the method in other source files the compiler will know what the arguments and return types to returnUIColorForFont: are. Without this the compiler has to make assumptions and is warning you that it is doing so.

Also, to compare if strings are equal you can just do:

if([theString isEqualToString:@"1"])
	//do stuff

Just another shorter method eventhough the way you're doing it is perfectly fine.


On Jun 4, 2008, at 2:14 PM, James Cicenia wrote:

I have the following:

((ProjectListCell *)cell).budgetHealth.textColor = [self returnUIColorForFont:s];

And here is my method:


- (UIColor *) returnUIColorForFont:(NSString *) theString{ if([theString compare:@"1"] == NSOrderedSame){ return [UIColor greenColor]; }else if([theString compare:@"0"] == NSOrderedSame){ return [UIColor yellowColor]; }else if([theString compare:@"-1"] == NSOrderedSame){ return [UIColor redColor]; }else{ return [UIColor grayColor]; } }


why does it tell me:

warning: (Messages without a matching method signature will be assumed to return 'id' and accept...

_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden

_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Follow-Ups:
    • Re: Newbie Question on a method signature
      • From: "Hamish Allan" <email@hidden>
References: 
 >Newbie Question on a method signature (From: James Cicenia <email@hidden>)
 >Re: Newbie Question on a method signature (From: Michael Vannorsdel <email@hidden>)

  • Prev by Date: Re: Newbie Question on a method signature
  • Next by Date: Re: Drawing over a QTCaptureView
  • Previous by thread: Re: Newbie Question on a method signature
  • Next by thread: Re: Newbie Question on a method signature
  • Index(es):
    • Date
    • Thread