UITextView with hyperlink text

后端 未结 10 803
抹茶落季
抹茶落季 2020-11-27 19:23

With a non-editable UITextView, I would like to embed text like this in iOS9+:

Just click here to register

I can create a functi

10条回答
  •  失恋的感觉
    2020-11-27 20:03

    I wanted to do the same thing and ended up just using a UIButton with the title "click here" surrounded by UILabels "just " and " to register", and then:

    @IBAction func btnJustClickHereLink(_ sender: UIButton) {
        if let url = URL(string: "http://example.com") {
            UIApplication.shared.openURL(url)
        }
    }
    

提交回复
热议问题