zoukankan      html  css  js  c++  java
  • 五一结束,北戴河,yy,差一点,不太敢

    collectionView Cell 设置颜色,蓝色,但是其他cell颜色也蓝色了,因为只写了if 没写else

        if (indexPath.item == 0) {

            cell.backgroundColor = kEssentialColor;

        }else {

            cell.backgroundColor = kG6Color;

        }

     

     

    1、获取string的宽度

    -(float) (NSString *)text{

       CGSize size=[text sizeWithFont:[UIFont systemFontOfSize:15]constrainedToSize:CGSizeMake(MAXFLOAT,36)];

       //text是想要计算的字符串,15是字体的大小,36是字符串的高度(根据需求自己改变)

        return size.width;

    }

     

    collectionViewCell 间距不对

    - (NSArray *) layoutAttributesForElementsInRect:(CGRect)rect {
        NSArray *answer = [super layoutAttributesForElementsInRect:rect];

    for(int i = 1; i <  [answer count]; ++i) {
            UICollectionViewLayoutAttributes *currentLayoutAttributes = answer[i];
            UICollectionViewLayoutAttributes *prevLayoutAttributes = answer[i - 1];
            NSInteger maximumSpacing = 4;
            NSInteger origin = CGRectGetMaxX(prevLayoutAttributes.frame);
            if(origin + maximumSpacing + currentLayoutAttributes.frame.size.width <  self.collectionViewContentSize.width) {
                CGRect frame = currentLayoutAttributes.frame;
                frame.origin.x = origin + maximumSpacing;
                currentLayoutAttributes.frame = frame;
            }
        }
        return answer;
    }
    -------

    一个接口高了一下午,定位,直接用小崔给的代码就行了 参数,省份,城市参数

     

     

    ---------

    /**

     *  去掉"市"

     *

     *  @param string 待验证的字符串

     *

     *  @return 不带"市"的字符串

     */

    -(NSString *)removeShi:(NSString *)string {

        if ([string hasSuffix:@"市"]) {

            return [string componentsSeparatedByString:@"市"][0];

        }else {

            return string;

        }

    }

    计算机生成了可选文字:
Find Text Containing 
Q- CHDFSpeciaIComeDataHeIper outpa 
Ńi*matchinq containing 
m HDFHospitaITabIeViewControIIer.m ne

     

    --------------------------------------------------

    iOS6被废弃的方法,判断后使用

    ------------------------------------

    隐藏出诊地点,--根据数据来变的,给个假数据

    ------------------------------

    数组不能调用removeObjAtIndex方法

    可变数组才能调用removeObjAtIndex方法

    ------------------------------------

    这个请求写的太繁琐

    - (void)requestSpecialistComingInfor:(NSString *)lbsProvince lbsCity:(NSString *)lbsCity province:(NSString *)province city:(NSString *)city {

    ------------------------------------------------------------

        NSMutableArray *tempOriginFacultyArray = self.originFacultyArray.copy; //删除崩溃

    mutableCopy不崩溃  

        [temp delete:model]; .// 不是数组的方法,会崩溃

  • 相关阅读:
    POJ 1426 Find The Multiple(数论——中国同余定理)
    POJ 2253 Frogger(Dijkstra变形——最短路径最大权值)
    POJ 3790 最短路径问题(Dijkstra变形——最短路径双重最小权值)
    POJ 3278 Catch That Cow(模板——BFS)
    HDU 1071 The area
    HDU 1213 How Many Tables(模板——并查集)
    POJ 1611 The Suspects
    light oj 1214 Large Division
    POJ 1258 Agri-Net(Prim算法求解MST)
    POJ 2387 Til the Cows Come Home(模板——Dijkstra算法)
  • 原文地址:https://www.cnblogs.com/tufei7/p/5454118.html
Copyright © 2011-2022 走看看