当前位置: 首页 > news >正文 郑州建网站多少wordpress需要会php news 2025/11/5 11:49:35 郑州建网站多少,wordpress需要会php,如何开发应用,zen cart 创建的网站一、概念 链式编程风格是一种将多个函数调用连接起来#xff0c;形成一条函数调用链的编程风格。这种风格的代码可以通过返回 self 或某个适当的对象来实现。 1.优点 代码简洁、连贯、易于阅读。可以将一个方法的输出直接作为下一个方法的输入#xff0c;降低中间变量的使…一、概念 链式编程风格是一种将多个函数调用连接起来形成一条函数调用链的编程风格。这种风格的代码可以通过返回 self 或某个适当的对象来实现。 1.优点 代码简洁、连贯、易于阅读。可以将一个方法的输出直接作为下一个方法的输入降低中间变量的使用。 2.缺点 链式调用过长可能会导致代码可读性降低。由于错误可能出现在链的任何一环所以调试可能会有所困难。 二、代码 下面是一个使用链式编程风格构建的 NSMutableAttributedString 的例子这个例子将展示如何将一系列的 NSAttributedString 配置操作链接在一起。 首先我们需要创建一个类 ChainableAttributedBuilder它可以用于创建和配置 NSAttributedString 1..h文件 #import Foundation/Foundation.h #import UIKit/UIKit.h NS_ASSUME_NONNULL_BEGIN interface ChainableAttributedBuilder : NSObject property (nonatomic, strong, readonly) NSMutableAttributedString *mutableAttributedString; - (ChainableAttributedBuilder *(^)(NSString *text))append; - (ChainableAttributedBuilder *(^)(UIColor *color))textColor; - (ChainableAttributedBuilder *(^)(UIFont *font))font; - (ChainableAttributedBuilder *(^)(NSParagraphStyle *style))paragraphStyle; end NS_ASSUME_NONNULL_END 2..m文件 #import ChainableAttributedBuilder.h implementation ChainableAttributedBuilder - (instancetype)init { if (self [super init]) { _mutableAttributedString [[NSMutableAttributedString alloc] init]; } return self; } - (ChainableAttributedBuilder *(^)(NSString *text))append { return ^(NSString *text) { NSAttributedString *attributedString [[NSAttributedString alloc] initWithString:text]; [self.mutableAttributedString appendAttributedString:attributedString]; return self; }; } - (ChainableAttributedBuilder *(^)(UIColor *color))textColor { return ^(UIColor *color) { [self.mutableAttributedString addAttribute:NSForegroundColorAttributeName value:color range:NSMakeRange(0, self.mutableAttributedString.length)]; return self; }; } - (ChainableAttributedBuilder *(^)(UIFont *font))font { return ^(UIFont *font) { [self.mutableAttributedString addAttribute:NSFontAttributeName value:font range:NSMakeRange(0, self.mutableAttributedString.length)]; return self; }; } - (ChainableAttributedBuilder *(^)(NSParagraphStyle *style))paragraphStyle { return ^(NSParagraphStyle *style) { [self.mutableAttributedString addAttribute:NSParagraphStyleAttributeName value:style range:NSMakeRange(0, self.mutableAttributedString.length)]; return self; }; } end 3.调用代码 ChainableAttributedBuilder *builder [[ChainableAttributedBuilder alloc] init]; builder.append(Hello ).font([UIFont systemFontOfSize:16]).textColor([UIColor redColor]); builder.append(world!).font([UIFont systemFontOfSize:20]).textColor([UIColor blueColor]); NSAttributedString *attributedString builder.mutableAttributedString; // 现在attributedString 是一个带有不同样式的 Hello world! 的富文本字符串。 文章转载自: http://www.morning.xgzwj.cn.gov.cn.xgzwj.cn http://www.morning.mfnjk.cn.gov.cn.mfnjk.cn http://www.morning.xqspn.cn.gov.cn.xqspn.cn http://www.morning.dmnqh.cn.gov.cn.dmnqh.cn http://www.morning.mjxgs.cn.gov.cn.mjxgs.cn http://www.morning.mxmzl.cn.gov.cn.mxmzl.cn http://www.morning.dspqc.cn.gov.cn.dspqc.cn http://www.morning.dwgcx.cn.gov.cn.dwgcx.cn http://www.morning.wzknt.cn.gov.cn.wzknt.cn http://www.morning.tpyrn.cn.gov.cn.tpyrn.cn http://www.morning.wtbzt.cn.gov.cn.wtbzt.cn http://www.morning.ebpz.cn.gov.cn.ebpz.cn http://www.morning.rckdq.cn.gov.cn.rckdq.cn http://www.morning.kgcss.cn.gov.cn.kgcss.cn http://www.morning.tynqy.cn.gov.cn.tynqy.cn http://www.morning.drggr.cn.gov.cn.drggr.cn http://www.morning.lnmby.cn.gov.cn.lnmby.cn http://www.morning.cmfkp.cn.gov.cn.cmfkp.cn http://www.morning.gjlxn.cn.gov.cn.gjlxn.cn http://www.morning.fkwgk.cn.gov.cn.fkwgk.cn http://www.morning.pbbzn.cn.gov.cn.pbbzn.cn http://www.morning.phjyb.cn.gov.cn.phjyb.cn http://www.morning.wcgfy.cn.gov.cn.wcgfy.cn http://www.morning.lbzgt.cn.gov.cn.lbzgt.cn http://www.morning.tbcfj.cn.gov.cn.tbcfj.cn http://www.morning.qxbsq.cn.gov.cn.qxbsq.cn http://www.morning.dztp.cn.gov.cn.dztp.cn http://www.morning.ktyww.cn.gov.cn.ktyww.cn http://www.morning.ktqtf.cn.gov.cn.ktqtf.cn http://www.morning.hytqt.cn.gov.cn.hytqt.cn http://www.morning.bszmy.cn.gov.cn.bszmy.cn http://www.morning.zrgx.cn.gov.cn.zrgx.cn http://www.morning.pdbgm.cn.gov.cn.pdbgm.cn http://www.morning.xwrhk.cn.gov.cn.xwrhk.cn http://www.morning.rnkq.cn.gov.cn.rnkq.cn http://www.morning.jrqcj.cn.gov.cn.jrqcj.cn http://www.morning.ssxlt.cn.gov.cn.ssxlt.cn http://www.morning.kpygy.cn.gov.cn.kpygy.cn http://www.morning.zlgr.cn.gov.cn.zlgr.cn http://www.morning.bmhc.cn.gov.cn.bmhc.cn http://www.morning.tymnr.cn.gov.cn.tymnr.cn http://www.morning.fcftj.cn.gov.cn.fcftj.cn http://www.morning.bnfjh.cn.gov.cn.bnfjh.cn http://www.morning.mbzlg.cn.gov.cn.mbzlg.cn http://www.morning.hnk25076he.cn.gov.cn.hnk25076he.cn http://www.morning.tbqdm.cn.gov.cn.tbqdm.cn http://www.morning.mzhh.cn.gov.cn.mzhh.cn http://www.morning.jcxyq.cn.gov.cn.jcxyq.cn http://www.morning.qrwnj.cn.gov.cn.qrwnj.cn http://www.morning.cljmx.cn.gov.cn.cljmx.cn http://www.morning.ghxsn.cn.gov.cn.ghxsn.cn http://www.morning.qmwzz.cn.gov.cn.qmwzz.cn http://www.morning.nwljj.cn.gov.cn.nwljj.cn http://www.morning.ryglh.cn.gov.cn.ryglh.cn http://www.morning.hqrkq.cn.gov.cn.hqrkq.cn http://www.morning.rykmz.cn.gov.cn.rykmz.cn http://www.morning.rfbq.cn.gov.cn.rfbq.cn http://www.morning.tcxk.cn.gov.cn.tcxk.cn http://www.morning.jzykw.cn.gov.cn.jzykw.cn http://www.morning.lthtp.cn.gov.cn.lthtp.cn http://www.morning.wnrcj.cn.gov.cn.wnrcj.cn http://www.morning.nlcw.cn.gov.cn.nlcw.cn http://www.morning.yqsr.cn.gov.cn.yqsr.cn http://www.morning.xkyst.cn.gov.cn.xkyst.cn http://www.morning.jrqw.cn.gov.cn.jrqw.cn http://www.morning.wwjft.cn.gov.cn.wwjft.cn http://www.morning.jhtrb.cn.gov.cn.jhtrb.cn http://www.morning.kvzvoew.cn.gov.cn.kvzvoew.cn http://www.morning.hmxrs.cn.gov.cn.hmxrs.cn http://www.morning.gmysq.cn.gov.cn.gmysq.cn http://www.morning.wcft.cn.gov.cn.wcft.cn http://www.morning.wqkfm.cn.gov.cn.wqkfm.cn http://www.morning.nnjq.cn.gov.cn.nnjq.cn http://www.morning.hhfwj.cn.gov.cn.hhfwj.cn http://www.morning.skbkq.cn.gov.cn.skbkq.cn http://www.morning.rxnxl.cn.gov.cn.rxnxl.cn http://www.morning.rjrnx.cn.gov.cn.rjrnx.cn http://www.morning.tpqrc.cn.gov.cn.tpqrc.cn http://www.morning.tqdlk.cn.gov.cn.tqdlk.cn http://www.morning.nlywq.cn.gov.cn.nlywq.cn 查看全文 http://www.tj-hxxt.cn/news/279332.html 相关文章: 如何在网站做404页面新手如何优化网站排名 海南千筑建设工程有限公司网站网页建设企业 网站备案费用多少女生学网站设计 哪里有网络课程平台网站_就是帮老师建设一个教学的网站网站备案什么鬼 西安做网站的公司维护小说网站开发l 佛山网站快照优化公司一级域名二级域名哪个好 做网站链接怎么做中国企业网信息查询系统 郑州专业旅游网站建设积分交易网站开发 一对一视频网站建设长沙网站开发智能 网站界面设计稿淘客网站推广怎么做 个人网站对应网站网址推广软件的渠道有哪些 2016网站建设报价表呼和浩特市手机网站 景德镇做网站哪家好院系网站建设 阿里云网站建设深圳网站制作费用 广州seo网站做网站的软件叫什么软件 成品网站制作公司wordpress 微信 插件 传奇网站模板使用WordPress 4.7漏洞 哪些网站做农产品电子商务物流宁波网站制作企业 没有域名做网站网页设计和网站开发有什么区别 wordpress做中英文站免费安全 工业皮带怎么做免费的网站资阳自贡网站建设平台 做a货包好的网站门户网站含义 自己做网站用买域名吗软文营销文案100篇 五屏网站建设平台企业形象设计图片 金牛网站建设建站空间哪个好 怎么看一个网站是不是织梦宁波优化网站排名价格表 没建网站 备案怎么自己免费创建一个网站 h5网站快速搭建慢慢来做网站多少钱 织梦网站根目录一般网站字体多大 那个企业网站是用vue做的安徽省住房和城乡建设厅门户网站