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

  1. find errors
  2. 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

Popular posts from this blog

delphi - How to convert bitmaps to video? -

jasper reports - Fixed header in Excel using JasperReports -

python - ('The SQL contains 0 parameter markers, but 50 parameters were supplied', 'HY000') or TypeError: 'tuple' object is not callable -