富文本

This commit is contained in:
祝发冬 2023-12-06 14:23:20 +08:00
parent 76bae4fe60
commit 0a13ae3810
2 changed files with 46 additions and 19 deletions

View File

@ -224,18 +224,39 @@ extern BOOL isfromCameraView;
return;
}
WEAK_SELF;
NSString*red =@"2、先长按插座复位键3秒松手后红灯绿灯同时 闪烁,再点确定按钮。";
NSString* tips = @"提示:由于新版APP升级产品包装盒内的说明书可能与新版APP联网方式不同请以APP界面提示内容为准也可查看右上角视频教程。";
NSString*red2 =@"2、先长按插座复位键13秒左右松手后红灯绿灯同时熄灭,只有绿灯偶尔闪烁,再点下一步。";
NSString* tips2 = @"提示:由于新版APP升级产品包装盒内的说明书可能与新版APP联网方式不同请以APP界面提示内容为准也可查看右上角视频教程。";
NSString*airkisTitle = @"一键联网";
NSString*smartTitle = @"快捷联网";
NSString*apTitle = @"AP联网";
NSString*airkisTips = @"1、插座仅支持2.4G的WiFi网络不支持5G 及 双频合一的网络(需在路由器设置中分开)\n2、先长按插座复位键3秒松手后红灯绿灯同时 闪烁,再点确定按钮。\n3、如多次尝试一键联网都不成功可切换其他 联网方式,每次重新连接时插座需断一次电然后重新复位连接。";
NSString*airkisTips = @"1、插座仅支持2.4G的WiFi网络不支持5G 及 双频合一的网络(需在路由器设置中分开)\n2、先长按插座复位键3秒松手后红灯绿灯同时 闪烁,再点确定按钮。\n3、如多次尝试一键联网都不成功可切换其他 联网方式,每次重新连接时插座需断一次电然后重新复位连接。\n\n提示:由于新版APP升级产品包装盒内的说明书可能与新版APP联网方式不同请以APP界面提示内容为准也可查看右上角视频教程。";
NSString*smartTips = airkisTips;
NSString*apTips = @"1、插座仅支持2.4G的WiFi网络不支持5G 及 双频合一的网络(需在路由器设置中分开)\n2、先长按插座复位键13秒左右松手后红灯绿灯同时熄灭,只有绿灯偶尔闪烁,再点下一步。";
NSString*apTips = @"1、插座仅支持2.4G的WiFi网络不支持5G 及 双频合一的网络(需在路由器设置中分开)\n2、先长按插座复位键13秒左右松手后红灯绿灯同时熄灭,只有绿灯偶尔闪烁,再点下一步。\n\n提示:由于新版APP升级产品包装盒内的说明书可能与新版APP联网方式不同请以APP界面提示内容为准也可查看右上角视频教程。";
NSMutableAttributedString*attair = [[NSMutableAttributedString alloc]initWithString:airkisTips attributes:@{NSForegroundColorAttributeName:[UIColor blackColor],NSFontAttributeName:[UIFont systemFontOfSize:16]}];
[attair addAttributes:@{NSForegroundColorAttributeName:[UIColor redColor]} range:[airkisTips rangeOfString:red]];
[attair addAttributes:@{NSFontAttributeName:[UIFont systemFontOfSize:11]} range:[airkisTips rangeOfString:tips]];
NSMutableAttributedString*attap = [[NSMutableAttributedString alloc]initWithString:apTips attributes:@{NSForegroundColorAttributeName:[UIColor blackColor],NSFontAttributeName:[UIFont systemFontOfSize:16]}];
[attap addAttributes:@{NSForegroundColorAttributeName:[UIColor redColor]} range:[apTips rangeOfString:red2]];
[attap addAttributes:@{NSFontAttributeName:[UIFont systemFontOfSize:11]} range:[apTips rangeOfString:tips2]];
SPAlertController*alert =[SPAlertController alertControllerWithTitle:nil message:nil preferredStyle:SPAlertControllerStyleActionSheet animationType:SPAlertAnimationTypeDefault];
SPAlertAction*airkiss =[SPAlertAction actionWithTitle:airkisTitle style:SPAlertActionStyleDefault handler:^(SPAlertAction * _Nonnull action) {
[weakSelf connectNormalView];
weakSelf.connectType = ConnectTypeAirKiss;
weakSelf.connectTypeTitle.text = airkisTitle;
weakSelf.connectTipLbl.text = airkisTips;
weakSelf.connectTipLbl.text = nil;
weakSelf.connectTipLbl.attributedText = attair;
//
weakSelf.shuoMingShuBtn.hidden = NO;
[weakSelf.connectBtn setTitle:@"确定" forState:UIControlStateNormal];
}];
@ -243,16 +264,22 @@ extern BOOL isfromCameraView;
SPAlertAction*smart =[SPAlertAction actionWithTitle:smartTitle style:SPAlertActionStyleDefault handler:^(SPAlertAction * _Nonnull action) {
[weakSelf connectNormalView];
weakSelf.connectType = ConnectTypeSmartConfig;
weakSelf.shuoMingShuBtn.hidden = YES;
weakSelf.connectTypeTitle.text = smartTitle;
weakSelf.connectTipLbl.text = smartTips;
weakSelf.connectTipLbl.text = nil;
weakSelf.connectTipLbl.attributedText = attair;
[weakSelf.connectBtn setTitle:@"确定" forState:UIControlStateNormal];
}];
SPAlertAction*ap =[SPAlertAction actionWithTitle:apTitle style:SPAlertActionStyleDefault handler:^(SPAlertAction * _Nonnull action) {
[weakSelf connectNormalView];
weakSelf.connectType = ConnectTypeAP;
weakSelf.shuoMingShuBtn.hidden = YES;
weakSelf.connectTypeTitle.text = apTitle;
weakSelf.connectTipLbl.text = apTips;
weakSelf.connectTipLbl.text = nil;
weakSelf.connectTipLbl.attributedText = attap;
[weakSelf.connectBtn setTitle:@"下一步" forState:UIControlStateNormal];
}];
SPAlertAction*cancel =[SPAlertAction actionWithTitle:@"取消" style:SPAlertActionStyleCancel handler:^(SPAlertAction * _Nonnull action) {

View File

@ -114,7 +114,7 @@
<nil key="highlightedColor"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" usesAttributedText="YES" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="5UF-8K-mpU" userLabel="connectTipLbl">
<rect key="frame" x="40" y="268" width="240" height="271.5"/>
<rect key="frame" x="40" y="268" width="240" height="275.5"/>
<attributedString key="attributedText">
<fragment content="1">
<attributes>
@ -126,7 +126,7 @@
<fragment content="、插座仅支持">
<attributes>
<color key="NSColor" name="textColor" catalog="System" colorSpace="catalog"/>
<font key="NSFont" size="16" name=".PingFangSC-Regular"/>
<font key="NSFont" metaFont="system" size="16"/>
<font key="NSOriginalFont" metaFont="system" size="16"/>
<paragraphStyle key="NSParagraphStyle" alignment="center" lineBreakMode="wordWrapping" baseWritingDirection="natural" tighteningFactorForTruncation="0.0"/>
</attributes>
@ -141,7 +141,7 @@
<fragment content="的">
<attributes>
<color key="NSColor" name="textColor" catalog="System" colorSpace="catalog"/>
<font key="NSFont" size="16" name=".PingFangSC-Regular"/>
<font key="NSFont" metaFont="system" size="16"/>
<font key="NSOriginalFont" metaFont="system" size="16"/>
<paragraphStyle key="NSParagraphStyle" alignment="center" lineBreakMode="wordWrapping" baseWritingDirection="natural" tighteningFactorForTruncation="0.0"/>
</attributes>
@ -156,7 +156,7 @@
<fragment content="网络,不支持">
<attributes>
<color key="NSColor" name="textColor" catalog="System" colorSpace="catalog"/>
<font key="NSFont" size="16" name=".PingFangSC-Regular"/>
<font key="NSFont" metaFont="system" size="16"/>
<font key="NSOriginalFont" metaFont="system" size="16"/>
<paragraphStyle key="NSParagraphStyle" alignment="center" lineBreakMode="wordWrapping" baseWritingDirection="natural" tighteningFactorForTruncation="0.0"/>
</attributes>
@ -171,7 +171,7 @@
<fragment content="及">
<attributes>
<color key="NSColor" name="textColor" catalog="System" colorSpace="catalog"/>
<font key="NSFont" size="16" name=".PingFangSC-Regular"/>
<font key="NSFont" metaFont="system" size="16"/>
<font key="NSOriginalFont" metaFont="system" size="16"/>
<paragraphStyle key="NSParagraphStyle" alignment="center" lineBreakMode="wordWrapping" baseWritingDirection="natural" tighteningFactorForTruncation="0.0"/>
</attributes>
@ -186,7 +186,7 @@
<fragment content="双频合一的网络">
<attributes>
<color key="NSColor" name="textColor" catalog="System" colorSpace="catalog"/>
<font key="NSFont" size="16" name=".PingFangSC-Regular"/>
<font key="NSFont" metaFont="system" size="16"/>
<font key="NSOriginalFont" metaFont="system" size="16"/>
<paragraphStyle key="NSParagraphStyle" alignment="center" lineBreakMode="wordWrapping" baseWritingDirection="natural" tighteningFactorForTruncation="0.0"/>
</attributes>
@ -201,7 +201,7 @@
<fragment content="需在路由器设置中分开">
<attributes>
<color key="NSColor" name="textColor" catalog="System" colorSpace="catalog"/>
<font key="NSFont" size="16" name=".PingFangSC-Regular"/>
<font key="NSFont" metaFont="system" size="16"/>
<font key="NSOriginalFont" metaFont="system" size="16"/>
<paragraphStyle key="NSParagraphStyle" alignment="center" lineBreakMode="wordWrapping" baseWritingDirection="natural" tighteningFactorForTruncation="0.0"/>
</attributes>
@ -225,7 +225,7 @@
<fragment content="、先长按插座复位键">
<attributes>
<color key="NSColor" red="1" green="0.0" blue="0.0" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<font key="NSFont" size="16" name=".PingFangSC-Regular"/>
<font key="NSFont" metaFont="system" size="16"/>
<font key="NSOriginalFont" metaFont="system" size="16"/>
<paragraphStyle key="NSParagraphStyle" alignment="center" lineBreakMode="wordWrapping" baseWritingDirection="natural" tighteningFactorForTruncation="0.0"/>
</attributes>
@ -240,7 +240,7 @@
<fragment content="秒,松手后红灯绿灯同时">
<attributes>
<color key="NSColor" red="1" green="0.0" blue="0.0" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<font key="NSFont" size="16" name=".PingFangSC-Regular"/>
<font key="NSFont" metaFont="system" size="16"/>
<font key="NSOriginalFont" metaFont="system" size="16"/>
<paragraphStyle key="NSParagraphStyle" alignment="center" lineBreakMode="wordWrapping" baseWritingDirection="natural" tighteningFactorForTruncation="0.0"/>
</attributes>
@ -255,7 +255,7 @@
<fragment content="闪烁">
<attributes>
<color key="NSColor" red="1" green="0.0" blue="0.0" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<font key="NSFont" size="16" name=".PingFangSC-Regular"/>
<font key="NSFont" metaFont="system" size="16"/>
<font key="NSOriginalFont" metaFont="system" size="16"/>
<paragraphStyle key="NSParagraphStyle" alignment="center" lineBreakMode="wordWrapping" baseWritingDirection="natural" tighteningFactorForTruncation="0.0"/>
</attributes>
@ -270,7 +270,7 @@
<fragment content="再点确定按钮。">
<attributes>
<color key="NSColor" red="1" green="0.0" blue="0.0" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<font key="NSFont" size="16" name=".PingFangSC-Regular"/>
<font key="NSFont" metaFont="system" size="16"/>
<font key="NSOriginalFont" metaFont="system" size="16"/>
<paragraphStyle key="NSParagraphStyle" alignment="center" lineBreakMode="wordWrapping" baseWritingDirection="natural" tighteningFactorForTruncation="0.0"/>
</attributes>
@ -287,7 +287,7 @@
<fragment content="、如多次尝试一键联网都不成功,可切换其他">
<attributes>
<color key="NSColor" name="textColor" catalog="System" colorSpace="catalog"/>
<font key="NSFont" size="16" name=".PingFangSC-Regular"/>
<font key="NSFont" metaFont="system" size="16"/>
<font key="NSOriginalFont" metaFont="system" size="16"/>
<paragraphStyle key="NSParagraphStyle" alignment="center" lineBreakMode="wordWrapping" baseWritingDirection="natural" tighteningFactorForTruncation="0.0"/>
</attributes>
@ -302,7 +302,7 @@
<fragment content="联网方式,每次重新连接时插座需断一次电">
<attributes>
<color key="NSColor" name="textColor" catalog="System" colorSpace="catalog"/>
<font key="NSFont" size="16" name=".PingFangSC-Regular"/>
<font key="NSFont" metaFont="system" size="16"/>
<font key="NSOriginalFont" metaFont="system" size="16"/>
<paragraphStyle key="NSParagraphStyle" alignment="center" lineBreakMode="wordWrapping" baseWritingDirection="natural" tighteningFactorForTruncation="0.0"/>
</attributes>
@ -320,7 +320,7 @@ Cg
<fragment content="然后重新复位连接。">
<attributes>
<color key="NSColor" name="textColor" catalog="System" colorSpace="catalog"/>
<font key="NSFont" size="16" name=".PingFangSC-Regular"/>
<font key="NSFont" metaFont="system" size="16"/>
<font key="NSOriginalFont" metaFont="system" size="16"/>
<paragraphStyle key="NSParagraphStyle" alignment="center" lineBreakMode="wordWrapping" baseWritingDirection="natural" tighteningFactorForTruncation="0.0"/>
</attributes>