How to customize UILabel clickable

后端 未结 8 2115
余生分开走
余生分开走 2020-11-30 02:28

What I want:

In an iPhone app, I\'d like to show information in a tableView. In each cell, the text is like: John recently listen to music abcdefg.mp3. and if neede

8条回答
  •  盖世英雄少女心
    2020-11-30 02:52

    Swift 2.0 version:

      func userTappedOnLink() {
        print("clicked!")
      }
    
    ///tap and link to FB page
    let gesture = UITapGestureRecognizer(target: self, action: "userTappedOnLink")
    // if labelView is not set userInteractionEnabled, you must do so
    lblStaff.userInteractionEnabled = true
    lblStaff.addGestureRecognizer(gesture)
    

提交回复
热议问题