iOS常見bug

1.控制器之間跳轉出現(xiàn)一閃或感覺一卡現(xiàn)象

為控制器的基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<NSString *,id> *)info方法中在333行重新寫如下代碼

// 獲取識別結果
NSArray *features = [detector featuresInImage:[CIImage imageWithCGImage:[self hkChangeImage:image].CGImage]];

此解決參考http://www.itdecent.cn/p/6d4615ad1a72

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

即SDK僅支持真機運行,要用真機跑

最后編輯于
?著作權歸作者所有,轉載或內容合作請聯(lián)系作者
【社區(qū)內容提示】社區(qū)部分內容疑似由AI輔助生成,瀏覽時請結合常識與多方信息審慎甄別。
平臺聲明:文章內容(如有圖片或視頻亦包括在內)由作者上傳并發(fā)布,文章內容僅代表作者本人觀點,簡書系信息發(fā)布平臺,僅提供信息存儲服務。

友情鏈接更多精彩內容