簡體   English   中英

當我單擊UIButton時淡出所有其他UIButtons

[英]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.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM