Skip to content

Commit

Permalink
fix issue #113. Where didTapTarget is false on the target cell
Browse files Browse the repository at this point in the history
  • Loading branch information
Tuyen Le committed Nov 5, 2019
1 parent 49504dd commit fca6543
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 20 deletions.
5 changes: 3 additions & 2 deletions MaterialShowcase/MaterialShowcase.swift
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,8 @@ extension MaterialShowcase {
hiddenTargetHolderView.isUserInteractionEnabled = true
} else {
// Add gesture recognizer for both container and its subview
addGestureRecognizer(tapGestureRecoganizer())
isUserInteractionEnabled = false
targetView.addGestureRecognizer(tapGestureRecoganizer())
hiddenTargetHolderView.addGestureRecognizer(tapGestureRecoganizer())
hiddenTargetHolderView.isUserInteractionEnabled = true
}
Expand Down Expand Up @@ -489,7 +490,7 @@ extension MaterialShowcase {
}

@objc private func tapGestureSelector(tapGesture:UITapGestureRecognizer) {
completeShowcase(didTapTarget: tapGesture.view === hiddenTargetHolderView)
completeShowcase(didTapTarget: tapGesture.view === hiddenTargetHolderView || !isUserInteractionEnabled)
}

/// Default action when dimissing showcase
Expand Down
34 changes: 16 additions & 18 deletions Sample/MaterialShowcaseSample/Base.lproj/Main.storyboard
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="14490.70" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES" initialViewController="8Yp-6g-IHX">
<device id="retina4_7" orientation="portrait">
<adaptation id="fullscreen"/>
</device>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="15400" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES" initialViewController="8Yp-6g-IHX">
<device id="retina4_7" orientation="portrait" appearance="light"/>
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="14490.49"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="15404"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<scenes>
Expand Down Expand Up @@ -33,35 +31,35 @@
</items>
</tabBar>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="6xO-1R-dVw">
<rect key="frame" x="26" y="91" width="323" height="30"/>
<rect key="frame" x="26" y="71" width="323" height="30"/>
<state key="normal" title="UIButton Showcase"/>
<connections>
<action selector="showButton:" destination="BYZ-38-t0r" eventType="touchUpInside" id="T9T-Y7-acP"/>
</connections>
</button>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="jp3-uM-SZU">
<rect key="frame" x="26" y="129" width="323" height="30"/>
<rect key="frame" x="26" y="109" width="323" height="30"/>
<state key="normal" title="UIBarButtonItem Showcase"/>
<connections>
<action selector="showBarButtonItem:" destination="BYZ-38-t0r" eventType="touchUpInside" id="wff-Kp-jk0"/>
</connections>
</button>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="PP9-Xh-O4w">
<rect key="frame" x="26" y="167" width="323" height="30"/>
<rect key="frame" x="26" y="147" width="323" height="30"/>
<state key="normal" title="UITabBarItem Showcase"/>
<connections>
<action selector="showTabBar:" destination="BYZ-38-t0r" eventType="touchUpInside" id="hI1-QG-6kI"/>
</connections>
</button>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="Gxz-BG-r6o">
<rect key="frame" x="26" y="205" width="323" height="30"/>
<rect key="frame" x="26" y="185" width="323" height="30"/>
<state key="normal" title="UITableView Showcase"/>
<connections>
<action selector="showTableView:" destination="BYZ-38-t0r" eventType="touchUpInside" id="bpG-w7-kYe"/>
</connections>
</button>
<tableView clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" dataMode="prototypes" style="plain" separatorStyle="default" rowHeight="44" sectionHeaderHeight="28" sectionFooterHeight="28" translatesAutoresizingMaskIntoConstraints="NO" id="2Er-Kq-T6A">
<rect key="frame" x="16" y="319" width="343" height="244"/>
<rect key="frame" x="16" y="243" width="343" height="244"/>
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
<constraints>
<constraint firstAttribute="height" constant="244" id="Avq-py-Wk6"/>
Expand All @@ -71,11 +69,11 @@
<rect key="frame" x="0.0" y="28" width="343" height="44"/>
<autoresizingMask key="autoresizingMask"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="Hw6-Wd-sph" id="xk7-Xh-IHh">
<rect key="frame" x="0.0" y="0.0" width="343" height="43.5"/>
<rect key="frame" x="0.0" y="0.0" width="343" height="44"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<label opaque="NO" multipleTouchEnabled="YES" contentMode="left" text="Title" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="PVn-eS-2Wr">
<rect key="frame" x="15" y="0.0" width="313" height="43.5"/>
<rect key="frame" x="15" y="0.0" width="313" height="44"/>
<autoresizingMask key="autoresizingMask"/>
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="calibratedRGB"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
Expand All @@ -89,34 +87,34 @@
</prototypes>
</tableView>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="Nlo-Uq-wk3">
<rect key="frame" x="327" y="579" width="16" height="22"/>
<rect key="frame" x="247" y="503" width="96" height="98"/>
<state key="normal" image="ic_twitter">
<color key="titleColor" red="0.0" green="0.47843137250000001" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</state>
</button>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="8CC-dB-oJX">
<rect key="frame" x="323" y="243" width="36" height="30"/>
<rect key="frame" x="323" y="223" width="36" height="30"/>
<state key="normal" title="Right"/>
<connections>
<action selector="placementButton:" destination="BYZ-38-t0r" eventType="touchUpInside" id="9jX-AO-lF9"/>
</connections>
</button>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="xOG-Y7-rBI">
<rect key="frame" x="16" y="243" width="30" height="30"/>
<rect key="frame" x="16" y="223" width="30" height="30"/>
<state key="normal" title="Left"/>
<connections>
<action selector="placementButton:" destination="BYZ-38-t0r" eventType="touchUpInside" id="wiV-7c-jm0"/>
</connections>
</button>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="bWR-um-41T">
<rect key="frame" x="164" y="243" width="47" height="30"/>
<rect key="frame" x="164" y="223" width="47" height="30"/>
<state key="normal" title="Middle"/>
<connections>
<action selector="placementButton:" destination="BYZ-38-t0r" eventType="touchUpInside" id="YAX-A9-M9i"/>
</connections>
</button>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="kfM-wr-XQ9">
<rect key="frame" x="106" y="575" width="173" height="30"/>
<rect key="frame" x="26" y="537" width="173" height="30"/>
<constraints>
<constraint firstAttribute="width" constant="173" id="Xml-BO-KYG"/>
</constraints>
Expand Down Expand Up @@ -178,7 +176,7 @@
<navigationController automaticallyAdjustsScrollViewInsets="NO" id="8Yp-6g-IHX" sceneMemberID="viewController">
<toolbarItems/>
<navigationBar key="navigationBar" contentMode="scaleToFill" id="kWE-HK-iwg">
<rect key="frame" x="0.0" y="20" width="375" height="44"/>
<rect key="frame" x="0.0" y="0.0" width="375" height="44"/>
<autoresizingMask key="autoresizingMask"/>
</navigationBar>
<nil name="viewControllers"/>
Expand Down

0 comments on commit fca6543

Please sign in to comment.