【发布时间】:2017-07-04 17:26:21
【问题描述】:
我想在另一个 VC 上方展示一个 VC,但希望两者都可以点击和负责。
我有一个文本字段,可以打印出每个 @-sign 后面的字符串。
写@时,我有一个 VC,它在第一个 VC 上方弹出一个小表格视图,以后应该代表名称包含打印输出字符串的用户。
我需要第一个 vc 仍然负责,因为目前我无法单击第一个 VC 上的按钮和文本字段,当第二个 VC 弹出时,即使我可以看到所有内容(将背景设置为清除)。
if commentTextField.text!.contains("@"){
print("changed textField")
let vc = self.storyboard?.instantiateViewController(withIdentifier: "suggestedUsersViewController") as UIViewController!
vc?.modalPresentationStyle = .overCurrentContext
vc?.view.backgroundColor = .clear
present(vc!, animated: true, completion: nil)
}
我如何得到@- 符号后面的帖子
let caption = commentTextField.text
let words = caption?.components(separatedBy: CharacterSet.whitespacesAndNewlines)
for var word in words! {
if word.hasPrefix("@") {
word = word.trimmingCharacters(in: CharacterSet.punctuationCharacters)
print("wort ist", word)
}
}
目前它只是弹出第一个 vc,然后它不再可点击,我无法更改文本字段
【问题讨论】:
标签: ios swift modalviewcontroller