Skip to content

Instantly share code, notes, and snippets.

Created May 18, 2015 14:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/7af74fdcf90982d6068d to your computer and use it in GitHub Desktop.
Save anonymous/7af74fdcf90982d6068d to your computer and use it in GitHub Desktop.
class CustomTextView: UITextView {
override func drawRect(rect: CGRect) {
self.setNeedsLayout()
}
override func touchesEnded(touches: Set<NSObject>, withEvent event: UIEvent) {
becomeFirstResponder()
var menu = UIMenuController.sharedMenuController()
var shareItem = UIMenuItem(title: "Paylaş", action: Selector("paylasFonksiyonu"))
menu.menuItems = [shareItem]
menu.setMenuVisible(true, animated: true)
}
func paylasFonksiyonu(){
println("paylaşma fonksiyonu çalıştı...")
}
override func canBecomeFirstResponder() -> Bool {
return true
}
override func canPerformAction(action: Selector, withSender sender: AnyObject?) -> Bool {
return super.canPerformAction(action, withSender: sender)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment