Created
November 20, 2012 15:47
-
-
Save piaoapiao/4118716 to your computer and use it in GitHub Desktop.
Paste
This file contains 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)paste:(id)sender | |
{ | |
UIPasteboard *board = [UIPasteboard generalPasteboard]; | |
NSArray *arr = board.strings; | |
NSLog(@"string:%@",[board.strings objectAtIndex:0]); | |
} | |
- (void)viewDidLoad | |
{ | |
[super viewDidLoad]; | |
UITextView *text = [[UITextView alloc] initWithFrame:CGRectMake(20, 20, 280, 80)]; | |
text.text = @"sadfasdfasdfasd fasasdfasdfasd fasdf2131241234151 234234123421342423342"; | |
[self.view addSubview:text]; | |
UITextField *field = [[UITextField alloc] initWithFrame:CGRectMake(100, 120, 100, 30)]; | |
field.borderStyle =UITextBorderStyleRoundedRect; | |
[self.view addSubview:field]; | |
// [[UIMenuController sharedMenuController] ] | |
UIButton *btn = [[UIButton alloc] initWithFrame:CGRectMake(100, 120, 100, 30)]; | |
[btn setTitle:@"paste" forState:UIControlEventTouchUpInside]; | |
[btn addTarget:self action:@selector(paste:) forControlEvents:UIControlEventTouchUpInside]; | |
[self.view addSubview:btn]; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment