SFAuthorizationPluginView identifying "BACK" button
Does anyone who has experience with SFAuthorizationPluginView know how to identify between the user pressing "Cancel" and "Back". My problem is that SFButtonTypeCancel is identical to SFButtonTypeBack, hence a switch statement will fail at compile time, and an if statement will not recognize the difference.
T开发者_StackOverflow社区his is not a problem when displaying the login screen as "name and password", but when displaying as "List of Users", handling the "Back" as "Cancel" makes the login window restart instead of shifting nicely to the list.
Regards Alan
To answer my own question, the login window has a CANCEL button when Fast-User Switching, and a BACK button when in the login screen, therefore I managed to identify between the two buttons, by the following code:
CFStringRef str_console_uname;
uid_t uid;
gid_t gid;
// get console username
str_console_uname = SCDynamicStoreCopyConsoleUser(NULL,
&uid,
&gid);
if (!str_console_uname ||
[(NSString *)str_console_uname compare:@"loginwindow"] == 0)
{
/* BACK BUTTON */
}
else
{
/* CANCEL BUTTON */
}
精彩评论