iOS 模仿淘寶的首頁UI

上天眷顧我發表於2016-04-19

要看UICollectionView的可以關了
全程都是tableview加button和autolayout
最近用autolayout真是越來越順手了
Level:菜鳥
環境:Xcode7.3 iOS9.3

效果:


6s.gif


頂部輪播就不弄了。
好用的輪播傳送:
https://github.com/gsdios/SDCycleScrollView
圖片我都是截圖的command+shift+4
主要是學習autolayout

注意的幾個點:
1.任何自定義view都可以用storyboard裡的cell做,只要用到tableview時,都如下取到自定義view,不需要重新自定義xib(主要是使用xib之後,在放回controller裡要設定frame):

- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section
{
    static NSString *cellIdentifier = @"sectionHeadView";
    UITableViewCell *headView =[tableView dequeueReusableCellWithIdentifier:cellIdentifier];
    if(!headView){
        headView=[[UITableViewCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellIdentifier];
    }
    return headView;
}

2.倒數計時
傳送:https://github.com/search?q=倒數計時&type=Repositories&utf8=✓


5s.gif

4s.gif


原始碼:
https://github.com/icharlie2014/PLTaobaoIndex



文/造夢(簡書作者)
原文連結:http://www.jianshu.com/p/6343ac896028
著作權歸作者所有,轉載請聯絡作者獲得授權,並標註“簡書作者”。

相關文章