[英]Stop all UIButtons from working when I tap 1 UIButton swift
[英]Fade out all other UIButtons when i click on a UIButton
我已在視圖中放置了10個UIButton
用於在應用程序內購買10個項目。
當我單擊一個按鈕時,我要淡出所有其余按鈕。
付款完成后,我想淡入所有按鈕,淡出我已經購買的按鈕。
誰能幫我?
我的示例代碼:
[UIView animateWithDuration:0.25 animations:^{myButton.alpha = 0.0;}];
試試這個:將此循環放在Button的目標中
for (UIView* subView in self.view.subviews)
{
if ([subView isKindOfClass:[UIButton class]]) // Put conditions using Tag Or name to check need to allow
[UIView animateWithDuration:0.25 animations:^{subView.alpha = 0.0;}];
}
您知道有一個完成交易的代表:
- (void)paymentQueue:(SKPaymentQueue *)queue updatedTransactions:(NSArray *)transactions
{
for (UIView* subView in self.view.subviews)
{
if ([subView isKindOfClass:[UIButton class]])
[UIView animateWithDuration:0.25 animations:^{subView.alpha = 1.0f;}];
}
}
注意:我尚未測試。 根據需要進行一些更改
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.