iOS 滚动视图清楚解释

vvvvvvvvvvvvvvm


#import "ViewController.h"

#import "TiaoZhuanViewController.h"

@interface ViewController ()<UITableViewDelegate,UITableViewDataSource>

@property(nonatomic,strong)UISearchBar * search;

@property(nonatomic,strong)UITableView * tbv;

@property(nonatomic,strong)UIScrollView * scroll;

@end

@implementation ViewController

//懒加载表格

-(UITableView *)tbv{

    if(!_tbv){

        _tbv=[[UITableView alloc]initWithFrame:CGRectMake(0, 200, self.view.frame.size.width, self.view.frame.size.height-200) style:UITableViewStylePlain];


        _tbv.delegate=self;

        _tbv.dataSource=self;

    }

    return _tbv;

}

//懒加载滚动视图

-(UIScrollView *)scroll{

    if(!_scroll){

        _scroll=[[UIScrollView alloc]initWithFrame:CGRectMake(0, 0, self.view.frame.size.width, 200)];


        _scroll.contentSize = CGSizeMake(self.view.frame.size.width *3, 0);


        _scroll.bounces=YES;


        _scroll.pagingEnabled =YES;


        _scroll.showsHorizontalScrollIndicator = NO;


        NSArray * arr =@[@"300-1.jpeg",@"6.jpeg",@"300-3.jpeg"];


        for(inti =0; i<3; i++) {

            UIImageView * imgv=[[UIImageView alloc]initWithFrame:CGRectMake(self.view.frame.size.width*i, 0, self.view.frame.size.width, 200)];


            imgv.image=[UIImageimageNamed:arr[i]];


            [_scrolladdSubview:imgv];

        }

    }

    return _scroll;

}

//初始化UI控件

-(void)initUI{

    //初始化搜索框

    self.search =[[UISearchBar alloc]initWithFrame:CGRectMake(30, 40, self.view.frame.size.width-60, 30)];


    self.search.placeholder = @"宋MAX |奔驰GLE| 克莱斯勒";


    self.search.barStyle=0;


    self.search.backgroundColor = [UIColor clearColor];


    self.search.backgroundImage = [UIImage new];


    [self.viewaddSubview:self.search];



    UIImageView* oneImgv=[[UIImageViewalloc]initWithFrame:CGRectMake(2,40,25,25)];


    oneImgv.image=[UIImageimageNamed:@"绿巨人.jpg"];


    [self.viewaddSubview:oneImgv];



    UIImageView * TwoImgv=[[UIImageView alloc]initWithFrame:CGRectMake(self.view.frame.size.width-32, 40, 25, 25)];


    TwoImgv.image=[UIImageimageNamed:@"方块+.png"];


    [self.viewaddSubview:TwoImgv];


}

- (void)viewDidLoad {

    [super viewDidLoad];

   //隐藏导航栏

    self.navigationController.navigationBar.hidden = YES;


    //设置背景颜色为白色

    self.view.backgroundColor =[UIColor whiteColor];


    //添加表格

    [self.viewaddSubview:self.tbv];


    //添加滚动视图

    [self.viewaddSubview:self.scroll];


    //执行初始化控件

    [selfinitUI];

}

//实现表格的数据源和代理

-(NSInteger)tableView:(UITableView*)tableView numberOfRowsInSection:(NSInteger)section{

    return 5;

}

-(UITableViewCell*)tableView:(UITableView*)tableView cellForRowAtIndexPath:(NSIndexPath*)indexPath{

    staticNSString* identifier =@"MyCell";


    UITableViewCell* cell =[tableViewdequeueReusableCellWithIdentifier:identifier];


    if(!cell){

        cell =[[UITableViewCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:identifier];

    }


    if(indexPath.row==0){

        UILabel* label =[[UILabelalloc]initWithFrame:CGRectMake(10,10,self.view.frame.size.width-100,30)];


        label.text=@"比亚迪春季新品发布会";


        [celladdSubview:label];


        UIImageView * imgv =[[UIImageView alloc]initWithFrame:CGRectMake(self.view.frame.size.width-130, 5, 100, 40)];


        imgv.image=[UIImageimageNamed:@"1200.png"];


        [celladdSubview:imgv];

    }

    elseif(indexPath.row==1){

        NSArray * arr =@[@"西红柿.png",@"小树苗.png",@"蘑菇.png",@"青椒辣椒.png",@"蔬菜大蒜.png"];

        NSArray * arrTitle=@[@"新车特卖",@"汽车点评",@"七步买车",@"特惠直降",@"0息购车"];


        NSArray * TwoArr =@[@"蔬菜胡萝卜.png",@"白菜花.png",@"红青椒.png",@"黄生菜.png",@"老玉米.png"];

        NSArray * TwoArrTitle =@[@"汽车口碑",@"查违章",@"成交价曝光",@"车型对比",@"二手车产品"];



        for(inti =0; i<5; i++) {

            UIButton* btn =[[UIButtonalloc]initWithFrame:CGRectMake(((self.view.frame.size.width-60*5)/6)*i +60*i +(self.view.frame.size.width-60*5)/12,0,60,60)];

            [btnsetImage:[UIImage imageNamed:arr[i]] forState:UIControlStateNormal];


            [btnaddTarget:self action:@selector(Click:) forControlEvents:UIControlEventTouchUpInside];

            [btnsetTag:100+i];

            [celladdSubview:btn];

        }


        for(inti =0; i<5; i++) {

            UILabel* label =[[UILabelalloc]initWithFrame:CGRectMake(((self.view.frame.size.width-60*5)/6)*i +60*i +(self.view.frame.size.width-60*5)/12,60,70,40)];


            label.text= arrTitle[i];


            [celladdSubview:label];

        }






        for(inti =0; i<5; i++) {

            UIButton* Twobtn =[[UIButtonalloc]initWithFrame:CGRectMake(((self.view.frame.size.width-60*5)/6)*i +60*i +(self.view.frame.size.width-60*5)/12,100,60,60)];


            [TwobtnsetImage:[UIImage imageNamed:TwoArr[i]] forState:UIControlStateNormal];



            [celladdSubview:Twobtn];


        }


        for(inti =0; i<5; i++) {

            UILabel* Twolabel =[[UILabelalloc]initWithFrame:CGRectMake(((self.view.frame.size.width-60*5)/6)*i +60*i +(self.view.frame.size.width-60*5)/12,160,70,40)];


            Twolabel.text= arrTitle[i];


            [celladdSubview:Twolabel];

        }



    }

    elseif(indexPath.row==2){

        UIScrollView * scr=[[UIScrollView alloc]initWithFrame:CGRectMake(0, 0, self.view.frame.size.width, 50)];


        scr.contentSize = CGSizeMake(self.view.frame.size.width *2, 0);


        scr.bounces=NO;


        scr.pagingEnabled=NO;


        scr.showsHorizontalScrollIndicator = NO;

        NSArray * arr =@[@"关注",@"推荐",@"原创",@"车价号",@"小视频",@"世界赛",@"美食",@"模式",@"商家码",@"安生"];


        for(inti=0; i<10; i++) {

            UILabel* label=[[UILabelalloc]initWithFrame:CGRectMake((self.view.frame.size.width*2-60*10)/11*i +60* i ,0,60,50)];


            label.text= arr[i];


            label.textColor=[UIColorredColor];


            [scraddSubview:label];

        }

        [celladdSubview:scr];

    }

    elseif(indexPath.row==3){

        UILabel* label =[[UILabelalloc]initWithFrame:CGRectMake(10,0,self.view.frame.size.width-20,50)];


        label.text = @"汽车之家2018年海外品牌进口车质量报告";


        [celladdSubview:label];

    }

    elseif(indexPath.row==4){

        UIImageView * one =[[UIImageView alloc]initWithFrame:CGRectMake(0, 0, self.view.frame.size.width/3-1, 150)];


        one.image=[UIImageimageNamed:@"4.jpeg"];


        [celladdSubview:one];




        UIImageView * two =[[UIImageView alloc]initWithFrame:CGRectMake(self.view.frame.size.width/3, 0, self.view.frame.size.width/3-1, 150)];


        two.image=[UIImageimageNamed:@"300-5.jpeg"];


        [celladdSubview:two];




        UIImageView * three =[[UIImageView alloc]initWithFrame:CGRectMake(self.view.frame.size.width/3*2, 0, self.view.frame.size.width/3-1, 150)];


        three.image=[UIImageimageNamed:@"300-2.jpeg"];


        [celladdSubview:three];



    }


    returncell;

}

-(CGFloat)tableView:(UITableView*)tableView heightForRowAtIndexPath:(NSIndexPath*)indexPath{

    if(indexPath.row==0)

    {

        return50;

    }

    elseif(indexPath.row==1){

        return200;

    }

    elseif(indexPath.row==2){

        return50;

    }

    elseif(indexPath.row==3){

        return50;

    }

    elseif(indexPath.row==4){

        return150;

    }

    return 0;

}

//实现点击方法

-(void)Click:(UIButton*)button{

    NSUIntegerbtnTag =[buttontag];


    if(btnTag ==100){

        NSLog(@"wo");


        UINavigationController * nav =[[UINavigationController alloc]initWithRootViewController:[TiaoZhuanViewController new]];


        [self presentViewController:nav animated:NO completion:nil];

    }

}

@end



-090878676543=012887678956789865676776890787

tiaommmmmmmmmmmmmmmmmm


#import "TiaoZhuanViewController.h"

@interface TiaoZhuanViewController ()<UITableViewDelegate,UITableViewDataSource>

@property(nonatomic,strong)UITableView * tbv;

@property(nonatomic,strong)UIScrollView * scroll;

@property(nonatomic,strong)UISearchBar * search;

@end

@implementationTiaoZhuanViewController

//懒加载表格

-(UITableView *)tbv{

    if(!_tbv){

        _tbv=[[UITableView alloc]initWithFrame:CGRectMake(0, 200, self.view.frame.size.width, self.view.frame.size.height-200) style:UITableViewStylePlain];


        _tbv.delegate=self;

        _tbv.dataSource=self;

    }

    return _tbv;

}

//懒加载滚动视图

-(UIScrollView *)scroll{

    if(!_scroll){

        _scroll=[[UIScrollView alloc]initWithFrame:CGRectMake(0, 0, self.view.frame.size.width, 200)];


        _scroll.contentSize = CGSizeMake(self.view.frame.size.width *3, 0);


        _scroll.bounces=YES;


        _scroll.pagingEnabled =YES;


        _scroll.showsHorizontalScrollIndicator = NO;


        NSArray * arr =@[@"19.jpg",@"9.jpeg",@"8.jpeg"];


        for(inti =0; i<3; i++) {

            UIImageView * imgv=[[UIImageView alloc]initWithFrame:CGRectMake(self.view.frame.size.width*i, 0, self.view.frame.size.width, 200)];


            imgv.image=[UIImageimageNamed:arr[i]];


            [_scrolladdSubview:imgv];

        }

    }

    return _scroll;

}

//初始化UI控件

-(void)initUI{

    //初始化搜索框

    self.search =[[UISearchBar alloc]initWithFrame:CGRectMake(30, 5, self.view.frame.size.width-60, 30)];


    self.search.placeholder = @"输入品牌、车系、店铺试试";


    self.search.barStyle=0;


    self.search.backgroundColor = [UIColor clearColor];


    self.search.backgroundImage = [UIImage new];


    [self.viewaddSubview:self.search];



    UIImageView * TwoImgv=[[UIImageView alloc]initWithFrame:CGRectMake(self.view.frame.size.width-32, 5, 25, 25)];


    TwoImgv.image=[UIImageimageNamed:@"方块+.png"];


    [self.viewaddSubview:TwoImgv];


}

- (void)viewDidLoad {

    [super viewDidLoad];

    self.view.backgroundColor =[UIColor whiteColor];


    self.navigationController.navigationBar.translucent = NO;


    self.navigationItem.title=@"【车商城】汽车之家";


    self.navigationItem.leftBarButtonItem =[[UIBarButtonItem alloc]initWithTitle:@"返回" style:UIBarButtonItemStyleDone target:self action:@selector(Fanhui)];


    //添加表格

    [self.viewaddSubview:self.tbv];


    //添加滚动视图

    [self.viewaddSubview:self.scroll];



    [selfinitUI];


}

//实现表格的数据源和代理

-(NSInteger)tableView:(UITableView*)tableView numberOfRowsInSection:(NSInteger)section{

    return 6;

}

-(UITableViewCell*)tableView:(UITableView*)tableView cellForRowAtIndexPath:(NSIndexPath*)indexPath{

    staticNSString* identifier =@"Cell";


    UITableViewCell* cell =[tableViewdequeueReusableCellWithIdentifier:identifier];


    if(!cell){

        cell =[[UITableViewCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:identifier];

    }

    if(indexPath.row==0){

        NSArray * arr =@[@"西红柿.png",@"小树苗.png",@"蘑菇.png",@"青椒辣椒.png",@"蔬菜大蒜.png"];

        NSArray * arrTitle=@[@"厂商直销",@"之家严选",@"新能源",@"新手社区",@"优惠购车"];



        for(inti =0; i<5; i++) {

            UIButton* btn =[[UIButtonalloc]initWithFrame:CGRectMake(((self.view.frame.size.width-60*5)/6)*i +60*i +(self.view.frame.size.width-60*5)/12,0,60,60)];


            [btnsetImage:[UIImage imageNamed:arr[i]] forState:UIControlStateNormal];


            [celladdSubview:btn];


        }


        for(inti =0; i<5; i++) {

            UILabel* label =[[UILabelalloc]initWithFrame:CGRectMake(((self.view.frame.size.width-60*5)/6)*i +60*i +(self.view.frame.size.width-60*5)/12,60,70,40)];


            label.text= arrTitle[i];


            [celladdSubview:label];

        }

    }

    elseif(indexPath.row==1){

        UILabel* label =[[UILabelalloc]initWithFrame:CGRectMake(10,0,self.view.frame.size.width-20,50)];


        label.text=@"购车快选";


        label.font=[UIFontsystemFontOfSize:25];


        [celladdSubview:label];



        UILabel* onelabel =[[UILabelalloc]initWithFrame:CGRectMake(self.view.frame.size.width-40,0,40,50)];


        onelabel.text=@"换一换";


        onelabel.textColor=[UIColorgrayColor];


        onelabel.font=[UIFontsystemFontOfSize:12];


        [celladdSubview:onelabel];

    }

    elseif(indexPath.row==2){


        NSArray * arrTitle=@[@"品牌",@"别克",@"奇瑞",@"马自达",@"名爵"];


        NSArray * oneTitle=@[@"入门代步",@"想买SUV",@"7座大空间",@"家用座驾",@"名爵"];

        for(inti =0; i<5; i++) {

            UILabel* label =[[UILabelalloc]initWithFrame:CGRectMake(((self.view.frame.size.width-60*5)/6)*i +60*i +(self.view.frame.size.width-60*5)/12,0,70,25)];


            label.text= arrTitle[i];


            [celladdSubview:label];

        }





        for(inti =0; i<5; i++) {

            UILabel* onelabel =[[UILabelalloc]initWithFrame:CGRectMake(((self.view.frame.size.width-60*5)/6)*i +60*i +(self.view.frame.size.width-60*5)/12,30,70,25)];


            onelabel.text= oneTitle[i];


            [celladdSubview:onelabel];

        }

    }

    elseif(indexPath.row==3){

        UIButton* btn =[[UIButtonalloc]initWithFrame:CGRectMake((self.view.frame.size.width-100)/2,5,100,50)];


        [btnsetTitle:@"选车顾问" forState:UIControlStateNormal];


        [btnsetTitleColor:[UIColor grayColor] forState:UIControlStateNormal];


        [celladdSubview:btn];

    }

    elseif(indexPath.row==4){

        UILabel* label =[[UILabelalloc]initWithFrame:CGRectMake(10,5,self.view.frame.size.width-20,50)];


        label.text=@"汽车严选之家";


        label.font=[UIFontsystemFontOfSize:25];


        [celladdSubview:label];

    }

    elseif(indexPath.row==5){

        NSArray * oneTitle=@[@"热销车",@"带首付",@"低利率",@"低月供",@"名爵"];

        for(inti =0; i<4; i++) {

            UILabel* onelabel =[[UILabelalloc]initWithFrame:CGRectMake(((self.view.frame.size.width-60*4)/5)*i +60*i +(self.view.frame.size.width-60*4)/10,5,70,50)];


            onelabel.text= oneTitle[i];


            onelabel.textColor=[UIColorredColor];


            [celladdSubview:onelabel];

        }

    }





    returncell;

}

//点击返回的方法

-(void)Fanhui{

    [self dismissViewControllerAnimated:NO completion:nil];

}

-(CGFloat)tableView:(UITableView*)tableView heightForRowAtIndexPath:(NSIndexPath*)indexPath{

    if(indexPath.row==0){

        return100;

    }

    else{

        return  60;

    }

}

@end

87897878326763274632784623784623784678234


appppppppppppph

#import

#import

@interface AppDelegate : UIResponder <UIApplicationDelegate>

@property (strong, nonatomic) UIWindow *window;

@property(readonly,strong)NSPersistentContainer*persistentContainer;

- (void)saveContext;

@end

7867821678362781637812687367123

apppppppppm


#import "AppDelegate.h"

#import "ViewController.h"

#import "LunTanViewController.h"

#import "XinCheViewController.h"

#import "ErShouCheViewController.h"

#import "WoViewController.h"

@interface AppDelegate ()

@end

@implementation AppDelegate

- (BOOL)application:(UIApplication*)application didFinishLaunchingWithOptions:(NSDictionary*)launchOptions {

    //包装首页的底部控制器

    UINavigationController* ShouYeNav =[[UINavigationController alloc]initWithRootViewController:[ViewController new]];


    ShouYeNav.tabBarItem =[[UITabBarItem alloc]initWithTitle:@"首页" image:[UIImage imageNamed:@"喜欢灰"] selectedImage:[UIImage imageNamed:@"喜欢蓝"]];




    //包装论坛的底部控制器

    UINavigationController * LunTanNav =[[UINavigationController alloc]initWithRootViewController:[LunTanViewController new]];


    LunTanNav.tabBarItem =[[UITabBarItem alloc]initWithTitle:@"论坛" image:[UIImage imageNamed:@"收藏灰"] selectedImage:[UIImage imageNamed:@"收藏蓝"]];




    //包装新车的底部控制器

    UINavigationController* XinCheNav =[[UINavigationController alloc]initWithRootViewController:[XinCheViewController new]];


    XinCheNav.tabBarItem =[[UITabBarItem alloc]initWithTitle:@"新车" image:[UIImage imageNamed:@"消息灰"] selectedImage:[UIImage imageNamed:@"消息蓝"]];




    //包装二手车的底部控制器

    UINavigationController* ErShouCheNav =[[UINavigationController alloc]initWithRootViewController:[ErShouCheViewController new]];


    ErShouCheNav.tabBarItem=[[UITabBarItemalloc]initWithTitle:@"二手车"image:[UIImageimageNamed:@"密码 (2).png"]selectedImage:[UIImageimageNamed:@"密码 (1).png"]];




    //包装我的底部控制器

    UINavigationController* WoNav =[[UINavigationController alloc]initWithRootViewController:[WoViewController new]];


    WoNav.tabBarItem =[[UITabBarItem alloc]initWithTitle:@"我" image:[UIImage imageNamed:@"我的灰"] selectedImage:[UIImage imageNamed:@"我的蓝"]];



lunmmmmmmmmmmmmh


#import "LunTanViewController.h"

@interface LunTanViewController ()<UITableViewDelegate,UITableViewDataSource>

@property(nonatomic,strong)UISearchBar * search;

@property(nonatomic,strong)UITableView * tbv;

@end

@implementationLunTanViewController

//懒加载表格

-(UITableView *)tbv{

    if(!_tbv){

        _tbv=[[UITableView alloc]initWithFrame:self.view.frame style:UITableViewStylePlain];


        _tbv.delegate=self;

        _tbv.dataSource=self;

    }

    return _tbv;

}

//初始化UI控件

-(void)initUI{

    //初始化搜索框

    self.search =[[UISearchBar alloc]initWithFrame:CGRectMake(30, 40, self.view.frame.size.width-60, 30)];


    self.search.placeholder = @"车友圈  Young  视频社区";


    self.search.barStyle=0;


    self.search.backgroundColor = [UIColor clearColor];


    self.search.backgroundImage = [UIImage new];


    self.navigationItem.titleView = self.search;





    UILabel* label =[[UILabelalloc]initWithFrame:CGRectMake(2,0,25,25)];


    label.text=@"论坛";


    self.navigationItem.leftBarButtonItem=[[UIBarButtonItem alloc]initWithCustomView:label];



    UIImageView * TwoImgv=[[UIImageView alloc]initWithFrame:CGRectMake(self.view.frame.size.width-32, 40, 25, 25)];


    TwoImgv.image=[UIImageimageNamed:@"方块+.png"];


    self.navigationItem.rightBarButtonItem =[[UIBarButtonItem alloc]initWithCustomView:TwoImgv];


}

- (void)viewDidLoad {

    [super viewDidLoad];

    self.view.backgroundColor =[UIColor whiteColor];


    self.navigationController.navigationBar.translucent =NO;


    [selfinitUI];


    [self.viewaddSubview:self.tbv];

}

//实现表格的代理和数据源

-(NSInteger)tableView:(UITableView*)tableView numberOfRowsInSection:(NSInteger)section{

    return 6;

}

-(UITableViewCell*)tableView:(UITableView*)tableView cellForRowAtIndexPath:(NSIndexPath*)indexPath{

    staticNSString* identifier =@"QCell";


    UITableViewCell* cell =[tableViewdequeueReusableCellWithIdentifier:identifier];


    if(!cell){

        cell =[[UITableViewCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:identifier];

    }


    if(indexPath.row==0){

        NSArray * arr =@[@"西红柿.png",@"小树苗.png",@"蘑菇.png",@"青椒辣椒.png",@"蔬菜大蒜.png"];

        NSArray * arrTitle=@[@"全部论坛",@"宋MAX",@"居家论坛",@"宝马3撕裂",@"躺新能"];



        for(inti =0; i<5; i++) {

            UIButton* btn =[[UIButtonalloc]initWithFrame:CGRectMake(((self.view.frame.size.width-60*5)/6)*i +60*i +(self.view.frame.size.width-60*5)/12,0,50,60)];


            [btnsetImage:[UIImage imageNamed:arr[i]] forState:UIControlStateNormal];



            [btnsetTag:100+i];


            [celladdSubview:btn];


        }


        for(inti =0; i<5; i++) {

            UILabel* label =[[UILabelalloc]initWithFrame:CGRectMake(((self.view.frame.size.width-60*5)/6)*i +60*i +(self.view.frame.size.width-60*5)/12,50,70,30)];


            label.text= arrTitle[i];


            [celladdSubview:label];

        }

    }

    elseif(indexPath.row==1){

        UIImageView *imgv =[[UIImageView alloc]initWithFrame:CGRectMake(0, 0, self.view.frame.size.width, 80)];


        imgv.image=[UIImageimageNamed:@"06.jpg"];


        [celladdSubview:imgv];

    }

    elseif(indexPath.row==2){

        UILabel* label =[[UILabelalloc]initWithFrame:CGRectMake(10,0,self.view.frame.size.width-20,50)];


        label.text=@"车主秀";


        label.font=[UIFontsystemFontOfSize:25];


        [celladdSubview:label];



        UILabel* onelabel =[[UILabelalloc]initWithFrame:CGRectMake(self.view.frame.size.width-40,0,40,50)];


        onelabel.text=@"更多->";


        onelabel.textColor=[UIColorgrayColor];


        onelabel.font=[UIFontsystemFontOfSize:12];


        [celladdSubview:onelabel];

    }

    elseif(indexPath.row==3){

        UIImageView * one =[[UIImageView alloc]initWithFrame:CGRectMake(0, 0, self.view.frame.size.width/3-1, 150)];


        one.image=[UIImageimageNamed:@"1.jpeg"];


        [celladdSubview:one];




        UIImageView * two =[[UIImageView alloc]initWithFrame:CGRectMake(self.view.frame.size.width/3, 0, self.view.frame.size.width/3-1, 150)];


        two.image=[UIImageimageNamed:@"300.jpeg"];


        [celladdSubview:two];




        UIImageView * three =[[UIImageView alloc]initWithFrame:CGRectMake(self.view.frame.size.width/3*2, 0, self.view.frame.size.width/3-1, 150)];


        three.image=[UIImageimageNamed:@"300-4.jpeg"];


        [celladdSubview:three];



    }

    elseif(indexPath.row==4){

        UILabel* label =[[UILabelalloc]initWithFrame:CGRectMake(10,0,self.view.frame.size.width-20,50)];


        label.text=@"热门主题";


        label.font=[UIFontsystemFontOfSize:25];


        [celladdSubview:label];



        UILabel* onelabel =[[UILabelalloc]initWithFrame:CGRectMake(self.view.frame.size.width-40,0,40,50)];


        onelabel.text=@"更多->";


        onelabel.textColor=[UIColorgrayColor];


        onelabel.font=[UIFontsystemFontOfSize:12];


        [celladdSubview:onelabel];

    }

    elseif(indexPath.row==5){

        NSArray * oneTitle=@[@"#媳妇当车模",@"#没人生活秀",@"#论坛热帖"];

        for(inti =0; i<3; i++) {

            UILabel* onelabel =[[UILabelalloc]initWithFrame:CGRectMake(((self.view.frame.size.width-100*3)/4)*i +100*i +(self.view.frame.size.width-100*3)/8,5,100,30)];


            onelabel.text= oneTitle[i];


            onelabel.backgroundColor=[UIColorredColor];


            onelabel.textColor=[UIColorwhiteColor];


            [celladdSubview:onelabel];

        }




        NSArray * Title=@[@"#媳妇当车模",@"#没人生活秀",@"#论坛热帖"];

        for(inti =0; i<3; i++) {

            UILabel* onelabel =[[UILabelalloc]initWithFrame:CGRectMake(((self.view.frame.size.width-100*3)/4)*i +100*i +(self.view.frame.size.width-100*3)/8,110,100,30)];


            onelabel.text= Title[i];


            onelabel.backgroundColor=[UIColororangeColor];


            onelabel.textColor=[UIColorwhiteColor];


            [celladdSubview:onelabel];

        }

    }



    returncell;

}

-(CGFloat)tableView:(UITableView*)tableView heightForRowAtIndexPath:(NSIndexPath*)indexPath{

    if(indexPath.row==0)

    {

        return90;

    }

    elseif(indexPath.row==1){

        return80;

    }

    elseif(indexPath.row==2){

        return50;

    }

    elseif(indexPath.row==3){

        return150;

    }

    elseif(indexPath.row==4){

        return50;

    }

    elseif(indexPath.row==5){

        return150;

    }

    return 0;

}

@end

©著作权归作者所有,转载或内容合作请联系作者
  • 序言:七十年代末,一起剥皮案震惊了整个滨河市,随后出现的几起案子,更是在滨河造成了极大的恐慌,老刑警刘岩,带你破解...
    沈念sama阅读 205,386评论 6 479
  • 序言:滨河连续发生了三起死亡事件,死亡现场离奇诡异,居然都是意外死亡,警方通过查阅死者的电脑和手机,发现死者居然都...
    沈念sama阅读 87,939评论 2 381
  • 文/潘晓璐 我一进店门,熙熙楼的掌柜王于贵愁眉苦脸地迎上来,“玉大人,你说我怎么就摊上这事。” “怎么了?”我有些...
    开封第一讲书人阅读 151,851评论 0 341
  • 文/不坏的土叔 我叫张陵,是天一观的道长。 经常有香客问我,道长,这世上最难降的妖魔是什么? 我笑而不...
    开封第一讲书人阅读 54,953评论 1 278
  • 正文 为了忘掉前任,我火速办了婚礼,结果婚礼上,老公的妹妹穿的比我还像新娘。我一直安慰自己,他们只是感情好,可当我...
    茶点故事阅读 63,971评论 5 369
  • 文/花漫 我一把揭开白布。 她就那样静静地躺着,像睡着了一般。 火红的嫁衣衬着肌肤如雪。 梳的纹丝不乱的头发上,一...
    开封第一讲书人阅读 48,784评论 1 283
  • 那天,我揣着相机与录音,去河边找鬼。 笑死,一个胖子当着我的面吹牛,可吹牛的内容都是我干的。 我是一名探鬼主播,决...
    沈念sama阅读 38,126评论 3 399
  • 文/苍兰香墨 我猛地睁开眼,长吁一口气:“原来是场噩梦啊……” “哼!你这毒妇竟也来了?” 一声冷哼从身侧响起,我...
    开封第一讲书人阅读 36,765评论 0 258
  • 序言:老挝万荣一对情侣失踪,失踪者是张志新(化名)和其女友刘颖,没想到半个月后,有当地人在树林里发现了一具尸体,经...
    沈念sama阅读 43,148评论 1 300
  • 正文 独居荒郊野岭守林人离奇死亡,尸身上长有42处带血的脓包…… 初始之章·张勋 以下内容为张勋视角 年9月15日...
    茶点故事阅读 35,744评论 2 323
  • 正文 我和宋清朗相恋三年,在试婚纱的时候发现自己被绿了。 大学时的朋友给我发了我未婚夫和他白月光在一起吃饭的照片。...
    茶点故事阅读 37,858评论 1 333
  • 序言:一个原本活蹦乱跳的男人离奇死亡,死状恐怖,灵堂内的尸体忽然破棺而出,到底是诈尸还是另有隐情,我是刑警宁泽,带...
    沈念sama阅读 33,479评论 4 322
  • 正文 年R本政府宣布,位于F岛的核电站,受9级特大地震影响,放射性物质发生泄漏。R本人自食恶果不足惜,却给世界环境...
    茶点故事阅读 39,080评论 3 307
  • 文/蒙蒙 一、第九天 我趴在偏房一处隐蔽的房顶上张望。 院中可真热闹,春花似锦、人声如沸。这庄子的主人今日做“春日...
    开封第一讲书人阅读 30,053评论 0 19
  • 文/苍兰香墨 我抬头看了看天上的太阳。三九已至,却和暖如春,着一层夹袄步出监牢的瞬间,已是汗流浃背。 一阵脚步声响...
    开封第一讲书人阅读 31,278评论 1 260
  • 我被黑心中介骗来泰国打工, 没想到刚下飞机就差点儿被人妖公主榨干…… 1. 我叫王不留,地道东北人。 一个月前我还...
    沈念sama阅读 45,245评论 2 352
  • 正文 我出身青楼,却偏偏与公主长得像,于是被迫代替她去往敌国和亲。 传闻我的和亲对象是个残疾皇子,可洞房花烛夜当晚...
    茶点故事阅读 42,590评论 2 343

推荐阅读更多精彩内容