objective c - Checking for multiple variable value in Xcode -
i creating iphone app taking many values user , assigning them variables.
i want display alert message if more 2 of variables' values equal zero.
basically, if user has 2 empty fields, should show alert stating there insufficient data.
any idea how this?
your question bit vague about
- find errors
- display alert
somewhere alone lines of pseudo code:
int errorcount = 0; if(var1 == 0) { errorcount++; } if(var2 == 0) { errorcount++; } // check variables... // show alert if there errors if(errorcount > 0) { uialertview *alert = [[uialertview alloc] initwithtitle:@"title" message:[nsstring stringwithformat:@"you have %d errors", errorcount] delegate:nil cancelbuttontitle:@"gofightwin" otherbuttontitles: nil, nil]; [alert show]; [alert release]; }
Comments
Post a Comment