Reputation:
this is my class
#import "Year2011.h"
@implementation Year2011
- (void)Men:(double)speed{
if (ramspeed <= 180000) {
cal = 0;
}
here i have HelloViewController class how can i call Year2011 class and Men mathod. now i tried like this.
@class Year2010
;
IBOutlet Year2010 *Year2010;
calling
double speed=([anualIncome.text doubleValue]);
[Year2010 Men:income];
this one is showing unrecognized selector sent to class
err.guide me i'm new to objective c.
Upvotes: 1
Views: 438
Reputation: 27597
You are mixing up Class name and Instance name. You also seem to have problems understanding the scope of an instance.
-1- change your instance name to lowercase initial - that is IBOutlet Year2010 *year2010;
-2- change your method names to lowercase initial - that is - (void)men:(double)speed
The compiler currently assumes that Men is a static class method, but you never defined it as such, hence the error.
Upvotes: 3
Reputation: 64002
[Year2010 Men:income];
From the code you've shown us, the Year2010
class doesn't have a method Men:
. Why would you expect to be able to call it?
Maybe change the type of the variable Year2010
to Year2011
?
Also, dear god, don't name your instances the same as your classes. This will be impossible to read and understand when you come back from lunch, let alone months from now.
Upvotes: 4