友盟统计

以下是友盟统计
加第三方

#define APPkey @“5bd954bbf1f5566d38000234”
#import <UMAnalytics/MobClick.h>
typedef NS_ENUM(NSInteger, ECstatistic) {
ECstatisticLog, ///< 日志系统
ECstatisticEvent, ///< 事件机制
ECstatisticTest ///< 集成测试
};

@interface ViewController ()<UITableViewDelegate,UITableViewDataSource>

/**
储存表格单元格数据的数组
*/
@property (nonatomic,strong) NSArray *cellArray;

/**
主页面展示的表格
*/
@property (nonatomic,strong) UITableView *ojTableView;
@end

@implementation ViewController

  • (UITableView *)ojTableView{
    if (!_ojTableView) {
    _ojTableView = [[UITableView alloc] initWithFrame:self.view.frame style:UITableViewStyleGrouped];
    _ojTableView.delegate = self;
    _ojTableView.dataSource = self;
    }
    return _ojTableView;
    }

  • (void)viewDidLoad {
    [super viewDidLoad];
    // 初始化数组
    _cellArray = @[@“日志系统”,@“集成测试”,@“事件机制”];
    [self.view addSubview:self.ojTableView];
    }

  • (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
    return _cellArray.count;
    }

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

    // 创建静态字符串标识单元格
    static NSString * const cellID = @“com.baidu.www.Lesson-2------”;
    // 创建UITableViewCell 对象
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:cellID];
    // 对cell进行判断
    if (!cell) {
    // 如果cell不存在 则初始化
    cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:cellID];
    }
    cell.textLabel.text = _cellArray[indexPath.row];
    return cell;
    }

  • (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
    switch (indexPath.row) {
    // 日志系统
    case ECstatisticLog:{
    NSLog(@“点击了日志系统”);
    }break;
    // 集成测试
    case ECstatisticTest:{
    NSLog(@“点击了集成测试”);
    }break;
    // 事件机制
    case ECstatisticEvent:{
    [MobClick event:@“pay” attributes:@{@“book” : @“Swift Fundamentals”} counter:110];
    }break;

      default:
          break;
    

    }
    }

@end

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值