我有一个objc功能:
<div class="container">
<!-- Row -->
<div class="row" id="product_list">
<!-- Product -->
<div class="col-xs-6 col-sm-3 product" id="belleza">
<!-- Entry -->
<div class="entry">
<figure class="entry-thumbnail">
<a href="#"><img alt="" src="../resources/images/productos/Shampoo-neutro.png"/></a>
</figure>
<div class="entry-body">
<h3 class="entry-title">
<a href="#">Shampoo Petra Neutro<br/></a>
</h3>
<h2 class="entry-title">
<select id="presentaciones">
<option id="shampoo-neutro260">Frasco Dosificador x260ml</option>
</select>
</h2>
<h2 class="entry-title" id="disponible">Disponibles: <span class="unidades" id="shampoo-neutro">10</span>
</h2>
<span class="price"><ins><span class="woocommerce-Price-amount amount"><span class="woocommerce-Price-currencySymbol">$</span>12.00</span></ins>
<del><span class="woocommerce-Price-amount amount"><span class="woocommerce-Price-currencySymbol">$</span>15.00</span></del></span>
<div class="buttons">
<a class="button add_to_cart_button" rel="nofollow">Add to cart</a>
</div>
</div>
</div>
<!-- End Entry -->
</div>
<!--End Col -->
</div>
</div>
我正在尝试将其添加为gestureRecognizer的目标,但是当我点击分段控件时代码会一直崩溃。
@objc private func segmentedControlViewTapped(gestureRecognizer: UITapGestureRecognizer)
由于以下原因导致崩溃:发送无法识别的选择器
答案 0 :(得分:1)
操作需要指向您指定的目标中的函数。
假设segmentedControlViewTapped在您的视图或控制器中,请更改您的代码:
let tapGestureRecognizer = UITapGestureRecognizer(target: self, action: #selector(segmentedControlViewTapped(gestureRecognizer:)))