iOS常见bug

1.控制器之间跳转出现一闪或感觉一卡现象

为控制器的基view设置个背景色即可解决。

2.UITableViewCell/UICollectionCell选中UILabel等背景色消失

  • 想要点击Cell依然有高亮效果,在Cell中写入
- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];
    //自己的label及自己要设置的label背景色
    self.messageLabel.backgroundColor = [UIColor redColor] ;
}

- (void)setHighlighted:(BOOL)highlighted animated:(BOOL)animated {
    [super setHighlighted:highlighted animated:animated];
    //自己的label及自己要设置的label背景色
    self.messageLabel.backgroundColor = [UIColor redColor] ;
}
  • 想要点击Cell没有高亮效果,只需设置cell
cell.selectionStyle = UITableViewCellSelectionStyleNone;

3.扫描相册中图片无法识别二维码

通过别人博客,实践出把图片缩小成 256 像素左右识别率比较高,像我扫描二维码用的第三方SGQRCode,在SGQRCodeObtain.m中加上

- (UIImage *)hkChangeImage:(UIImage *)theImage {
    UIImage* bigImage = theImage;
    float actualHeight = bigImage.size.height;
    float actualWidth = bigImage.size.width;
    float newWidth =0;
    float newHeight =0;
    if(actualWidth > actualHeight) {
    //宽图
    newHeight =256.0f;
    newWidth = actualWidth / actualHeight * newHeight;
    }
    else
    {
    //长图
    newWidth = 256.0f;
    newHeight = actualHeight / actualWidth * newWidth;
    }
    CGRect rect = CGRectMake(0.0,0.0, newWidth, newHeight);
    UIGraphicsBeginImageContext(rect.size);
    [bigImage drawInRect:rect];// scales image to rect
    theImage = UIGraphicsGetImageFromCurrentImageContext();
    UIGraphicsEndImageContext();
    //RETURN
    return theImage;
}

然后在- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info方法中在333行重新写如下代码

// 获取识别结果
NSArray *features = [detector featuresInImage:[CIImage imageWithCGImage:[self hkChangeImage:image].CGImage]];

此解决参考https://www.jianshu.com/p/6d4615ad1a72

4. The linked framework 'Pods_OCDemo.framework' is missing one or more architectures required by this target: arm64.

即SDK仅支持真机运行,要用真机跑

你可能感兴趣的:(iOS常见bug)