美文网首页
项目问题解决统计

项目问题解决统计

作者: woniu | 来源:发表于2022-02-19 14:36 被阅读0次

    1、iOS 计算WKWebView的内容高度

    场景:表里面嵌套网页,需要滑动。
    文章:https://www.jianshu.com/p/221350541c4b
    (demo链接)[https://github.com/shabake/GHWebViewAutomaticHeightDemo]

    2、富文本图文混合

        NSString *left = [AHSystemTool getLocalizedString:@"aihelp_faq_feedback_thanks"];
    
        NSString *string = [NSString stringWithFormat:@"  %@%@", left, tapStr];
    
        NSMutableAttributedString *attStr = [[NSMutableAttributedString alloc] initWithString:string];
    
        [attStr addAttribute:NSForegroundColorAttributeName value:[UIColor AHRGB:0x46526C darkRGB:0xC6C6C6] range:[string rangeOfString:string]];
        [attStr addAttribute:NSFontAttributeName value:[UIFont systemFontOfSize:12] range:[string rangeOfString:string]];
        if (type == FaqTypeNoTapAndProposal) {
            [attStr addAttribute:NSForegroundColorAttributeName value:[UIColor AHRGB:0x46526C darkRGB:0xC6C6C6] range:[string rangeOfString:tapStr]];
        } else {
            [attStr addAttribute:NSForegroundColorAttributeName value:[UIColor AH_colorWithRGB:0x486EFF] range:[string rangeOfString:tapStr]];
        }
    
        NSTextAttachment *attatch = [[NSTextAttachment alloc] initWithData:nil ofType:nil];
        attatch.bounds = CGRectMake(0, -2, 12, 12);
        attatch.image = [UIImage AH_getBundleImageWithName:@"icon_evaluate_success.png"];
        NSAttributedString *attatchStr = [NSAttributedString attributedStringWithAttachment:attatch];
        [attStr insertAttributedString:attatchStr atIndex:0];
    
    

    3、按钮增加点击区域

    #import <UIKit/UIKit.h>
    /*本类用户扩大按钮的点击区域,按照官方建议不小于44 point*/
    @interface VMLLClickButton : UIButton
    
    @end
    
    #import "VMLLClickButton.h"
    
    @implementation VMLLClickButton
    
    - (BOOL)pointInside:(CGPoint)point withEvent:(UIEvent *)event {
        CGRect bounds = self.bounds;
        CGFloat widthDelta = 44.0 - bounds.size.width;
        CGFloat heightDelta = 44.0 - bounds.size.height;
        bounds = CGRectInset(bounds, -0.5 * widthDelta, -0.5 * heightDelta);    //注意这里是负数,扩大了之前的bounds的范围
        return CGRectContainsPoint(bounds, point);
    }
    
    @end
    

    相关文章

      网友评论

          本文标题:项目问题解决统计

          本文链接:https://www.haomeiwen.com/subject/qskplrtx.html