自己總結(jié),歡迎指正,不喜勿噴
2017.03.05-2017.05.23
1.動(dòng)態(tài)更改collectionView的頭部視圖
self.flowLayout.headerReferenceSize = CGSizeMake(kMainScreenWidth, Size(540));//把布局申明為屬性,動(dòng)態(tài)更改header的高度
2.如何實(shí)現(xiàn)按鈕左圖右字
//左圖右字,同理可得上圖下字
- (void) rightSetting:(NSString *)title ImageN:(NSString *)image {
[self.rightButton setTitle:title forState:UIControlStateNormal];
[self.rightButton setImage:[UIImage imageNamed:image] forState:UIControlStateNormal];
self.rightButton.imageView.size = CGSizeMake(Size(28), Size(40));
self.rightButton.size = CGSizeMake(Size(135), Size(40));
self.rightButton.titleLabel.backgroundColor = self.rightButton.backgroundColor;
self.rightButton.imageView.backgroundColor = self.rightButton.backgroundColor;
//在使用一次titleLabel和imageView后才能正確獲取titleSize
CGSize titleSize = self.rightButton.titleLabel.bounds.size;
CGSize imageSize = self.rightButton.imageView.bounds.size;
CGFloat interval = Size(3);
self.rightButton.imageEdgeInsets = UIEdgeInsetsMake(0,titleSize.width + interval, 0, -(titleSize.width + interval));
self.rightButton.titleEdgeInsets = UIEdgeInsetsMake(0, -(imageSize.width + interval), 0, imageSize.width + interval);
}
3.重置下拉刷新完畢狀態(tài)
[strongSelf.collectionView.mj_footer resetNoMoreData];
4.如何實(shí)現(xiàn)應(yīng)用外導(dǎo)航
//還需在info.plist里添加白名單:
<key>LSApplicationQueriesSchemes</key>
<array>
<string>comgooglemaps</string> //谷歌地圖
<string>iosamap</string> //高德地圖
<string>baidumap</string> //百度地圖
</array>
//下面是彈出相應(yīng)地圖的彈框方法:需要傳經(jīng)緯度和目的地名
+ (void)presentMap:(UIViewController *)fatherVC Coordinate:(CLLocationCoordinate2D)coordinates Name:(NSString *)toName
{
__block NSString *urlScheme = @"TheDrivingCloudStuentSchemes";
__block NSString *appName = @"熊貓車(chē)幫";
__block CLLocationCoordinate2D coordinate = coordinates;
UIAlertController *alert = [UIAlertController alertControllerWithTitle:nil message:nil preferredStyle:UIAlertControllerStyleActionSheet];
//這個(gè)判斷其實(shí)是不需要的
if ( [[UIApplication sharedApplication] canOpenURL:[NSURL URLWithString:@"http://maps.apple.com/"]])
{
UIAlertAction *action = [UIAlertAction actionWithTitle:@"蘋(píng)果地圖" style:UIAlertActionStyleDefault handler:^(UIAlertAction *action) {
MKMapItem *currentLocation = [MKMapItem mapItemForCurrentLocation];
MKMapItem *toLocation = [[MKMapItem alloc] initWithPlacemark:[[MKPlacemark alloc] initWithCoordinate:coordinate addressDictionary:nil]];
if (![toName isEqualToString:@""]) {
toLocation.name = toName;
}
[MKMapItem openMapsWithItems:@[currentLocation, toLocation]
launchOptions:@{MKLaunchOptionsDirectionsModeKey: MKLaunchOptionsDirectionsModeDriving,MKLaunchOptionsShowsTrafficKey: [NSNumber numberWithBool:YES]}];
}];
[alert addAction:action];
}
if ( [[UIApplication sharedApplication] canOpenURL:[NSURL URLWithString:@"baidumap://"]])
{
UIAlertAction *action = [UIAlertAction actionWithTitle:@"百度地圖" style:UIAlertActionStyleDefault handler:^(UIAlertAction *action) {
NSString *urlString = [[NSString stringWithFormat:@"baidumap://map/direction?origin={{我的位置}}&destination=latlng:%f,%f|name=目的地&mode=driving&coord_type=gcj02",coordinate.latitude, coordinate.longitude]stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:urlString] options:@{} completionHandler:nil];
}];
[alert addAction:action];
}
if ( [[UIApplication sharedApplication] canOpenURL:[NSURL URLWithString:@"iosamap://"]])
{
UIAlertAction *action = [UIAlertAction actionWithTitle:@"高德地圖" style:UIAlertActionStyleDefault handler:^(UIAlertAction *action) {
NSString *urlString = [[NSString stringWithFormat:@"iosamap://navi?sourceApplication=%@&backScheme=%@&lat=%f&lon=%f&dev=0&style=2",appName,urlScheme,coordinate.latitude, coordinate.longitude]stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:urlString] options:@{} completionHandler:nil];
}];
[alert addAction:action];
}
if ( [[UIApplication sharedApplication] canOpenURL:[NSURL URLWithString:@"comgooglemaps://"]])
{
UIAlertAction *action = [UIAlertAction actionWithTitle:@"谷歌地圖" style:UIAlertActionStyleDefault handler:^(UIAlertAction *action) {
NSString *urlString = [[NSString stringWithFormat:@"comgooglemaps://?x-source=%@&x-success=%@&saddr=&daddr=%f,%f&directionsmode=driving",appName,urlScheme,coordinate.latitude, coordinate.longitude]stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:urlString] options:@{} completionHandler:nil];
}];
[alert addAction:action];
}
UIAlertAction *action = [UIAlertAction actionWithTitle:@"取消" style:UIAlertActionStyleCancel handler:nil];
[alert addAction:action];
[fatherVC presentViewController:alert animated:YES completion:^{
}];
}
5.七牛云如何截圖
//后面增加如下子串:
model.avatar = [model.avatar stringByAppendingString:@"?imageView2/1/w/200/h/200"];
//上傳圖片
NSDateFormatter *formatter = [[NSDateFormatter alloc] init];
formatter.dateFormat = @"yyyyMMddHHmmss";
NSString *imageName = [NSString stringWithFormat:@"zt%@",[formatter stringFromDate:[NSDate date]]];
NSString *token = [[NSUserDefaults standardUserDefaults]objectForKey:k_Qiniu_Token];
QNUploadManager *upManager = [[QNUploadManager alloc] init];
NSData *imageData = UIImageJPEGRepresentation(image, 1);
__weak typeof (self) weakSelf = self;
[upManager putData:imageData key:imageName token:token
complete: ^(QNResponseInfo *info, NSString *key, NSDictionary *resp) {
__strong typeof(self) strongSelf = weakSelf;
if (info.isOK) {
strongSelf.avaterURL = [NSString stringWithFormat:@"%@%@",strongSelf.avaterDomain,key];
[strongSelf postDataFouncation];
}else {
[YFWLHUDManager dismiss];
strongSelf.bgView.hidden = YES;
[YFWLHUDManager showFailureMessage:@"網(wǎng)絡(luò)錯(cuò)誤" duration:1.3];
}
} option:nil];
6.判斷是否開(kāi)啟了某系統(tǒng)功能
#pragma mark - 判斷是否開(kāi)啟了定位功能
- (void) judgeLocation {
if ([CLLocationManager locationServicesEnabled] &&
([CLLocationManager authorizationStatus] == kCLAuthorizationStatusAuthorized
|| [CLLocationManager authorizationStatus] == kCLAuthorizationStatusNotDetermined)) {
//定位功能可用,開(kāi)始定位
[self AmapInitSetting];
} else if ([CLLocationManager authorizationStatus] == kCLAuthorizationStatusDenied) {
NSString *version = [UIDevice currentDevice].systemVersion;
if (version.doubleValue >= 10.0) {
[[UIApplication sharedApplication]openURL:[NSURL URLWithString:UIApplicationOpenSettingsURLString]];
}else{
NSURL *url = [NSURL URLWithString:@"prefs:root=LOCATION_SERVICES"];
if ([[UIApplication sharedApplication] canOpenURL:url]){
[[UIApplication sharedApplication] openURL:url];
}
}
}
}
7.把json文件轉(zhuǎn)換成對(duì)應(yīng)的json數(shù)據(jù)
- (id) loadDataFouncation:(NSString *)name TypeN:(NSString *)type {
NSString *jsonPath = [[NSBundle mainBundle] pathForResource:name ofType:type];
NSData *data = [NSData dataWithContentsOfFile:jsonPath];
NSError *error = nil;
return [NSJSONSerialization JSONObjectWithData:data options:NSJSONReadingAllowFragments error:&error];
}
8.json字符串和字典數(shù)組的相互轉(zhuǎn)換
1.將字典或者數(shù)組轉(zhuǎn)化為JSON串
- (NSData *)toJSONData:(id)theData{
NSError *error = nil;
NSData *jsonData = [NSJSONSerialization dataWithJSONObject:theData options:NSJSONWritingPrettyPrinted error:&error];
if ([jsonData length] > 0 && error == nil){
return jsonData;
}else{
return nil;
}
}
2.json格式字符串轉(zhuǎn)數(shù)組:
- (id)toArrayOrNSDictionary:(NSData *)jsonData{
NSError *error = nil;
id jsonObject = [NSJSONSerialization JSONObjectWithData:jsonData options:NSJSONReadingAllowFragments error:nil];
if (jsonObject != nil && error == nil){
return jsonObject;
}else{
// 解析錯(cuò)誤
return nil;
}
}
9.如何加載html格式的web
- (void) loadRequestString{
UIWebView* webView = [[UIWebView alloc]initWithFrame:self.view.bounds];
//webView.scalesPageToFit = YES;//自動(dòng)對(duì)頁(yè)面進(jìn)行縮放以適應(yīng)屏幕
webView.delegate = self;
[self.view addSubview:webView];
NSString *htmlString = [[NSUserDefaults standardUserDefaults]objectForKey:self.htmlStr];
//根據(jù)網(wǎng)頁(yè)提供的字體改變網(wǎng)頁(yè)中的字體效果
//htmlString = [htmlString stringByReplacingOccurrencesOfString:@"tx-font#" withString:@"24"];
[webView loadHTMLString:htmlString baseURL:nil];
}
#pragma mark - UIWebViewDelegate
- (void)webViewDidStartLoad:(UIWebView *)webView{
[YFWLHUDManager showMessage:@"加載中,請(qǐng)稍候"];
}
- (void)webViewDidFinishLoad:(UIWebView *)webView{
[YFWLHUDManager dismiss];
}
- (void)webView:(UIWebView *)webView didFailLoadWithError:(NSError *)error{
[YFWLHUDManager showFailureMessage:@"加載失敗" duration:1.3];
}
10.如何給彈框加上輸入框
//alert為自定義的UIAlertController
[alert addTextFieldWithConfigurationHandler:^(UITextField * _Nonnull textField) {
__strong typeof(self) strongSelf = weakSelf;
textField.placeholder = @"請(qǐng)輸入金額(不大于可提現(xiàn)傭金)";
textField.font = [UIFont systemFontOfSize:Size(28)];
textField.textColor = [UIColor colorWithRGB:color(212121)];
textField.keyboardType = UIKeyboardTypeDecimalPad;
textField.delegate = strongSelf;
[textField becomeFirstResponder];
}];
11.如何檢測(cè)網(wǎng)絡(luò)狀況
//監(jiān)測(cè)當(dāng)前網(wǎng)絡(luò)狀況:直接把代碼加載在如下方法里就能時(shí)刻監(jiān)測(cè)網(wǎng)絡(luò),并做相應(yīng)處理
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions{
__weak typeof (self) weakSelf = self;
[[AFNetworkReachabilityManager sharedManager] startMonitoring];
[[AFNetworkReachabilityManager sharedManager] setReachabilityStatusChangeBlock:^(AFNetworkReachabilityStatus status) {
__strong typeof(self) strongSelf = weakSelf;
if(status ==AFNetworkReachabilityStatusReachableViaWWAN || status == AFNetworkReachabilityStatusReachableViaWiFi){
}else{
UIAlertView *alert = [[UIAlertView alloc]initWithTitle:@"溫馨提示" message:@"當(dāng)前無(wú)網(wǎng)絡(luò)連接" delegate:strongSelf cancelButtonTitle:@"取消" otherButtonTitles:nil, nil];
alert.delegate = strongSelf;
[alert show];
}
}];
}
12.獲取路徑和判斷文件是否存在
//判斷文件是否存在
- (BOOL)isSxistAtPath:(NSString *)filePath{
NSFileManager *fileManager = [NSFileManager defaultManager];
BOOL isExist = [fileManager fileExistsAtPath:filePath];
return isExist;
}
//獲取document路徑
- (NSString *)getDocumentsPath{
return [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) firstObject];
}
13.將json模型對(duì)象存入文件
- (BOOL)writeFile:(NSString *)fileName WithModel:(YFWLQuestionOneModel *)model{
NSData *resultData = [NSJSONSerialization dataWithJSONObject:[model mj_keyValues] options:NSJSONWritingPrettyPrinted error:nil];
NSString *iosPath = [NSString stringWithFormat:@"%@/%@",[self getDocumentsPath],fileName];
BOOL result = [resultData writeToFile:iosPath atomically:YES];
return result;
}
14.文件操作之拷貝已有文件
- (void)copyFromFile:(NSString *)sourcePath toOutPath:(NSString *)outPath{
NSFileHandle *infile, *outfile; //輸入文件、輸出文件
NSData *buffer = [[NSData alloc]init]; //讀取的緩沖數(shù)據(jù)
NSFileManager *fileManager = [NSFileManager defaultManager];
NSString *iosOutPath = [NSString stringWithFormat:@"%@/%@",[self getDocumentsPath],outPath];
BOOL success = [fileManager createFileAtPath:iosOutPath contents:nil attributes:nil];
if (!success){
return;
}
NSString *iosSourcePath = [NSString stringWithFormat:@"%@/%@",[self getDocumentsPath],sourcePath];
infile = [NSFileHandle fileHandleForReadingAtPath:iosSourcePath]; //創(chuàng)建讀取源路徑文件
if (infile == nil){
return;
}
outfile = [NSFileHandle fileHandleForWritingAtPath:iosOutPath]; //創(chuàng)建并打開(kāi)要輸出的文件
if (outfile == nil){
return;
}
[outfile truncateFileAtOffset:0]; //將輸出文件的長(zhǎng)度設(shè)為0
buffer = [infile readDataToEndOfFile]; //讀取數(shù)據(jù)
[outfile writeData:buffer]; //寫(xiě)入輸入
[infile closeFile]; // 關(guān)閉寫(xiě)入、輸入文件
[outfile closeFile];
}
15.刪除沙盒里的文件
// 刪除沙盒里的文件
-(void)deleteFile:(NSString *)fileName {
NSFileManager* fileManager=[NSFileManager defaultManager];
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory,NSUserDomainMask, YES);
//文件名
NSString *uniquePath=[[paths objectAtIndex:0] stringByAppendingPathComponent:fileName];
BOOL blHave=[[NSFileManager defaultManager] fileExistsAtPath:uniquePath];
if (!blHave) {
return ;
}else {
BOOL blDele= [fileManager removeItemAtPath:uniquePath error:nil];
if (blDele) {
NSLog(@"dele success");
}else {
NSLog(@"dele fail");
}
}
}
16.清除所有NSUserDefault的對(duì)象
NSUserDefaults *defatluts = [NSUserDefaults standardUserDefaults];
NSDictionary *dictionary = [defatluts dictionaryRepresentation];
for(NSString *key in [dictionary allKeys]){
[defatluts removeObjectForKey:key];
[defatluts synchronize];
}
17.模型轉(zhuǎn)對(duì)象,數(shù)組轉(zhuǎn)對(duì)象(MJExtension框架)
//數(shù)組轉(zhuǎn)對(duì)象
+ (NSDictionary *)mj_objectClassInArray {
return @{@"data" : [YFWLBannerArray class]};
}
//替換更改屬性
+ (NSDictionary *)mj_replacedKeyFromPropertyName {
return @{@"idField" : @"id"};
}
18.極光推送
// 取得 APNs 標(biāo)準(zhǔn)信息內(nèi)容
NSDictionary *notification = [launchOptions objectForKey: UIApplicationLaunchOptionsRemoteNotificationKey];
NSDictionary *aps = [notification valueForKey:@"aps"];
NSString *content = [aps valueForKey:@"alert"]; //推送顯示的內(nèi)容
NSInteger badge = [[aps valueForKey:@"badge"] integerValue]; //badge數(shù)量
NSString *sound = [aps valueForKey:@"sound"]; //播放的聲音
// 取得Extras字段內(nèi)容
NSString *customizeField1 = [userInfo valueForKey:@"customizeExtras"]; //服務(wù)端中Extras字段,key是自己定義的
19.融云IM
文檔很好,跟著集成就行了 集成文檔
//此方法中要提供給融云用戶(hù)的信息,建議緩存到本地,然后改方法每次從您的緩存返回
//融云不管理用戶(hù)信息,用戶(hù)信息需要從上個(gè)界面?zhèn)鬟^(guò)來(lái),或者后臺(tái)獲取
- (void)getUserInfoWithUserId:(NSString *)userId completion:(void(^)(RCUserInfo* userInfo))completion{
if ([[[RCIM sharedRCIM]currentUserInfo].userId isEqual:userId]) {
RCUserInfo *user = [[RCUserInfo alloc]init];
user.userId = [[RCIM sharedRCIM]currentUserInfo].userId;
user.name = [[NSUserDefaults standardUserDefaults]objectForKey:k_User_Name];
user.portraitUri = [[NSUserDefaults standardUserDefaults]objectForKey:k_User_HeadImage];
return completion(user);
}else if([self.targetId isEqual:userId]) {
RCUserInfo *user = [[RCUserInfo alloc]init];
user.userId = self.targetId;
user.name = self.titleName;
user.portraitUri = self.headUrl;
return completion(user);
}
}
20. 友盟分享
集成文檔
注:微信的應(yīng)用需要去申請(qǐng)上線才能測(cè)試分享,所以提前去申請(qǐng)好
//如何添加自定義的分享按鈕
[UMSocialUIManager addCustomPlatformWithoutFilted:UMSocialPlatformType_UserDefine_Begin+2 withPlatformIcon:[UIImage imageNamed:@"YF_2面對(duì)面分享"] withPlatformName:@"面對(duì)面分享"];
[UMSocialShareUIConfig shareInstance].sharePageGroupViewConfig.sharePageGroupViewPostionType = UMSocialSharePageGroupViewPositionType_Bottom;
[UMSocialShareUIConfig shareInstance].sharePageScrollViewConfig.shareScrollViewPageItemStyleType = UMSocialPlatformItemViewBackgroudType_IconAndBGRadius;
[UMSocialUIManager showShareMenuViewInWindowWithPlatformSelectionBlock:^(UMSocialPlatformType platformType, NSDictionary *userInfo) {
__strong typeof(self) strongSelf = weakSelf;
//在回調(diào)里面獲得點(diǎn)擊的
if (platformType == UMSocialPlatformType_UserDefine_Begin+2) {
__weak typeof (self) weakSelf = self;
[UIView animateWithDuration:0.3 delay:0.2 options:UIViewAnimationOptionCurveEaseInOut animations:^{
__strong typeof(self) strongSelf = weakSelf;
strongSelf.QrCodeView.transform = CGAffineTransformMakeTranslation(0, -Size(666));
} completion:nil];
}
else{
[strongSelf shareWebPageToPlatformType:platformType];
}
}];
21. 高德地圖
定位集成文檔
注:高德的定位只返回了標(biāo)準(zhǔn)的區(qū)域編碼,一般規(guī)律取區(qū)域編碼的前四位后面添零:即是城市編碼,取區(qū)域編碼的前兩位后面添零:即是省編碼。
22. 支付寶支付
APP支付集成文檔
坑少:跟著文檔走,加簽分后臺(tái)和前臺(tái),不過(guò)新版都要求后臺(tái)傳,做的時(shí)候跟后臺(tái)一起注意驗(yàn)證參數(shù),簽名之類(lèi)。
//請(qǐng)求了后臺(tái)接口獲取相應(yīng)簽名后調(diào)用的支付方法
- (void) aliPayWithMessage:(NSString *)orderStr {
// NOTE: 如果加簽成功,則繼續(xù)執(zhí)行支付
if (orderStr != nil) {
//應(yīng)用注冊(cè)scheme,在AliSDKDemo-Info.plist定義URL types
NSString *appScheme = k_App_Scheme;
// NOTE: 調(diào)用支付結(jié)果開(kāi)始支付
[[AlipaySDK defaultService] payOrder:orderStr fromScheme:appScheme callback:^(NSDictionary *resultDic) {
NSLog(@"***************reslut = %@",resultDic);
}];
}else {
[YFWLHUDManager showFailureMessage:@"獲取訂單失敗" duration:1.4];
}
}
// 支付跳轉(zhuǎn)支付寶錢(qián)包進(jìn)行支付,處理支付結(jié)果
[[AlipaySDK defaultService] processOrderWithPaymentResult:url standbyCallback:^(NSDictionary *resultDic) {
__strong typeof(self) strongSelf = weakSelf;
[strongSelf presentAlert:resultDic[@"resultStatus"] Message:resultDic[@"memo"]];
}];
// 授權(quán)跳轉(zhuǎn)支付寶錢(qián)包進(jìn)行支付,處理支付結(jié)果:以下都是在AppDelegate中處理
[[AlipaySDK defaultService] processAuth_V2Result:url standbyCallback:^(NSDictionary *resultDic) {
NSLog(@"result = %@",resultDic);
// 解析 auth code
NSString *result = resultDic[@"result"];
NSString *authCode = nil;
if (result.length>0) {
NSArray *resultArr = [result componentsSeparatedByString:@"&"];
for (NSString *subResult in resultArr) {
if (subResult.length > 10 && [subResult hasPrefix:@"auth_code="]) {
authCode = [subResult substringFromIndex:10];
break;
}
}
}
NSLog(@"授權(quán)結(jié)果 authCode = %@", authCode?:@"");
}];
//出來(lái)支付結(jié)果
- (void) presentAlert:(NSString *)status Message:(NSString *)message {
NSString *content = message;
switch ([status integerValue]) {
case 9000:
content = @"支付成功";
break;
case 8000:
content = @"正在處理中";
break;
case 4000:
content = @"訂單支付失敗";
break;
case 5000:
content = @"訂單重復(fù)支付";
break;
case 6001:
content = @"已取消";
break;
case 6002:
content = @"網(wǎng)絡(luò)連接出錯(cuò)";
break;
default:
break;
}
if (content == nil || [content isEqualToString:@""]) {
content = @"發(fā)生未知錯(cuò)誤";
}
[self presentAlert:content];//彈出相應(yīng)提示,或者發(fā)送通知做界面展示
}
23. 微信支付
微信的支付文檔啥的就不說(shuō)了,集成過(guò)的都知道??犹啵⊥瑫r(shí)必須微信官方審核過(guò)了才能驗(yàn)證支付,應(yīng)用必須申請(qǐng)上線,必須開(kāi)通支付能力。前面一堆建議優(yōu)先級(jí)為最高,不然,后面時(shí)間不夠,審核很慢。
參考文檔1
參考文檔2(推薦)
//請(qǐng)求了后臺(tái)接口獲取相應(yīng)簽名后調(diào)用的支付方法,參數(shù)必須一一對(duì)應(yīng)
- (void) doWeixinPay:(YFWLWexinPayModel *)model {
if (model == nil) {
[YFWLHUDManager showFailureMessage:@"獲取訂單失敗" duration:1.4];
return;
}
PayReq *request = [[PayReq alloc] init];
request.partnerId = model.partnerid;
request.prepayId = model.prepayid;
request.package = model.package_sign;
request.nonceStr = model.noncestr;
request.timeStamp = model.timestamp;
request.sign= model.sign;
[WXApi sendReq:request];
}
//微信支付回調(diào):處理支付結(jié)果:以下都是在AppDelegate中處理
-(void)onResp:(BaseResp*)resp{
if ([resp isKindOfClass:[PayResp class]]){
PayResp*response=(PayResp*)resp;
NSLog(@"支付失敗,retcode = %d errStr = %@",resp.errCode,resp.errStr);
NSString *message = @"未知結(jié)果";
switch(response.errCode){
case 0:
message = @"支付成功";
break;
case -1:
message = @"支付錯(cuò)誤";
break;
case -2:
message = @"用戶(hù)取消";
break;
default:
break;
}
[self presentAlert:message]; //彈出相應(yīng)提示,或者發(fā)送通知做界面展示
}
}