iOS开发知识点汇集三 —— Delegate的使用

一、UIApplicationDelegate

- (void)applicationDidFinishLaunching:(UIApplication *)application    //启动完成
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions    //同上,带启动参数,推荐使用
- (void)applicationWillEnterForeground:(UIApplication *)application    //将要进入前台,首次启动不调用applicationWillEnterForeground,只有从后台再次进入前台时才调用
- (void)applicationDidBecomeActive:(UIApplication *)application    //进入前台
- (void)applicationWillResignActive:(UIApplication *)application    //将要退到后台
- (void)applicationDidEnterBackground:(UIApplication *)application    //退到后台
[[UIApplication sharedApplication] registerForRemoteNotificationTypes:UIRemoteNotificationTypeBadge | UIRemoteNotificationTypeAlert| UIRemoteNotificationTypeSound]; //设置push通知参数
- (void)application:(UIApplication *)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken //设置成功
- (void)application:(UIApplication *)application didFailToRegisterForRemoteNotificationsWithError:(NSError *)error //设置失败
- (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo //收到push通知
- (void)application:(UIApplication *)application didReceiveLocalNotification:(UILocalNotification *)notification //收到本地通知

二、跳转AppStore

1、跳转应用详情页

NSURL *appUrl = [NSURL URLWithString:[NSString stringWithFormat:@"http://itunes.apple.com/cn/app/id%d?mt=8",ituneId]];
[[UIApplication sharedApplication] openURL:appUrl];

2、跳转应用评价页

NSURL *appUrl = [NSURL URLWithString:[NSString stringWithFormat:@"itms-apps://ax.itunes.apple.com/WebObjects/MZStore.woa/wa/viewContentsUserReviews?type=Purple+Software&id=%d", itunesID]];
[[UIApplication sharedApplication] openURL:appUrl];


3、跳转兑换码页

NSURL *appUrl = [NSURL URLWithString:[NSString stringWithFormat:@"https://buy.itunes.apple.com/WebObjects/MZFinance.woa/wa/redeemLandingPage?code=%@", @"EEW94ALTYREW"]];
[[UIApplication sharedApplication] openURL:appUrl];


三、

阅读更多
文章标签: application
个人分类: iOS
想对作者说点什么? 我来说一句

IOS开发delegate Demo

2013年07月16日 72KB 下载

没有更多推荐了,返回首页

不良信息举报

iOS开发知识点汇集三 —— Delegate的使用

最多只允许输入30个字

加入CSDN,享受更精准的内容推荐,与500万程序员共同成长!
关闭
关闭