Created
February 6, 2012 16:43
-
-
Save dmnlk/1753201 to your computer and use it in GitHub Desktop.
sample
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| void setState(BOOL enable) // required; called when user presses toggle button | |
| { | |
| if (enable) // toggle is disabled, so enable it | |
| { | |
| char hostname[256]; | |
| int hostname_length=30; | |
| gethostname(hostname,hostname_length); | |
| NSLog(@"%s",hostname); | |
| NSString *str =[NSString stringWithUTF8String:hostname]; | |
| av = [[UIAlertView alloc] initWithTitle:@"yourhost" message:str delegate:nil cancelButtonTitle:@"Ok" otherButtonTitles:nil]; | |
| UIPasteboard *paste = [UIPasteboard generalPasteboard]; | |
| [paste setString:str]; | |
| } | |
| else // toggle is enabled, so disable it | |
| { | |
| av = [[UIAlertView alloc] initWithTitle:@"togglennn" message:@"Toggle Disabled" delegate:nil cancelButtonTitle:@"Ok" otherButtonTitles:nil]; | |
| } | |
| [av show]; | |
| isToggleEnabled = enable; // for getStateFast() use | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment