iOS开发中使用UIScrollView实现图片轮播和点击加载

2020-01-14 18:27:14于丽

 

主控制器

YYViewController.h文件

复制代码
//
//  YYViewController.h
//  02-团购(使用xib和类完成数据展示)
//
//  Created by apple on 14-5-29.
//  Copyright (c) 2014年 itcase. All rights reserved.
//

 

#import <UIKit/UIKit.h>

@interface YYViewController : UIViewController
//公开接口
//- (void)LoadMore;
@end

 

YYViewController.m文件

复制代码
//
//  YYViewController.m
//  02-团购(使用xib和类完成数据展示)
//
//  Created by apple on 14-5-29.
//  Copyright (c) 2014年 itcase. All rights reserved.
//

 

#import "YYViewController.h"
#import "YYtgModel.h"
#import "YYtgcell.h"
#import "YYfooterview.h"

@interface YYViewController ()<UITableViewDataSource,UITableViewDelegate>
@property (strong, nonatomic) IBOutlet UITableView *tableview;

@property(strong,nonatomic)NSMutableArray *tg;
@end


复制代码
@implementation YYViewController

 

#pragma mark-加载数据方法
-(void)LoadMore
{
    //创建模型
    YYtgModel *tgmodel=[[YYtgModel alloc]init];
    tgmodel.title=@"菜好上桌";
    tgmodel.icon=@"5ee372ff039073317a49af5442748071";
    tgmodel.buyCount=@"20";
    tgmodel.price=@"10000";
    //将模型添加到数组中
    [self.tg addObject:tgmodel];
    
    YYtgModel *tgmodelq=[[YYtgModel alloc]init];
    tgmodelq.title=@"菜好上桌1";
    tgmodelq.icon=@"5ee372ff039073317a49af5442748071";
    tgmodelq.buyCount=@"20";
    tgmodelq.price=@"10000";
    
    [self.tg addObject:tgmodelq];