??iOS?????????????6С???Bug
????????? ???????[ 2017/5/19 10:31:20 ] ?????????????????? ??????
????0x0 bug????
????bug???????????????debug??????????????????????ipa?????iPhone5s??iPhoneSE??iPhone5??????????δ????????????????????????????bug?????????
??????????????????cell????????????????????????????
????0x1 ???bug
????bug?????????ipa?????????????ε?????????????????????????????????????????????bug??????н????????????????????????Debug?????Release?????????????:
????????1
????
Debug?л???Release
????????2
????
Debug?л???Release
??????????????run??release?????????????г?????????п????
??????????????????????????????????????????????
??????????Instruments???Core Animation????й??????г????????????????????cpu????????????????UI?????й???????????
?????????????+?????????????????????????????????UICollectionView???棬collectionView?????????£?
CGFloat cellWidth = ([UIScreen mainScreen].bounds.size.width - kLeftEdge - kRightEdge - 2*kCellItemSpacing)/3;
_cellSize = CGSizeMake(cellWidth?? kCellHeight);
UICollectionViewFlowLayout *layout = [[UICollectionViewFlowLayout alloc]init];
layout.itemSize = _cellSize;
layout.sectionInset = UIEdgeInsetsMake(kTopEdge?? kLeftEdge?? kBottomEdge?? kRightEdge);
layout.minimumInteritemSpacing = kCellItemSpacing;
layout.minimumLineSpacing = kCellRowSpacing;
_collectionView = [[UICollectionView alloc]initWithFrame:CGRectMake(0?? 0?? [UIScreen mainScreen].bounds.size.width??_collectionHeight) collectionViewLayout:layout];
_collectionView.showsHorizontalScrollIndicator = NO;
_collectionView.backgroundColor = [UIColor whiteColor];
_collectionView.dataSource = self;
_collectionView.delegate = self;
_collectionView.scrollEnabled = NO;
[_collectionView registerClass:[UICollectionViewCell class] forCellWithReuseIdentifier:kCollectionIdentifier];
[_collectionView registerClass:[UICollectionReusableView class] forSupplementaryViewOfKind:UICollectionElementKindSectionHeader withReuseIdentifier:kCollectionReusableViewHeader];
[_collectionView registerClass:[UICollectionReusableView class] forSupplementaryViewOfKind:UICollectionElementKindSectionFooter withReuseIdentifier:kCollectionReusableViewFooter];
[self.view addSubview:_collectionView];
#pragma mark - UICollectionViewDelegate??UICollectionViewDataSource
- (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath{
UICollectionViewCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:kCollectionIdentifier forIndexPath:indexPath];
return cell;
}
- (UICollectionReusableView *)collectionView:(UICollectionView *)collectionView viewForSupplementaryElementOfKind:(NSString *)kind atIndexPath:(NSIndexPath *)indexPath{
if ([kind isEqualToString:UICollectionElementKindSectionHeader]) {
UICollectionReusableView *view = [collectionView dequeueReusableSupplementaryViewOfKind:UICollectionElementKindSectionHeader withReuseIdentifier:kCollectionReusableViewHeader forIndexPath:indexPath];
for (UIView *subView in view.subviews) {
[subView removeFromSuperview];
}
// view.backgroundColor = [ThemeManager colorForKeyPath:@"WhiteColor"];
view.size = CGSizeMake(LYScreen_Width?? 30);
UILabel *titleLabel = [[UILabel alloc]initWithFrame:CGRectMake(12?? 0?? LYScreen_Width?? 30)];
titleLabel.font = LYFont(12);
titleLabel.textColor = [UIColor LY_ColorWithHexString:@"999999"];
LYChargeDetailModel *model = _model.content[indexPath.section];
titleLabel.text = model.title;
[view addSubview:titleLabel];
return view;
}else{
UICollectionReusableView *view = [collectionView dequeueReusableSupplementaryViewOfKind:UICollectionElementKindSectionFooter withReuseIdentifier:kCollectionReusableViewFooter forIndexPath:indexPath];
// view.backgroundColor = [ThemeManager colorForKeyPath:@"SpaLineColor"];
view.size = CGSizeMake(LYScreen_Width?? 1.0f/[UIScreen mainScreen].scale);
return view;
}
}
- (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section{
LYChargeDetailModel *model = _model.content[section];
return model.items.count;
}
- (NSInteger)numberOfSectionsInCollectionView:(UICollectionView *)collectionView{
return _model.content.count;
}
- (CGSize)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout referenceSizeForHeaderInSection:(NSInteger)section{
return CGSizeMake(LYScreen_Width?? 30);
}
- (CGSize)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout referenceSizeForFooterInSection:(NSInteger)section{
return CGSizeMake(LYScreen_Width?? 1.0f/[UIScreen mainScreen].scale);
}
?????????????????????????????????????????????_collectionView.dataSource = self;??????????????UICollectionView???????????μ??UICollectionViewDataSource?μ????д?????????з????????????鷳?????????п??????????????д??....???????????????????δ?????????????????
- (void)setModel:(LYChargeModel *)model{
...
CGFloat height;
for (int i = 0; i<model.content.count; i++) {
LYChargeDetailModel *detailModel = model.content[i];
NSInteger row = detailModel.items.count/3;
row += (detailModel.items.count%3)?1:0;
height += kCellHeight * row + kCellRowSpacing*(row - 1) + kTopEdge + kBottomEdge + 30;
}
NSInteger address = (NSInteger)(&height);
self.title = [NSString stringWithFormat:@"v:%0.f a:%li"??height??address];
_collectionHeight = height;
...
}
????release???????г???????_collectionHeight?????????÷????????????height????????и?????????height???????????δ???????????????????????????????????????????????????????????飬??height???MAXFLOAT????δ??????????????????????????????????????2?collectionView?????reload??????????????????bug?????????
????0x2 ??????
???????bug??????CGFloat??????????ó??????μ?????????Release?????2???????Debug?????????????????CGFloat???????Debug????Release???μ?????????(??iPhone5s??iPhoneSE?豸??)??
???????????????飬??????Debug??Release????CGFloat??????????0??????????????????????????????????
????????????
CGFloat floatValue;
NSMutableString *text = @"
".mutableCopy;
[text appendFormat:@"CGFloat Default:%f
"??floatValue];
floatValue+=100;
[text appendFormat:@"CGFloat +100:%f
"??floatValue];
//Debug???
CGFloat Default:0.000000
CGFloat +100:100.000000
//Release???
CGFloat Default:0.000000
CGFloat +200:100.000000
?????????Release???????????????????????????????????????Release????????????????????????????顣
????????
NSInteger integer;
CGFloat floatValue;
int i;
float f;
double d;
NSMutableString *text = @"".mutableCopy;
[text appendFormat:@"NSInteger default:%li
"??integer];
[text appendFormat:@"CGFloat default:%f
"??floatValue];
[text appendFormat:@"int default:%i
"??i];
[text appendFormat:@"float default:%f
"??f];
[text appendFormat:@"double default:%f
"??d];
integer+=1;
floatValue+=1;
i+=1;
f+=1;
d+=1;
[text appendFormat:@"NSInteger +1:%li
"??integer];
[text appendFormat:@"CGFloat +1:%f
"??floatValue];
[text appendFormat:@"int +1:%i
"??i];
[text appendFormat:@"float +1:%f
"??f];
[text appendFormat:@"double +1:%f
"??d];
NSLog(@"%@"??text);
iPhone SE
//Debug????
NSInteger default:2 //?????
CGFloat default:0.000000
int default:1//?????
float default:129753328198464616092303097856.000000//?????
double default:0.000000
NSInteger +100:102//?????
CGFloat +100:100.000000
int +100:101//?????
float +100:129753328198464616092303097856.000000//?????
double +100:100.000000
//Release ????
NSInteger default:5533341776//?????
CGFloat default:0.000000
int default:1238374480//?????
float default:0.000000
double default:0.000000
NSInteger +100:5533341776//?????
CGFloat +100:200.000000//?????
int +100:0//?????
float +100:200.000000//?????
double +100:200.000000//?????
iPhone 6
//Debug????
NSInteger default:2//?????
CGFloat default:0.000000
int default:1//?????
float default:137800089569547039707794243584.000000//?????
double default:0.000000
NSInteger +100:102//?????
CGFloat +100:100.000000
int +100:101//?????
float +100:137800089569547039707794243584.000000//?????
double +100:100.000000
//Release ????
NSInteger default:2//?????
CGFloat default:0.000000
int default:1//?????
float default:137800089569547039707794243584.000000//?????
double default:0.000000
NSInteger +100:102//?????
CGFloat +100:100.000000
int +100:101//?????
float +100:137800089569547039707794243584.000000//?????
double +100:100.000000
??????????????????????????????????CGFloat??double??????????????????????????????????iOS????CGFloat???????double??????????????api????CGFloat???????????typedef CGFLOAT_TYPE CGFloat;??
????CGFLOAT_TYPE???????????????????????????????????????????м???????
????????CGFloat Relaese ??????iPhone5s ?? iPhoneSE??????????????м???????????????????????CGRect??CGSize??CGPoint??????ó???????????м???????????????????
????????
CGSize size;
CGRect rect;
CGPoint point;
NSMutableString *text = @"
".mutableCopy;
[text appendFormat:@"CGSize default:%@
"??NSStringFromCGSize(size)];
[text appendFormat:@"CGRect default:%@
"??NSStringFromCGRect(rect)];
[text appendFormat:@"CGPoint default:%@
"??NSStringFromCGPoint(point)];
size.width+=100;
size.height+=100;
rect.size.width+=100;
rect.size.height+=100;
rect.origin.y+=100;
rect.origin.x+=100;
point.y+=100;
point.x+=100;
[text appendFormat:@"CGSize +100:%@
"??NSStringFromCGSize(size)];
[text appendFormat:@"CGRect +100:%@
"??NSStringFromCGRect(rect)];
[text appendFormat:@"CGPoint +100:%@
"??NSStringFromCGPoint(point)];
iPhone SE
//Debug
CGSize default:{4.9406564584124654e-324?? 3.049280293648331e-314}
CGRect default:{{0?? 0}?? {2.6509482737098556e-314?? 3.337809125940193e-314}}
CGPoint default:{0?? 0}
CGSize +100:{100?? 100}
CGRect +100:{{100?? 100}?? {100?? 100}}
CGPoint +100:{100?? 100}
//Release
CGSize default:{0?? 0}
CGRect default:{{nan?? 2.1219957904712067e-314}?? {7.9499288951273625e-275?? 0}}
CGPoint default:{nan?? 2.1219957904712067e-314}
CGSize +100:{200?? 200}
CGRect +100:{{200?? 200}?? {200?? 200}}
CGPoint +100:{200?? 200}
??????????????????Release????CGRect??CGSize??CGPoint????????м??????????????
????0x3 ????
???????????????????????????????
??????
???·???
??????????????????
2023/3/23 14:23:39???д?ò??????????
2023/3/22 16:17:39????????????????????Щ??
2022/6/14 16:14:27??????????????????????????
2021/10/18 15:37:44???????????????
2021/9/17 15:19:29???·???????·
2021/9/14 15:42:25?????????????
2021/5/28 17:25:47??????APP??????????
2021/5/8 17:01:11