//联系人:石虎QQ:1224614774昵称:嗡嘛呢叭咪哄
一、概念
#import"AppDelegate.h"
#import"MobClick.h"
#import"ViewController.h"
@interfaceAppDelegate ()
@end
@implementationAppDelegate
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
//1.初始化友盟统计模块
[MobClick startWithAppkey:@"是申请的 Key 名例如是 abcvxsdhufh"reportPolicy:BATCH channelId:nil];
//配置
NSString *version = [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleShortVersionString"];
[MobClick setAppVersion:version];
//设置ViewController添加到导航栏上
ViewController *vc = [[ViewController alloc]init];
UINavigationController * nvc = [[UINavigationController alloc]initWithRootViewController:vc];
//ViewController为主控制器
self.window.rootViewController = nvc;
self.window.backgroundColor = [UIColor whiteColor];
returnYES;
}
二、页面实现代码
//视图将要显示的时候
- (void)viewWillAppear:(BOOL)animated
{
[superviewWillAppear:animated];
//开始视图里面的日志页面:
[MobClick beginLogPageView:@"PageOne"];
}
//视图将要消失的时候
- (void)viewWillDisappear:(BOOL)animated
{
[superviewWillDisappear:animated];
[MobClick endLogPageView:@"PageOne"];
}
网友评论