2016-11-20 75 views
-2

我在屏幕上有smallButtongiantButtongiantButton在啓動時未啓用,當smallButton被點擊時,它會隱藏並且出現giantButton由另一個按鈕覆蓋的按鈕,因此無法被挖掘

我的問題是,它似乎像smallButtongiantButton覆蓋,當我點擊smallButton,其IBAction爲不會被觸發,它在故事板連接好。

是否因爲smallButtongiantButton覆蓋,還是其他?

+0

你把它們放在彼此之上嗎? –

+0

@RashwanL是的,我不能說哪一個正好在最上面 –

+0

你可以隱藏巨大的按鈕,當viewLoads和取消隱藏時,按下小按鈕反之亦然 – Joe

回答

0

如果您將UIView的任何實例設置爲隱藏(或alpha 0),它將不會阻止UI交互。

看看是否禁用userInteractionEnabled幫助你或者你可以override func pointInside(point: CGPoint, withEvent event: UIEvent?) -> Bool在你的子類,並通過通過觸摸事件...

0

我看到了問題,這giantButton包含在堆棧視圖中,雖然我試圖隱藏/禁用giantButton ,這個堆棧視圖仍然阻止我的交互。

根據@ der_michael的建議,我禁用了堆棧視圖的用戶交互,現在它可以工作。

+0

你沒有在你的問題中提到堆棧視圖 –

+0

@der_michael☺️甚至沒有意識到它在那裏 –