This is within the latest Xcode.
I have 4 arrays that produce a result to the screen with an OK button. I would like to add a function that copies the result to the clipboard. Does that make sense?
While I am not exactly sure how this is done, I am heavily researching it as I am somewhat new to coding.
From what I am seeing, pasteboards would seem to be the way to go. Am I in the right ball field here?
Here is a sampling of my code:
-(IBAction)buttonPressed
{
NSInteger firstRow = [doublePicker selectedRowInComponent:kfirstComponent];
NSInteger middleRow = [doublePicker selectedRowInComponent:kmiddleComponent];
NSInteger lastRow = [doublePicker selectedRowInComponent:klastComponent];
NSInteger fourthRow = [doublePicker selectedRowInComponent:kfourthComponent];
NSString *first = [firstTypes objectAtIndex:firstRow];
NSString *middle = [middleTypes objectAtIndex:middleRow];
NSString *last = [lastTypes objectAtIndex:lastRow];
NSString *fourth = [fourthTypes objectAtIndex:fourthRow];
NSString *message = [[NSString alloc] initWithFormat:@"%@ %@ %@ %@.",first, middle, last, fourth];
UIAlertView *alert = [[ UIAlertView alloc] initWithTitle:@"Text"
message:message
delegate:nil
cancelButtonTitle:@"OK"
otherButtonTitles:nil];
[alert show];
[alert release];
[message release];
}
This is the code (I think) i want to Implement:
-(IBAction)copy:(id)sender
{
NSString *copyString = label.text;
UIPasteboard *pb = [UIPasteboard generalPasteboard];
[pb setString:copyString];
}
And if I have the correct usage, I am not sure where to put it.