zoukankan      html  css  js  c++  java
  • 加字母的逻辑有的 绕弯,

    -(void)setCityBgcolor:(int)row indexLetter:(NSString *)letter 

    {

       

        if (row != frontRow || (row == 0 && !rowZeroOneTime)) {

            

            UIImageView *citylistBgView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"citylist_bg.png"]];

            citylistBgView.frame = CGRectMake(0, originY, 320, 42);

            [self.cityScrollView addSubview:citylistBgView];

            citylistBgView.tag = citylistBgViewtag;

            citylistBgViewtag++;

            

            cityIndexImageView = [[UIImageViewalloc] initWithImage:[UIImageimageNamed:@"city_index_bg.png"]];

            cityIndexImageView.frame = CGRectMake(0, row*41-1, 14, 42);

            cityIndexImageView.backgroundColor = [UIColorclearColor];

            if (![frontLetter isEqualToString:letter]) {

                UILabel *label = [[UILabel alloc] init];

                [label setFont:[UIFont fontWithName:@"Helvetica" size:12.0]];

                label.frame = CGRectMake(2, 0, 14, 42);

                label.backgroundColor = [UIColor clearColor];

                label.text = letter;

                label.textColor = [UIColor whiteColor];

                [cityIndexImageView addSubview:label];

            }

     

            cityIndexImageView.tag = imageIndexViewTag;

            imageIndexViewTag ++;

            [self.cityScrollViewaddSubview:cityIndexImageView];

            

            rowZeroOneTime = YES;

            originY = originY+41;

            frontLetter = letter;

        }

        

        frontRow = row;

     

    }

  • 相关阅读:
    在使用cocos3.x版本的时候,如果出现了mainWindow为空的情况
    unity的一些小细节
    Python基础概念2
    Python基础概念
    AIR窗体相关
    cocos2dx 3.x 关于action的回调函数
    cocos2dx 3.x 打包APK
    cocos2dx 3.x 绘图API
    cocos2dx 3.x getVisibleSize 和 getContentSize 和 getWinSize 和 getVisibleOrigin
    cocos2dx 3.x 快速创建项目
  • 原文地址:https://www.cnblogs.com/guligei/p/3025879.html
Copyright © 2011-2022 走看看