标签:
collectionView Cell 设置颜色,蓝色,但是其他cell颜色也蓝色了,因为只写了if 没写else
if (indexPath.item == 0) {
cell.backgroundColor = kEssentialColor;
}else {
cell.backgroundColor = kG6Color;
}
1、获取string的宽度
-(float) width:(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;
}
}
--------------------------------------------------
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]; .// 不是数组的方法,会崩溃
标签:
原文地址:http://www.cnblogs.com/tufei7/p/5454118.html