views:

363

answers:

1

I am using an action sheet to alert a user to several items upon logging into my app. listed are some examples of the alerts and the buttons that go with them.

INVALID USER - OK
INVALID PASSWORD - OK
INVALID USER - OK
UNKNOWN USER - CREATE NEW USER, CANCEL
USER ALREADY LOGGED IN - DISCONNECT, CANCEL LOGIN

What is the best way to manage multiple action sheets and have one delegate (self) handle the various buttons on the various sheets?

I tried setting an AppDelegate property to a flag value to determine which actions should be taken in the delegate function... ie...

//not actual code written in english-ese...
if (lastCommand = @"INVALIDUSER")
  if buttonIndex=0 { .. }
  if buttonIndex=1 { .. }
} else if (lastCommand = @"UNKNOWNUSER"){
  if button index=0 { .. }
  if button index=1 { .. }
}

etc... but my flag property (lastCommand) is invalid, I assume because of the fact I am working in two seperate threads.

What is the best way to proceed? Your advice is, as always, much appreciated.

+2  A: 

I ended up using the UIActionSheet.tag property.

Dutchie432