iOS 常見的商品詳情頁布局

2021-08-18 23:05:59 字數 4532 閱讀 7830

#pragma mark -life cycle

-(void)dealloc

- (void)viewdidload

- (void)initdefault

- (void)initsubview

#pragma mark - network

- (void)refreshdata

//fixme:發起網路請求

- (void)loaddata

#pragma mark -uitableviewdatasource、uitableviewdelegate

-(nsinteger)numberofsectionsintableview:(uitableview *)tableview

-(nsinteger)tableview:(uitableview *)tableview numberofrowsinsection:(nsinteger)section

- (uitableviewcell *)tableview:(uitableview *)tableview cellforrowatindexpath:(nsindexpath *)indexpath

else

[cell hiddentestticketview];

return cell;

}else

if (indexpath.row == 1)

else

return cell;

}else

if (indexpath.row == 2)

else

if (indexpath.row == 3)

else

return cell;

}else

if (indexpath.row == 4)

else

}else

if (indexpath.row == 5)

return cell;

}else

}else

return cell;}}

- (cgfloat)tableview:(uitableview *)tableview heightforrowatindexpath:(nsindexpath *)indexpath

return kgoodsdetailcellheight;

}else

if (indexpath.row == 1)

else

if (indexpath.row == 2)

else

if (indexpath.row == 3)

else

if (indexpath.row == 4)

return kgoodssalescellheight;

}else

if (indexpath.row == 5)

return kgoodsproductcellheight;

}else

}- (void)tableview:(uitableview *)tableview didselectrowatindexpath:(nsindexpath *)indexpath

else

if (indexpath.row == 3)];}

else

if (indexpath.row == 4)

else

}else

if (indexpath.row == 5)}}

#pragma mark - uiscrollviewdelegate

- (void)scrollviewdidenddragging:(uiscrollview *)scrollview willdecelerate:(bool)decelerate

}else

// webview頁面上的滾動}}

#pragma mark - uiwebviewdelegate

- (void)webviewdidfinishload:(uiwebview *)webview

}#pragma mark - uigesturerecognizerdelegate

- (bool)gesturerecognizer:(uigesturerecognizer *)gesturerecognizer shouldreceivetouch:(uitouch *)touch

returnyes;

}#pragma mark - kvo

- (void)addobserver

- (void)removeobserver

- (void)observevalueforkeypath:(nsstring *)keypath ofobject:(id)object change:(nsdictionaryid> *)change context:(void *)context

else

}#pragma mark -event

- (void)change:(uisegmentedcontrol *)sender

else

}#pragma mark - private method

- (void)endrefresh

}// 進入詳情的動畫

- (void)gotodetailanimation

completion:^(bool finished) ];

}// 返回第乙個介面的動畫

- (void)backtofirstpageanimation

completion:^(bool finished) ];

}// 頭部提示文字動畫

- (void)headlabanimation:(cgfloat)offsety

else

}- (void)removefromscreen

if (self.salesview)

if (self.isalertspecificationview)

[self.backview removefromsuperview];

}- (void)removespecificationview

}[self.backview removefromsuperview];

}// 選擇引數後,重新整理商品的名稱**

- (void)freshgoodsdetail

- (void)showgoodsproductview

- (void)showgoodssalesdetailview

- (void)showgoodsspecificationview

#pragma mark - getter and setter

- (uitableview *)goodstable

return _goodstable;

}-(sngoodsheaderview *)headerview

return _headerview;

}- (uiwebview *)detailwebview

return _detailwebview;

}- (uilabel *)webviewheadview

return _webviewheadview;

}- (uisegmentedcontrol *)segmentedview

forstate:uicontrolstateselected];

[_segmentedview settitletextattributes:@ forstate:uicontrolstatenormal];

}return _segmentedview;

}- (uibutton *)orderactionbutton

return _orderactionbutton;

}-(sngoodsproductview *)productview;}

return _productview;

}-(sngoodssalesdetailview *)salesview;}

return _salesview;

}-(sngoodsspecificationview *)specificationview

;_specificationview.specorderblock = ^;

}return _specificationview;

}-(uiview *)backview

return _backview;

}- (nsmutablearray *)datasource

return _datasource;

}- (nsmutablearray *)specificationarray

return _specificationarray;

}-(nsmutablearray *)productarray

return _productarray;

}-(nsmutablearray *)specificationcodearray

return _specificationcodearray;

}-(nsmutablearray *)salelistarray

return _salelistarray;

}@end

3 3 商品詳情頁

1 對應的goodsdao中的核心 為 select select g.mg.stock count,mg.miaosha price,mg.start date,mg.end date from miaosha goods mg left join goods g on mg.goods id g...

商品詳情頁上拉檢視詳情

目錄介紹2.1 使用slidelayout效果 2.2 使用slideanimlayout帶有載入動畫效果3.1 第一種,直接上拉載入分頁 slidelayout有兩個子childview 3.2 第一種,上拉加載有動畫效果,然後展示分頁 slideanimlayout有三個子childview o...

商品詳情頁的子路由

首頁的子元件shopslistitem.vue中 showdetail id detail.vue的mounted中就儲存this.id this.router.query.id傳遞給tabcontrol子元件 id id tabcontrol中 click changetab changetab ...