iOS Copy and Paste

一世执手 提交于 2019-12-06 09:31:55
- (void)copy {

    UIPasteboard *pasteboard = [UIPasteboard generalPasteboard];
    pasteboard.string = @"String";
}


- (void)paste {

        UIPasteboard *pasteboard = [UIPasteboard generalPasteboard];  
        NSString *string = pasteboard.string; 
        NSLog(@"%@",string");
}

Refer this Link UIPasteBoard

Take a look at the UIResponderStandardEditActions informal protocol:

https://developer.apple.com/library/ios/documentation/uikit/reference/UIResponderStandardEditActions_Protocol/UIResponderStandardEditActions.html

The key is to ensure that your view controller can become first responder and then implement the following methods:

- (void)copy:(id)sender;
- (void)paste:(id)sender;
    UIPasteboard *pb = [UIPasteboard generalPasteboard];
    NSDictionary *CellData = [NSDictionary dictionaryWithDictionary:[ArrayName objectAtIndex:SelectedIndexPath.row]];
    NSString* strText = [(NSDictionary*)[(NSString*)[CellData objectForKey:@"Key"] JSONValue] objectForKey:@"english"];
    [pb setString:strText];
标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!