当前位置: 首页 > news >正文

伊利网站建设评价WordPress 布局 企业网站

伊利网站建设评价,WordPress 布局 企业网站,备案个人网站做淘宝客,阀门网站设计文章目录 一、获取新闻额外信息二、工具栏按钮的布局三、评论区文字高度四、评论区长评论和短评论的数目显示五、评论区的cell布局问题和评论消息的判断 一、获取新闻额外信息 新闻额外信息的URL需要通过当前新闻的id来获取#xff0c;所以我将所有的新闻放到一个数组中… 文章目录 一、获取新闻额外信息二、工具栏按钮的布局三、评论区文字高度四、评论区长评论和短评论的数目显示五、评论区的cell布局问题和评论消息的判断 一、获取新闻额外信息 新闻额外信息的URL需要通过当前新闻的id来获取所以我将所有的新闻放到一个数组中通过数组的索引来获取指定新闻的id而为了分辨点击cell加载和侧滑加载指定的新闻网页我设置了一个flag值初始值为0当点击时或者侧滑时判断flag值并进行相应的操作。 - (void)GetExtraData {NSInteger index self.mainWebView.mainwebScrollView.contentOffset.x / WIDTH;if (flag 0) {index self.indexValue;flag 1;}NSLog(index %ld, index);self.idStr [self.webAllDataArray[index] id];NSLog(id:%ld,self.idStr);[[ExtraManager sharedSingleton] ExtraGetWithData:^(GetExtraModel * _Nullable extraModel) {dispatch_async(dispatch_get_main_queue(), ^{self.mainWebView.discussLabel.text [NSString stringWithFormat:%ld, extraModel.comments];self.mainWebView.likeLabel.text [NSString stringWithFormat:%ld, extraModel.popularity];self.longComments extraModel.long_comments;self.shortComments extraModel.short_comments;NSLog(额外信息获取成功);});} andError:^(NSError * _Nullable error) {NSLog(额外信息获取失败);} andIdStr:self.idStr]; }二、工具栏按钮的布局 工具栏按钮如果使用UIBarButtonItem类的对象作为属性的话在view层中进行创建和布局后是无法在viewController层中添加协议函数的并且添加的按钮的颜色会被修改为蓝色因此需要使用UIBUtton类的对象作为属性并且将UIBUtton对象作为UIBarButtonItem对象的初始化CustomView //view层NSArray* imageStrArray [NSArray arrayWithObjects:zuosanjiao.png,shuxian.png, pinglun.png, dianzan.png, shoucang.png, fenxiang.png, nil]; self.backButton [UIButton buttonWithType:UIButtonTypeCustom];[self.backButton setImage:[UIImage imageNamed:imageStrArray[0]] forState:UIControlStateNormal];self.backButton.frame CGRectMake(0, 0, 30, 30);UIBarButtonItem* mybackButton [[UIBarButtonItem alloc] initWithCustomView:self.backButton]; self.buttonArray [NSArray arrayWithObjects:mybackButton, self.lineButton, discussButton,discussLabelbutton, btnF, likeButton,likeLabelButton, btnF, collectButton,btnF, shareButton, nil]; //viewController层 [self.mainWebView.backButton addTarget:self action:selector(pressBack) forControlEvents:UIControlEventTouchUpInside]; self.toolbarItems self.mainWebView.buttonArray;三、评论区文字高度 在自定义cell中用Masonry库进行布局时只要不设置Label控件的高度那么Label控件的高度就会和它的文字高度一样。 [self.contentLabel mas_makeConstraints:^(MASConstraintMaker *make) {make.left.equalTo(self.contentView).offset(60);make.top.equalTo(self.authorLabel.mas_bottom).offset(10);make.width.equalTo((WIDTH - 70)); // make.height.equalTo(150);}];四、评论区长评论和短评论的数目显示 在自定义cell中创建并初始化显示评论的Label控件需要注意的就是如果默认tableview的重用机制的话就会导致你的cell上会重复显示评论的数目因此需要改变它的重用机制我是每次都从当前的index path中获取cell这样就会避免cell的重用导致的重复显示问题 DiscussCustomCell* cell [self.discussView.tableview cellForRowAtIndexPath:indexPath];if (cell nil) {cell [[DiscussCustomCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:myDiscussCustomCell];}if (indexPath.section 0 self.longComments ! 0) {if (indexPath.row 0) {cell.commentsNumLabel.text [NSString stringWithFormat:%ld条长评, self.longComments];}//‘’‘ }五、评论区的cell布局问题和评论消息的判断 使用Masonry库进行布局时需要控制cell中每个控件的位置确保当展开全文和收起改变cell的高度时不会让自定义cell上的控件的位置错乱比如评论消息和被回复的评论之间的间距要固定评论消息和名称之间的间距也要固定 [self.commentsNumLabel mas_makeConstraints:^(MASConstraintMaker *make) {make.left.equalTo(self.contentView).offset(10);make.top.equalTo(self.contentView).offset(5);make.width.equalTo(WIDTH);make.height.equalTo(20);}];[self.touxiangImageView mas_makeConstraints:^(MASConstraintMaker *make) {make.left.equalTo(self.contentView).offset(10);make.top.equalTo(self.commentsNumLabel.mas_bottom).offset(10);make.width.equalTo(40);make.height.equalTo(40);}];[self.authorLabel mas_makeConstraints:^(MASConstraintMaker *make) {make.left.equalTo(self.contentView).offset(60);make.top.equalTo(self.commentsNumLabel.mas_bottom).offset(10);make.width.equalTo(200);make.height.equalTo(30);}];[self.contentLabel mas_makeConstraints:^(MASConstraintMaker *make) {make.left.equalTo(self.contentView).offset(60);make.top.equalTo(self.authorLabel.mas_bottom).offset(10);make.width.equalTo((WIDTH - 70)); // make.height.equalTo(150);}];[self.replyLabel mas_makeConstraints:^(MASConstraintMaker *make) {make.left.equalTo(self.contentView).offset(60);make.top.equalTo(self.contentLabel.mas_bottom).offset(10);make.width.equalTo((WIDTH - 70));}];有的评论它是自己发出的有的评论它是回复别人的评论的还有就是有时候回复别人的评论时别人的评论已经被删除的情况因此就需要进行判断。先通过请求数据的数组中的字典元素是否存在来判断是否回复别人的评论再通过字典的author属性是否为NULL判断评论是否已经被删除 if ([self.discussModel.longCommentsArray[indexPath.row] reply_to] ! nil) {NSString *repliedAuthor [self.discussModel.longCommentsArray[indexPath.row] reply_to][author];NSString *repliedContent [self.discussModel.longCommentsArray[indexPath.row] reply_to][content];NSString* repliedText [NSString stringWithFormat://%: %, repliedAuthor, repliedContent];if (repliedAuthor ! NULL) {cell.replyLabel.text repliedText;cell.replyLabel.numberOfLines 2;} else {cell.replyLabel.text 抱歉原点评已经被删除;}}
http://www.w-s-a.com/news/33293/

相关文章:

  • 做网站的去哪找客户正规制作网站公司
  • 网站代理访问是什么意思外国优秀设计网站
  • 合肥个人建站模板网络技术服务有限公司
  • 做网站什么公司好dw企业网站开发教程
  • 怎么做自己的个人网站宝安网站设计哪家最好
  • 浩博建设集团网站站长网站统计
  • 电商网站开发视频seo排名优化方式方法
  • 宿迁市住房城乡建设局网站wordpress纯图片主题
  • 广州建设网站 公司湖北省建设信息网官网
  • 网站建立时间查询做百度移动网站优化排
  • 网站建设和运行费用qq恢复官方网站
  • 可以免费建立网站吗免费的网络营销方式
  • 天津企业设计网站建设wordpress标题字体大小
  • 上高县城乡规划建设局网站创业项目
  • 钓鱼网站在线下载广州网站设计哪里好
  • 做阿里国际网站会有成效吗wordpress微博同步
  • 西安网站建设云速网络网站运营情况怎么写
  • 免费建网站的网站微信商城分销系统方案
  • 烟台网站seo服务友情链接有哪些展现形式
  • 什么是移动网站开发免费网站开发框架
  • 做网站 创业wordpress子菜单
  • 门户网站类型有哪些权重7以上的网站
  • 政务网站建设论文android app开发教程
  • 网站开发实训h5总结个人网站注册平台要多少钱
  • 空白网站建设wordpress高亮代码过长
  • 盐城 网站开发什么叫做门户网站
  • 广东快速做网站公司哪家好本地建wordpress
  • dedecms如何做网站贵阳seo计费管理
  • 企业网站设计一般多少钱呼和浩特最好的互联网公司
  • 黄浦专业做网站海南网站策划