中文亚洲精品无码_熟女乱子伦免费_人人超碰人人爱国产_亚洲熟妇女综合网

當(dāng)前位置: 首頁 > news >正文

泉州網(wǎng)頁搜索排名提升杭州網(wǎng)站建設(shè)方案優(yōu)化

泉州網(wǎng)頁搜索排名提升,杭州網(wǎng)站建設(shè)方案優(yōu)化,高端網(wǎng)站建設(shè)推廣,做外貿(mào)出口衣服的網(wǎng)站文章目錄 一、獲取新聞額外信息二、工具欄按鈕的布局三、評論區(qū)文字高度四、評論區(qū)長評論和短評論的數(shù)目顯示五、評論區(qū)的cell布局問題和評論消息的判斷 一、獲取新聞額外信息 新聞額外信息的URL需要通過當(dāng)前新聞的id來獲取,所以我將所有的新聞放到一個數(shù)組中&…

文章目錄

  • 一、獲取新聞額外信息
  • 二、工具欄按鈕的布局
  • 三、評論區(qū)文字高度
  • 四、評論區(qū)長評論和短評論的數(shù)目顯示
  • 五、評論區(qū)的cell布局問題和評論消息的判斷


一、獲取新聞額外信息

新聞額外信息的URL需要通過當(dāng)前新聞的id來獲取,所以我將所有的新聞放到一個數(shù)組中,通過數(shù)組的索引來獲取指定新聞的id,而為了分辨點擊cell加載和側(cè)滑加載指定的新聞網(wǎng)頁,我設(shè)置了一個flag值(初始值為0),當(dāng)點擊時或者側(cè)滑時判斷flag值并進行相應(yīng)的操作。

- (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];
}

請?zhí)砑訄D片描述

二、工具欄按鈕的布局

工具欄按鈕如果使用UIBarButtonItem類的對象作為屬性的話,在view層中進行創(chuàng)建和布局后是無法在viewController層中添加協(xié)議函數(shù)的,并且添加的按鈕的顏色會被修改為藍色,因此需要使用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;

三、評論區(qū)文字高度

在自定義cell中用Masonry庫進行布局時只要不設(shè)置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);}];

四、評論區(qū)長評論和短評論的數(shù)目顯示

在自定義cell中創(chuàng)建并初始化顯示評論的Label控件,需要注意的就是如果默認tableview的重用機制的話就會導(dǎo)致你的cell上會重復(fù)顯示評論的數(shù)目,因此需要改變它的重用機制,我是每次都從當(dāng)前的index path中獲取cell,這樣就會避免cell的重用導(dǎo)致的重復(fù)顯示問題

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];}//‘’‘
}

請?zhí)砑訄D片描述
請?zhí)砑訄D片描述

五、評論區(qū)的cell布局問題和評論消息的判斷

使用Masonry庫進行布局時,需要控制cell中每個控件的位置,確保當(dāng)展開全文和收起改變cell的高度時不會讓自定義cell上的控件的位置錯亂,比如評論消息和被回復(fù)的評論之間的間距要固定,評論消息和名稱之間的間距也要固定

[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));}];

有的評論它是自己發(fā)出的,有的評論它是回復(fù)別人的評論的,還有就是有時候回復(fù)別人的評論時,別人的評論已經(jīng)被刪除的情況,因此就需要進行判斷。先通過請求數(shù)據(jù)的數(shù)組中的字典元素是否存在來判斷是否回復(fù)別人的評論,再通過字典的author屬性是否為NULL判斷,評論是否已經(jīng)被刪除

 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 = @"抱歉,原點評已經(jīng)被刪除";}}

請?zhí)砑訄D片描述


http://www.risenshineclean.com/news/51645.html

相關(guān)文章:

  • 賓館的網(wǎng)站回款如何做分錄群排名優(yōu)化軟件
  • 德陽seo網(wǎng)站建設(shè)重慶seo
  • wordpress給用戶發(fā)送郵件googleseo推廣
  • 無錫大型網(wǎng)站建設(shè)公司seo排名優(yōu)化軟件有
  • 普通銀行卡可以做國外網(wǎng)站購物信用卡使用嗎哈爾濱seo網(wǎng)絡(luò)推廣
  • 中企動力 35 做網(wǎng)站站長工具綜合權(quán)重查詢
  • 武漢城市建設(shè)招標(biāo)網(wǎng)站seo的關(guān)鍵詞無需
  • 網(wǎng)站專業(yè)建設(shè)公司抖音搜索優(yōu)化
  • 做照片軟件seo博客寫作
  • wordpress靜態(tài)生成西安優(yōu)化外
  • 做視頻的素材什么網(wǎng)站好網(wǎng)絡(luò)推廣的話術(shù)怎么說
  • 北京市房山區(qū)住房和城鄉(xiāng)建設(shè)委員會網(wǎng)站網(wǎng)推公司
  • 免費海報在線制作網(wǎng)站百度客戶管理系統(tǒng)登錄
  • 廣東官網(wǎng)網(wǎng)站建設(shè)哪家好二十個優(yōu)化
  • 北京P2P公司網(wǎng)站建設(shè)無代碼網(wǎng)站開發(fā)平臺
  • 模塊建站平臺專業(yè)的推廣公司
  • b站視頻播放量網(wǎng)站長沙快速排名優(yōu)化
  • 如何查看網(wǎng)站是哪家公司做的百度2022第三季度財報
  • 攝影網(wǎng)站設(shè)計圖片網(wǎng)絡(luò)營銷服務(wù)的特點
  • 做網(wǎng)上兼職的網(wǎng)站優(yōu)秀營銷軟文范例800字
  • 怎樣建設(shè)一個購物網(wǎng)站廣州疫情升級
  • 昆明網(wǎng)站建設(shè)加q.479185700松原市新聞
  • designer怎么做網(wǎng)站四川網(wǎng)站seo
  • 學(xué)校網(wǎng)站建設(shè)企業(yè)接推廣怎么收費
  • 廈門中小企業(yè)網(wǎng)站制作網(wǎng)絡(luò)媒體發(fā)稿平臺
  • 做圖片網(wǎng)站 服務(wù)器蘇州網(wǎng)站制作開發(fā)公司
  • 河南洛陽網(wǎng)站建設(shè)seo工具下載
  • 企業(yè)網(wǎng)站建設(shè)費現(xiàn)金流科目seo公司官網(wǎng)
  • 中國最大的新聞網(wǎng)站合肥seo推廣排名
  • bc源碼 網(wǎng)站 搭建創(chuàng)意營銷點子