IOS – similar Taobao details page

Some time ago, the company in the development of an electricity supplier project, taking advantage of the time to organize the knowledge. The
project product details page was imitation of Taobao, the third party library is MJRefresh, pull and drop operation operation effect is to refresh the MJRefresh refresh effect from the new classification of packaging it, thanks to my brother!!! The basic idea of
:
1, set up a UIScrollView as the underlying view, and set the paging page two
2, and then in the first page to add a UITableView and set the table to lift the load (pull operation is to scroll the view to the next page)
3, in the second page add a UIScrollView and set can have drop-down refresh operation (drop-down operation for view scroll to the previous page)
4, second page UIScrollView add UIView, general merchandise, graphic details of product parameters, stores,
5, Demo can only provide simple ideas, project implementation is basically the same

IOS - similar Taobao details page
Refresh the MJRefresh / #import / * * package "QRG_MJRefreshAutoFooter.h" #import "QRG_MJRefreshNormalHeader.h" #import "CollectionViewCell.h" #define WIDTH [UIScreen mainScreen].bounds.size.width #define HEIGHT [UIScreen mainScreen].bounds.size.height #define ARCCOLOR (arc4random) (% 255/256.0) #import ViewController.h"

Main code

- (void) viewDidLoad {[super viewDidLoad]; UIScrollView *mainScrollView = [[UIScrollView / * * bottom view*/ alloc] init]; mainScrollView.scrollEnabled = NO; mainScrollView.frame = CGRectMake (0, 0, WIDTH, HEIGHT); mainScrollView.contentSize = CGSizeMake (WIDTH, HEIGHT * 2); mainScrollView.backgroundColor [UIColor = greenColor]; mainScrollView.pagingEnabled = YES; mainScrollView.bounces = YES; [self.view addSubview:mainScrollView]; / * * the first page of the table*/ OneTable alloc] init] = [[UITableView; OneTable.frame = CGRectMake (0,0, WIDTH, HEIGHT - 64); OneTable.separatorColor [UIColor = greenColor]; OneTable.delegate = self; OneTable.dataSource = self; OneTable.rowHeight = 80 [mainScrollView addSubview:OneTable]; scrollView*/ UIScrollView *TwoScrollView; / * * second page alloc] init] = [[UIScrollView; TwoScrollView.frame = CGRectMake (0 + 64, HEIGHT, WIDTH, HEIGHT - 64); TwoScrollView.contentSize = CGSizeMake (WIDTH * 3, HEIGHT - 64 [UIColor); TwoScrollView.backgroundColor = cyanColor]; TwoScrollView.pagingEnabled = YES; TwoScrollView.bounces = NO; [mainScrollView addSubview:TwoScrollView]; / * * page second table*/ TwoTable = [[UITableView alloc] init]; TwoTable.frame = CGRectMake (WIDTH, 0, WIDTH, HEIGHT - 64); TwoTable.separatorColor [UIColor = redColor]; TwoTable.delegate = self; TwoTable.dataSource = self; [TwoScrollView addSubview TwoTable]: UICollectionView*/ UICollectionViewFlowLayout *flow; / * * second page = [[UICollectionViewFlowLayout alloc] init]; [flow setScrollDirection:UICollectionViewScrollDirectionVertical]; UICollectionView *TwoCollectionView = [[UICollectionView alloc] initWithFrame:CGRectMake (0, 0, WIDTH, HEIGHT - 64 collectionViewLayout:flow]); TwoCollectionView.backgroundColor [UIColor = lightTextColor]; TwoCollectionView.delegate = self; TwoCollectionView.dataSource = self; [TwoScrollView addSubview:TwoCollectionView]; / / [TwoCollectionView registerClass:[UICollectionViewCell class] forCellWithReuseIdentifier:@ "Coll"]; [TwoCollectionView registerNib:[UINib nibWithNibName:@ "CollectionViewCell" bundle:ni L] forCellWithReuseIdentifier:@ "Coll"]; / / set UITableView = [QRG_MJRefreshAutoFooter footerWithRefreshingBlock:^{/ / OneTable.mj_footer load pull, execute corresponding operation, changing the bottom scroll view scroll to the corresponding position / [UIView animateWithDuration:0.5 delay:0.0 options:UIViewAnimationOptionLayoutSubviews set animation animations:^{/ / self.scrollV.contentOffset = CGPointMake (0, IPHONE_H); [mainScrollView setContentOffset:CGPointMake (0, HEIGHT);} completion:^ (BOOL finished) {/ / end loading [OneTable.mj_footer endRefreshing];}];}]; / / set the TwoCollectionView drop-down operation TwoCollectionView.mj_h Eader = [QRG_MJRefreshNormalHeader / headerWithRefreshingBlock:^{down to execute corresponding operation / / self.scrollV.contentOffset = CGPointMake (0,0); [UIView animateWithDuration:1 animations:^{[mainScrollView setContentOffset:CGPointMake (0 - 64)];}]; / / end loading [TwoCollectionView.mj_header endRefreshing];}]; / / set TwoTable TwoTable.mj_header = [QRG_MJRefreshNormalHeader headerWithRefreshingBlock:^{/ / pull operation down to execute corresponding operation / / self.scrollV.contentOffset = CGPointMake (0,0) [UIView; animateWithDuration:1 animations:^{[mainScrollView setContentOffset:CGPointMake (0 - 64)}]]; After loading the [TwoTable.mj_header / / endRefreshing];}];}

Pragma mark———Delegate

#pragma mark---------tableDelegate - (CGFloat) tableView: (UITableView * tableView) heightForRowAtIndexPath: (NSIndexPath * indexPath) {CGFloat height; if ([tableView isEqual:OneTable]) {height = 80;}else {return 120}; return height;} - (NSInteger) tableView: (UITableView *) tableView numberOfRowsInSection: (NSInteger section) {return} (- 10; UITableViewCell * (UITableView * tableView) tableView:) cellForRowAtIndexPath: (NSIndexPath * indexPath) {static NSString = *Cell @ *cell = "Cell"; UITableViewCell [tableView dequeueReusableCellWithIdentifier:Cell]; if (! Cell) {cell = [[UITableViewCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:Cell] Cell.textLabel.text [NSString stringWithFormat:@;} = "%ld--askl" indexPath.row]; cell.imageView.image [UIImage imageNamed:@ = "6"]; return cell;} #pragma mark---------CollectionViewDelegate - (NSInteger) collectionView: (UICollectionView *) collectionView numberOfItemsInSection: (NSInteger) section {return 20;} - (CGSize) collectionView: (UICollectionView * collectionView) layout: (UICollectionViewLayout *) collectionViewLayout sizeForItemAtIndexPath: (NSIndexPath * indexPath) {return CGSizeMake (150, 100);} - (UICollectionViewCell *) collectionView: (* UICollectionView) collectionView cellForItemAtIndexPath: (NSIndexPath * indexPath) {static NSString = *Coll @ *cell = "Coll"; CollectionViewCell [collectionView DEQ UeueReusableCellWithReuseIdentifier:Coll forIndexPath:indexPath] / / cell.backgroundColor =[UIColor greenColor]; return; cell;}

Just like it

Pay attention to me

QQ–iOS exchange group: 107548668