Skip to content

Instantly share code, notes, and snippets.

@KentarouKanno
Last active March 28, 2019 01:13
Show Gist options
  • Save KentarouKanno/55e8c46be673d5abb750b31e5e42edc6 to your computer and use it in GitHub Desktop.
Save KentarouKanno/55e8c46be673d5abb750b31e5e42edc6 to your computer and use it in GitHub Desktop.

ExclusiveTouch

★ ボタン、セル、ナビゲーションアイテム、セグメントコントロールの同時押しを制御する
storybosard,xib

extension UIButton {
    open override func awakeFromNib() {
        self.isExclusiveTouch = true
    }
}

extension UITableViewCell {
    open override func awakeFromNib() {
        self.isExclusiveTouch = true
    }
}

extension UINavigationController {
    open override func awakeFromNib() {
        self.navigationBar.isExclusiveTouch = true
    }
}

extension UISegmentedControl {
    open override func awakeFromNib() {
        self.isExclusiveTouch = true
    }
}
  • appearanceでの設定
/* Exclusive Touch */

UIButton.appearance().isExclusiveTouch = true
UITableViewCell.appearance().isExclusiveTouch = true
UICollectionViewCell.appearance().isExclusiveTouch = true
UINavigationBar.appearance().isExclusiveTouch = true
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment