im beginner in xcode.
How to code for something that you haven’t yet to complete write information or no value in UILabel (labelDate) and then UIAlertView pop-up to tell you if you haven’t yet input information?
My UILabel get input from code below
- (void)pickerView:(UIPickerView *)pickerView didSelectRow:(NSInteger)row inComponent:(NSInteger)component
{
year = [picker selectedRowInComponent:0];
month = [picker selectedRowInComponent:1];
day = [picker selectedRowInComponent:2];
date = @"";
if(viewPicker.tag == 1)
labelDate.text = [date stringByAppendingFormat:@"%d:%d:%d", year , month, day];
else
... etc
}
and my button is like this
- (IBAction)readyBtn:(id)sender {
if ( ??? ) {
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Alert" message:@"Please input date" delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil];
[alert show];
}
I already tried out to write like this but i think it is not good idea because uialertview is popup if year,month,day is choosen to 0.
- (IBAction)readyBtn:(id)sender {
if (viewPicker.tag == 1) {
year = month = day = 0;
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Alert" message:@"Please input date" delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil];
[alert show];
}
thank you for teaching me.
Your Button event would be like this: