https://github.com/hyun99999/uipasteboardtutorial-ios
π ν΄λ¦½λ³΄λλ‘ λ³΅μ¬νκΈ° λμμ
https://github.com/hyun99999/uipasteboardtutorial-ios
ios uipasteboard
Last synced: 2 months ago
JSON representation
π ν΄λ¦½λ³΄λλ‘ λ³΅μ¬νκΈ° λμμ
- Host: GitHub
- URL: https://github.com/hyun99999/uipasteboardtutorial-ios
- Owner: hyun99999
- Created: 2021-09-29T06:49:35.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2021-09-29T06:59:50.000Z (over 3 years ago)
- Last Synced: 2025-01-25T15:31:50.410Z (4 months ago)
- Topics: ios, uipasteboard
- Language: Swift
- Homepage:
- Size: 30.3 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# UIPasteboardTutorial-iOS
π ν΄λ¦½λ³΄λλ‘ λ³΅μ¬νκΈ° λμμ **λ΄μ©**
- λ²νΌμ ν΅ν΄μ νΉμ λ¬Έμμ΄μ μμ½κ² ν΄λ¦½λ³΄λμ 볡μ¬νκΈ°.# μμ μ
λ¨Όμ `UIPateboard` μ λν΄μ κ°λ°μλ¬Έμλ₯Ό ν΅ν΄ μμ보μ.
## π [UIPasteboard](https://developer.apple.com/documentation/uikit/uipasteboard)
μ¬μ©μκ° μ± λ΄μ ν μμΉμμ λ€λ₯Έ μμΉλ‘ λ°μ΄ν°λ₯Ό 곡μ νλ κ²μ λλ κ°μ²΄.
**Overview**
λ€λ₯Έ μ±κ³Ό λ°μ΄ν°λ₯Ό 곡μ νλ €λ©΄ μμ€ν μ 체μ genaral pasteboard λ₯Ό μ¬μ©ν΄λΌ.
κ°μ team ID λ₯Ό κ°μ§λ λ€λ₯Έ μ±μΌλ‘ λ°μ΄ν°λ₯Ό 곡μ νλ €λ©΄ pasteboards μ μ΄λ¦μ μ¬μ©ν΄λΌ.
μΌλ°μ μΌλ‘ μ±μ κ°μ²΄λ μ μ κ° μΈν°νμ΄μ€μ μ ννλͺ©μ λν 볡μ¬, μλΌλ΄κΈ°, 볡μ μμ μ μμ²ν λ λ°μ΄ν°λ₯Ό μ΄λ€. κ·Έλ° λ€μ κ°κ±°λ λ€λ₯Έ μ±μ λ€λ₯Έ κ°μ²΄κ° pasteboard μμ λ°μ΄ν°λ₯Ό μ½κ³ μ μμΉμμ μ 곡νλ€. μ΄κ²μ μΌλ°μ μΌλ‘ λΆμ¬λ£κΈ° μμ μ μμ²ν λ λ°μνλ€.
**Note**
iOS 14 λΆν° μμ€ν μ λ€λ₯Έμ±μ pasteboard 컨ν μΈ λ₯Ό κ°μ Έμ€λ©΄ μ¬μ©μμκ² μλ¦°λ€.
### The General Pasteboard and Named Pasteboards
μμ€ν μ 체μ general pasteboard λ [general](https://developer.apple.com/documentation/uikit/uipasteboard/1622106-general) μμλ‘ μλ³λλ€. λͺ¨λ μ νμ λ°μ΄ν°λ₯Ό μ΄λ₯Ό ν΅ν΄μ paste board λ₯Ό μ»μ΄μ μ¬μ©κ°λ₯νλ€.
[init(name:create:)](https://developer.apple.com/documentation/uikit/uipasteboard/1622074-init) λ° [withUniqueName()](https://developer.apple.com/documentation/uikit/uipasteboard/1622087-withuniquename) ν΄λμ€ λ©μλλ‘ pasteboards λ₯Ό μμ±νμ¬ λμΌν Team ID λ₯Ό κ°μ§ λ€λ₯Έ μ±μΌλ‘ λ°μ΄ν°λ₯Ό 곡μ ν μ μλ€.
### Using Pasteboards
UIPasteboard ν΄λμ€λ κ°λ³μ μΈ pasteboard items λ₯Ό μ½κ³ μ°λ λ°©λ²κ³Ό μ¬λ¬κ°μ§ pasteboard items λ₯Ό νλ²μ μ½κ³ μ°λ λ°©λ²μ μ 곡νλ€. μμΈν λ΄μ©μ μ΄ λ¬Έμ νλ¨μ `Getting and Setting pasteboard Items` λ₯Ό μ°Έμ‘°ν΄λΌ.
pasteboard μ μΈ λ°μ΄ν°λ λ€μ λ νμμ€ νλμΌ μ μλ€.
- λ°μ΄ν°κ° NSString, NSArray, NSDictionary, NSDate, NSNumber, UIImage, or NSURL κ³Ό κ°μ κ°μ²΄λ‘ ννλ μ μλ κ²½μ° κ°μΌλ‘ νμλ μ μλ€. [setValue(_:forPasteboardType:)](https://developer.apple.com/documentation/uikit/uipasteboard/1622079-setvalue) μ κ°μ λ©μλλ₯Ό μ¬μ©ν΄μ pastboard μ μ΄λ€.
- λ§μ½ λ°μ΄ν°κ° binary μΈ κ²½μ°, [setData(_:forPasteboardType:)](https://developer.apple.com/documentation/uikit/uipasteboard/1622075-setdata) λ©μλλ₯Ό μ¬μ©νμ¬ pastboard μ μ΄λ€.UIPasteboard ν΄λμ€λ λ¨μΌ νΉμ μ¬λ¬ pasteboard items μ λ¬Έμμ΄, μ΄λ―Έμ§, URLs, colors μ μ½κ³ μ°κΈ°μν νΈλ¦¬ν λ©μλλ₯Ό μ 곡νλ€. (λ¬Έμ νλ¨μ `Getting and Setting Pasteboard Items of Standard Data Types` μ°Έμ‘°)
λ€μμ μ¬μ©ν΄μ UIPasteboard μ λ°μ΄ν°λ₯Ό κΈ°λ‘ν΄λ³΄κ² λ€. κ½€ κ°λ¨νλ€!
# μμνκΈ°
- λ²νΌμ μ΄λ²€νΈλ₯Ό λΆμ¬ν΄μ ν΄λ¦½λ³΄λλ‘ μμ½κ² 볡μ¬ν΄λ³΄κΈ°λ‘ νλ€.
- λ°μ΄ν° 곡μ νκΈ° μν΄μ general pasteboard λ₯Ό μ»μ΄μ μ¬μ©ν΄λ³΄μ### π Main λ·°
### π UIPasteboard μ΄μ©
- MainViewController
```swift
import UIKitclass ViewController: UIViewController {
@IBOutlet weak var idText: UILabel!
override func viewDidLoad() {
super.viewDidLoad()
}// β λ²νΌ ν΄λ¦μ idText μ ν μ€νΈ pastebaord μ 볡μ¬.
@IBAction func pasteText(_ sender: Any) {
UIPasteboard.general.string = idText.text
}
}
```### π μμ±