zoukankan      html  css  js  c++  java
  • 地区选择,数据源搞错了,

    1,数据源错了,

     

    -(void)adjustProvinceCityFormatByCityId:(int)cId  andProvinceId:(int)pId

    {

    //    找到省份包含的所有城市

        self.cityArray = [selfcityArrayByProvinCode:pId];

    //    定位具体城市

        

        for (int i = 0;i < self.cityArray.count; i++) {

            CommonDistrctInfo *info = [self.cityArrayobjectAtIndex:i];

            if (cId == info.idNumber) {

                [self.pickerViewselectRow:i inComponent:1animated:YES];//定位pickview,数据源是self.cityarray,而这里用的  mcityArray

                currentCityIndex = i;

                break;

                  }

        }

    //    定位省份

        for (int j = 0; j< self.provinceArray.count; j++) {

            CommonDistrctInfo *infos = [self.provinceArrayobjectAtIndex:j];

            if (infos.idNumber == pId) {

                [self.pickerViewselectRow:j inComponent:0animated:YES];//j 在数组里面的索引

                currentProvinceIndex = j;

                break;

            }

            

        }

        

    没有地区时候,做的处理,用省份的第一个,

        if (self.cityArray.count == 0) {

             CommonDistrctInfo *mInfo = [self.provinceArrayobjectAtIndex:0];

            self.cityArray = [self cityArrayByProvinCode:mInfo.idNumber];

        }

        

        

       }

  • 相关阅读:
    mysql 约束条件 外键 forigen key 介绍
    【洛谷P4655】Building Bridges
    【CF1139D】Steps to One
    【YbtOJ#20073】钻石守卫
    【YbtOJ#20072】相似子串
    【YbtOJ#20071】礼物购买
    【洛谷P4149】Race
    【洛谷P2059】卡牌游戏
    【CF140C】New Year Snowmen
    【GMOJ4282】平方数游戏
  • 原文地址:https://www.cnblogs.com/guligei/p/3389115.html
Copyright © 2011-2022 走看看