This commit is contained in:
wu736139669
2015-04-02 18:01:32 +08:00
parent edf091ccd5
commit e83b44a9ca
7 changed files with 112 additions and 13 deletions
@@ -330,11 +330,11 @@
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "Ash_AWord/ViewControllers/My/SetUpViewController.m"
timestampString = "449641045.879342"
timestampString = "449661357.291857"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "80"
endingLineNumber = "80"
startingLineNumber = "81"
endingLineNumber = "81"
landmarkName = "-tableView:cellForRowAtIndexPath:"
landmarkType = "5">
</BreakpointContent>
+8 -3
View File
@@ -26,6 +26,11 @@
#endif
/**
* app store上的Apple ID
*/
#define kAppleID 957252253
/**
* 系统版本
*/
@@ -68,10 +73,10 @@
/**
* QQ开放平台信息
*/
#define kQQAppId @"1104070329"
#define kQQAppSecret @"Lkk4P8GrTkcliKZo"
#define kQQAppId @"1104478314"
#define kQQAppSecret @"RspMp0GiZqjabMvw"
#define kUmengAppkey @"551958aafd98c5cc010006d8"
#define kUmengAppkey @"551cf898fd98c586460011d1"
/**
* 调整图片的宽度
+2 -2
View File
@@ -32,7 +32,7 @@
<string>QQ</string>
<key>CFBundleURLSchemes</key>
<array>
<string>QQ41CEC6B9</string>
<string>QQ41d5006a</string>
</array>
</dict>
<dict>
@@ -40,7 +40,7 @@
<string>tencent</string>
<key>CFBundleURLSchemes</key>
<array>
<string>tencent1104070329</string>
<string>tencent1104478314</string>
</array>
</dict>
<dict>
@@ -11,4 +11,5 @@
@interface SetUpViewController : ViewController<UITableViewDelegate, UITableViewDataSource>
@property (weak, nonatomic) IBOutlet UITableView *tableView;
+ (void)shareAppWithViewController:(UIViewController *)controller andTitle:(NSString *)title andContent:(NSString *)content andImage:(UIImage *)image andUrl:(NSString *)url;
@end
@@ -7,7 +7,8 @@
//
#import "SetUpViewController.h"
#import "EGOCache.h"
#import "UMSocial.h"
@interface SetUpViewController ()
@end
@@ -109,6 +110,62 @@
}
return cell;
}
-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
[tableView deselectRowAtIndexPath:indexPath animated:YES];
switch (indexPath.row) {
case 0:
[self cleanCache];
break;
case 1:
{
[SetUpViewController shareAppWithViewController:self andTitle:@"听说" andContent:@"最真的表白,是我欲言又止的沉默" andImage:[UIImage imageNamed:@"Icon@2x"] andUrl:@"http://www.baidu.com"];
}
break;
case 4:
[self goToAppraisal];
break;
default:
break;
}
}
#pragma mark 跳到App Store评价
- (void)goToAppraisal
{
NSString *str = [NSString stringWithFormat:@"http://itunes.apple.com/us/app/id%d", kAppleID];
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:str]];
}
#pragma mark 关于
-(void)showAbout
{
}
#pragma mark 清除缓存
- (void)cleanCache{
[MBProgressHUD hudWithView:nil label:@"清除缓存中"];
//清除cookies
NSHTTPCookie *cookie;
NSHTTPCookieStorage *storage = [NSHTTPCookieStorage sharedHTTPCookieStorage];
for (cookie in [storage cookies])
{
[storage deleteCookie:cookie];
}
//清除UIWebView的缓存
[[NSURLCache sharedURLCache] removeAllCachedResponses];
[[EGOCache globalCache] clearCache];
//image缓存
SDImageCache *cache = [SDImageCache sharedImageCache];
[cache clearDiskOnCompletion:^{
[self.tableView reloadData];
[MBProgressHUD hideAllHUDsForView:nil animated:YES];
[MBProgressHUD checkHudWithView:nil label:@"缓存清除成功" hidesAfter:1];
}];
}
-(void)lgout:(id)sender
{
[AWordUser sharedInstance].isLogin = NO;
@@ -116,10 +173,46 @@
[[NSNotificationCenter defaultCenter] postNotificationName:kLogoutSuccessNotificationName object:nil];
[self.navigationController popViewControllerAnimated:YES];
}
-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
+ (void)shareAppWithViewController:(UIViewController *)controller andTitle:(NSString *)title andContent:(NSString *)content andImage:(UIImage *)image andUrl:(NSString *)url
{
[tableView deselectRowAtIndexPath:indexPath animated:YES];
if(title.length <= 0)
{
title = @"听说";
}
if(content.length <= 0)
{
content = @"http://www.baidu.com";
}
NSString *shareText = [NSString stringWithFormat:@"%@%@",content,url];
if(!image)
{
image = [UIImage imageNamed:@"Icon@2x"];
}
//设置title
[UMSocialData defaultData].extConfig.title = [NSString stringWithFormat:@"%@",title];
//设置url链接
[UMSocialData defaultData].extConfig.qqData.url = url;
[UMSocialData defaultData].extConfig.wechatSessionData.url = url;
[UMSocialData defaultData].extConfig.wechatTimelineData.url = url;
//调用快速分享接口
[UMSocialSnsService presentSnsIconSheetView:controller
appKey:kUmengAppkey
shareText:shareText
shareImage:image
shareToSnsNames:[NSArray arrayWithObjects:UMShareToSina,
UMShareToQQ,
UMShareToWechatSession,
UMShareToWechatTimeline,
UMShareToEmail,
UMShareToSms,
nil]
delegate:nil];
}
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
@@ -21,7 +21,7 @@
pro.pFile = file;
pro.reqURL = @"rs/text_image/add";
pro.responesOBJ = self.class;
content = [content stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
// content = [content stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
pro.pro = @{@"content": content,
};
return pro;
+1 -1
View File
@@ -25,7 +25,7 @@
- (instancetype)initWithDictionary:(NSDictionary *)dictionaryValue error:(NSError **)error {
self = [super initWithDictionary:dictionaryValue error:error];
if (self == nil) return nil;
self.content = [self.content stringByReplacingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
// self.content = [self.content stringByReplacingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
// Store a value that needs to be determined locally upon initialization.
return self;