陪你皇冠展示规则

2017-03-21  本文已影响0人  iOS乐乐
        //首页地图多皇冠展示规则:
        //1.对比皇冠与皇冠之间排名,展示排名优先的皇冠,如:金币榜排名第一,诚信榜排名第二,展示金币榜皇冠
        //2.若皇冠与皇冠之间排名相同,展示优先度:金币>土豪>诚信
        /**
         *  自定义排名
         */
//        pointAnno.goldStr =@"2";
//        pointAnno.buyStr=@"1";
//        pointAnno.integrityStr=@"1";
        
        
        
        NSInteger goldRank=[pointAnno.goldStr integerValue] ;//金币
        NSInteger buyRank=[pointAnno.buyStr integerValue];//土豪
        NSInteger integrityRank=[pointAnno.integrityStr integerValue];//诚信

        if (!goldRank && !buyRank && !integrityRank)
        {
            guanImg.hidden=YES;
        }
        else if (goldRank == 0 && buyRank ==0 &&  integrityRank ==0)
        {
            guanImg.hidden=YES;
        }
        else
        {
            
            if (goldRank==1 || buyRank==1 || integrityRank==1)
            {
                if (goldRank==1)
                {
                    guanImg.image=[UIImage imageNamed:@"金币榜"];
                }
                else if (buyRank==1 && goldRank!=1 )
                {
                    guanImg.image=[UIImage imageNamed:@"土豪榜"];
                }
                
                else if (integrityRank ==1 && buyRank !=1 && goldRank!=1)
                {
                    guanImg.image=[UIImage imageNamed:@"诚信榜"];
                    guanImg.bounds=CGRectMake(0, 0, 34*PIX, 30*PIX);

                }
                
            }
            else
            {
                NSArray *testArray = [NSArray arrayWithObjects:pointAnno.goldStr, pointAnno.buyStr, pointAnno.integrityStr,nil];
                NSNumber* min1=[testArray valueForKeyPath:@"@min.floatValue"];
                NSInteger row=[testArray indexOfObject:min1.stringValue];
                NSLog(@"row--->%ld",row);
                
                if (row==0)
                {
                    guanImg.image=[UIImage imageNamed:@"金币榜"];
                }
                else if (row==1)
                {
                    guanImg.image=[UIImage imageNamed:@"土豪榜"];
                }
                else
                {
                    guanImg.image=[UIImage imageNamed:@"诚信榜"];
                    guanImg.bounds=CGRectMake(0, 0, 34*PIX, 30*PIX);

                }
            }
   
        }

上一篇下一篇

猜你喜欢

热点阅读