在我的UIActionSheet中,我有一個按鈕將觸摸的數組標記爲收藏夾。當數組最喜歡的時候,我有一個星號顯示在數組的名字之前。最喜歡的圖標有一個alpha 0,通過觸摸「Add as Favorite」按鈕,alpha變爲1.數組位於一個UIViewController中,每個單元顯示1個數組。更改UIImageView的alpha並從UIActionSheet中顯示
我遇到的問題是我不得不重新打開ViewController以顯示星星。
我該如何修復,以便在按下「添加爲收藏夾」按鈕時立即顯示星號,而無需重新打開ViewController?
的收藏圖標阿爾法是根據更新:
- (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath
這是更新的阿爾法代碼:
if ([FavoriteArray containsObject: [mainArray objectAtIndex:indexPath.row]])
{
favoriteImage.alpha = 1;
}
謝謝!
你在哪裏更新最喜歡的圖標?你能發佈代碼嗎? – 68cherries
@現在添加67個代碼 – ThomasGulli