I am using the below code, but I am not getting that why it is not working properly, I think my logic is incorrect.
Please take a look and suggest me the solution.
- (IBAction)fajarButton:(id)sender {
name = @"f";
NSLog(@"Selected namaz is Fajar");
[a1 setAlpha:0]; [a2 setAlpha:0]; [a3 setAlpha:0]; [a4 setAlpha:0]; [a5 setAlpha:0];
NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
[dateFormatter setTimeZone:[NSTimeZone localTimeZone]];
[dateFormatter setDateFormat:@"EEEE"];
NSString *day = [dateFormatter stringFromDate:[NSDate date]];
NSLog(@"day::: %@", day);
if ([day isEqualToString:@"Monday"]) {
[fajarButton setUserInteractionEnabled:NO];
}
if ([day isEqualToString:@"Tuesday"]) {
[fajarButton setUserInteractionEnabled:NO];
}
if ([day isEqualToString:@"Wednesday"]) {
[fajarButton setUserInteractionEnabled:NO];
}
if ([day isEqualToString:@"Thursday"]) {
[fajarButton setUserInteractionEnabled:NO];
}
if ([day isEqualToString:@"Friday"]) {
[fajarButton setUserInteractionEnabled:NO];
}
if ([day isEqualToString:@"Saturday"]) {
[fajarButton setUserInteractionEnabled:NO];
}
if ([day isEqualToString:@"Sunday"]) {
[fajarButton setUserInteractionEnabled:NO];
}
}
What here I am trying to do is that, say, if today is monday and this button clicked once then after it should be disabled for this day monday so that user would not click it again or whenever user clicks it an alert should come up that you have already done that. And when new day Tuesday will come and app will be started, as the new day has started now again the button will be enabled and user will be able to click it once.
How to achieve it all…. I am in much problem
Looks like your friArray is empty.