代码之家  ›  专栏  ›  技术社区  ›  Christian Stewart

iPhone通过代码将一些内容复制到剪贴板

  •  10
  • Christian Stewart  · 技术社区  · 15 年前

    谢谢。

    3 回复  |  直到 10 年前
        1
  •  22
  •   Christian David H6.    12 年前

    普通字符串将通过

    UIPasteboard *pasteboard = [UIPasteboard generalPasteboard];
    pasteboard.string = @"my test string";
    

    通过例如

    UIPasteboard *pasteboard = [UIPasteboard generalPasteboard];
    pasteboard.URL = [NSURL URLWithString:@"http://stackoverflow.com/questions/4060471/iphone-copy-something-to-clipboard-via-code"];
    
        3
  •  0
  •   Saranjith    8 年前

    斯威夫特4

    UIPasteboard.general.string = "This is the copied text"