I'm trying to write a code where i find out if a year is bissextile but on my first line an error appears: "No Know Class method for selector 'datetoday'"... I Don't know why i'm having this error, cause when i tried to put my code into a button it worked just fine... but i need the code to be on 'viewDidLoad', but there it get's that error...
my code:
- (void)viewDidLoad {
[super viewDidLoad];
NSDate *datetoday = [NSDate datetoday];
NSDateFormatter *formatyears = [[NSDateFormatter alloc] init];
[formatyears setDateFormat:@"YYYY"];
NSString *yearStr = [formatyears stringFromDate:datetoday];
int yearint = [yearStr intValue];
int resto;
resto = yearint % 4;
if (resto == 0) {
teste.text = @"bissexto";
} else {
teste.text = @"not bissexto";
}
}