我創建了一個小的應用程序使用SWIFT來獲得IOS剪貼板,但是當我嘗試鳴叫的變量,它不會顯示爲一個字符串,它顯示爲鳴叫沒有顯示字符串變量?
<UILabel: 0x146db1a30; frame = (78.6667 229; 257 147); text = 'I'm on my way right now'; opaque = NO; autoresize = RM+BM; userInteractionEnabled = NO; layer = <_UILabelLayer: 0x146db1fd0>>
代替
\(clipText)
我得剪貼板內容的代碼是
let pasteboardString:String? = UIPasteboard.generalPasteboard().string
clipText.text = pasteboardString`
當我使用此代碼發佈推文
let tweetController = SLComposeViewController(forServiceType: SLServiceTypeTwitter)
tweetController.setInitialText("Here's what was on my clipboard:(clipText)")
我從頂部獲取文本。
Image of the code I get instead of (clipText)
你想'clipText.text',不'clipText'。 – rmaddy