Gowhich

Durban's Blog

关于scrollView下拉自动刷洗的 操作方法,这个我最近由于做应用需要用到,找了几个版本的示例,自己根据原理试着自己做了一个,还是有点问题,先贴到这里,有时间再看看

testRefreshViewViewController.h

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
//
// testRefreshViewViewController.h
// testRefreshView
//
// Created by david on 13-6-11.
// Copyright (c) 2013年 walkerfree. All rights reserved.
//

#import <UIKit/UIKit.h>
#import "RefreshView.h"

@interface testRefreshViewViewController : UIViewController<RefreshViewDelegate, UIScrollViewDelegate>
{
UIScrollView *scrollView;
RefreshView *refreshView;
}
@property (strong, nonatomic) IBOutlet UIScrollView *scrollView;

@end

testRefreshViewViewController.m

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
//
// testRefreshViewViewController.m
// testRefreshView
//
// Created by david on 13-6-11.
// Copyright (c) 2013年 walkerfree. All rights reserved.
//

#import "testRefreshViewViewController.h"

@interface testRefreshViewViewController ()

@end

@implementation testRefreshViewViewController

@synthesize scrollView = _scrollView;

#pragma RefreshView
-(void) startLoading
{
[refreshView startLoading];
//模拟3秒钟后停止
[self performSelector:@selector(stopLoading) withObject:nil afterDelay:3];
}

-(void) stopLoading
{
[refreshView stopLoading];
}

-(void) refresh
{
[self startLoading];
}

//刚拖动的时候
- (void)scrollViewWillBeginDragging:(UIScrollView *)scrollView_
{
[refreshView scrollViewWillBeginDragging:scrollView_];
}

//拖动过程中
-(void) scrollViewDidScroll:(UIScrollView *)scrollView_
{
[refreshView scrollViewDidScroll:scrollView_];
}

//拖动结束后
- (void)scrollViewDidEndDragging:(UIScrollView *)scrollView_ willDecelerate:(BOOL)decelerate
{
NSLog(@"here");
[refreshView scrollViewDidEndDragging:scrollView_ willDecelerate:decelerate];
}

#pragma mark - RefreshViewDelegate
- (void)refreshViewDidCallBack {
[self refresh];
}

- (void)viewDidLoad
{
[super viewDidLoad];

NSArray *nils = [[NSBundle mainBundle] loadNibNamed:@"RefreshView" owner:self options:nil];
refreshView = [nils objectAtIndex:0];
_scrollView.contentSize = CGSizeMake(320, 460);
_scrollView.contentInset = UIEdgeInsetsMake(REFRESH_HEADER_HEIGHT, 0, 0, 0);
// _scrollView.backgroundColor = [UIColor blueColor];

[refreshView setupWithOwner:_scrollView delegate:self];
[self refresh];
}

- (void)didReceiveMemoryWarning
{
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}

//-(void) start

@end

里面有个文件是:

RefreshView.h

这个文件来自于cocoachina,地址:http://www.cocoachina.com/bbs/read.php?tid=90232&fpage=3

需要的可以自己去下载一下

1,使用NSString中的stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceCharacterSet]]; 方法只是去掉左右两边的空格
2,使用NSString *strUrl = [urlString stringByReplacingOccurrencesOfString:@" " withString:@""]; 使用替换的方法去掉空格

示例:

1
2
3
4
5
6
NSString *personIdString = [[NSString alloc] init];
for (id item in _compareDataDic) {
personIdString = [personIdString stringByAppendingString:[NSString stringWithFormat:@"%@ ",[[_compareDataDic valueForKey:[NSString stringWithFormat:@"%@",item]] valueForKey:@"person_id"]]];
}
personIdString = [personIdString stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceCharacterSet]];
personIdString = [personIdString stringByReplacingOccurrencesOfString:@" " withString:@","];

_compareDataDic是一个NSMutableDictionary类型的变量

iphone沙箱模型的有四个文件夹,分别是什么,永久数据存储一般放在什么位置,得到模拟器的路径的简单方式是什么.
documents,tmp,app,Library。
(NSHomeDirectory())手动保存的文件在documents文件里
Nsuserdefaults保存的文件在tmp文件夹里

  • Documents 目录:您应该将所有的应用程序数据文件写入到这个目录下。这个目录用于存储用户数据或其它应该定期备份的信息。
  • AppName.app 目录:这是应用程序的程序包目录,包含应用程序的本身。由于应用程序必须经过签名,所以您在运行时不能对这个目录中的内容进行修改,否则可能会使应用程序无法启动。
  • Library 目录:这个目录下有两个子目录:Caches 和 Preferences
    Preferences 目录:包含应用程序的偏好设置文件。您不应该直接创建偏好设置文件,而是应该使用NSUserDefaults类来取得和设置应用程序的偏好.
    Caches 目录:用于存放应用程序专用的支持文件,保存应用程序再次启动过程中需要的信息。
  • tmp 目录:这个目录用于存放临时文件,保存应用程序再次启动过程中不需要的信息。

获取这些目录路径的方法:

  • 获取家目录路径的函数:
    NSString *homeDir = NSHomeDirectory();

  • 获取Documents目录路径的方法:
    NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
    NSString *docDir = [paths objectAtIndex:0];

  • 获取Caches目录路径的方法:
    NSArray *paths = NSSearchPathForDirectoriesInDomains(NSCachesDirectory, NSUserDomainMask, YES);
    NSString *cachesDir = [paths objectAtIndex:0];

  • 获取tmp目录路径的方法:
    NSString *tmpDir = NSTemporaryDirectory();

  • 获取应用程序程序包中资源文件路径的方法:
    例如获取程序包中一个图片资源(apple.png)路径的方法:

1
2
NSString *imagePath = [[NSBundle mainBundle] pathForResource:@”apple” ofType:@”png”];
UIImage *appleImage = [[UIImage alloc] initWithContentsOfFile:imagePath];

代码中的mainBundle类方法用于返回一个代表应用程序包的对象。
iphone沙盒(sandbox)中的几个目录获取方式:

  • 获取沙盒主目录路径
    NSString *homeDir = NSHomeDirectory();

  • 获取Documents目录路径
    NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
    NSString *docDir = [paths objectAtIndex:0];

  • 获取Caches目录路径
    NSArray *paths = NSSearchPathForDirectoriesInDomains(NSCachesDirectory, NSUserDomainMask, YES);
    NSString *cachesDir = [paths objectAtIndex:0];

  • 获取tmp目录路径
    NSString *tmpDir = NSTemporaryDirectory();

  • 获取当前程序包中一个图片资源(apple.png)路径
    NSString *imagePath = [[NSBundle mainBundle] pathForResource:@"apple" ofType:@"png"];
    UIImage *appleImage = [[UIImage alloc] initWithContentsOfFile:imagePath];

例子:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
NSFileManager* fm=[NSFileManager defaultManager];
if(![fm fileExistsAtPath:[self dataFilePath]]){
//下面是对该文件进行制定路径的保存
[fm createDirectoryAtPath:[self dataFilePath] withIntermediateDirectories:YES attributes:nil error:nil];

//取得一个目录下得所有文件名
NSArray *files = [fm subpathsAtPath: [self dataFilePath] ];

//读取某个文件
NSData *data = [fm contentsAtPath:[self dataFilePath]];

//或者
NSData *data = [NSData dataWithContentOfPath:[self dataFilePath]];
}

目标:把NSDictionary对象转换成NSMutableDictionary对象,对象内容是字符串数组,需要实现完全复制(深复制)。
如果调用NSDictionary的mutableCopy方法,可以得到一个NSMutableDictionary对象,但这只是浅复制,如果我们修改NSDictionary中数组内的值(当然,数组必须是NSMutableArray),会发现,NSMutableDictionary对象内数组的值也跟着更改了。我们需要增加一个mutableDeepCopy方法来实现深复制,在该方法中,循环复制每一个元素。
要实现这一功能,有两种方法,一是继承,二是使用category。category与继承的区别在于,使用category并不是新建一个类,而是在原类的基础上增加一些方法(使用的时候还是用原类名),这样,我们就不需要修改已经在其他源文件中写好的类名,只需要导入h头文件,再把复制方法修改成我们新增的方法即可。

一、新建Objective-C category文件,我这Category填MutableDeepCopy,Category on填NSDictionary,所以生成的文件是NSDictionary+MutableDeepCopy.h和NSDictionary+MutableDeepCopy.m,生成的文件名很容易理解。

二、两文件源代码:

NSDictionary+MutableDeepCopy.h

1
2
3
4
5
#import <Foundation/Foundation.h>  
@interface NSDictionary (MutableDeepCopy)
-(NSMutableDictionary *)mutableDeepCopy;
//增加mutableDeepCopy方法
@end

NSDictionary+MutableDeepCopy.m

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#import "NSDictionary+MutableDeepCopy.h"  
@implementation NSDictionary (MutableDeepCopy)
-(NSMutableDictionary *)mutableDeepCopy
{
NSMutableDictionary *dict=[[NSMutableDictionary alloc] initWithCapacity:[self count]];
//新建一个NSMutableDictionary对象,大小为原NSDictionary对象的大小
NSArray *keys=[self allKeys];
for(id key in keys)
{//循环读取复制每一个元素
id value=[self objectForKey:key];
id copyValue;
if ([value respondsToSelector:@selector(mutableDeepCopy)]) {
//如果key对应的元素可以响应mutableDeepCopy方法(还是NSDictionary),调用mutableDeepCopy方法复制
copyValue=[value mutableDeepCopy];
}else if([value respondsToSelector:@selector(mutableCopy)])
{
copyValue=[value mutableCopy];
}
if(copyValue==nil)
copyValue=[value copy];
[dict setObject:copyValue forKey:key];

}
return dict;
}
@end

这是一篇转自别人的文章,方法当然学习一下,关键的一点是,我们如何去添加方法到已经存在的类中,比如上面的例子,我们如何添加深度复制的方法到NSDictionary中。

通过上面的例子我学习了。大家也学习了

测试代码:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#import <Foundation/Foundation.h>  
#import "NSDictionary+MutableDeepCopy.h"
//导入头文件
int main (int argc, const char * argv[])
{

@autoreleasepool {
NSMutableArray *arr1=[[NSMutableArray alloc] initWithObjects:@"aa",@"bb",@"cc", nil];
NSDictionary *dict1=[[NSDictionary alloc] initWithObjectsAndKeys:arr1,@"arr1", nil];
NSLog(@"%@",dict1);
NSMutableDictionary *dict2=[dict1 mutableCopy];
//浅复制
NSMutableDictionary *dict3=[dict1 mutableDeepCopy];
//深复制
[arr1 addObject:@"dd"];
NSLog(@"%@",dict2);
NSLog(@"%@",dict3);

}
return 0;
}

在做app应用的时候,需要将数据提交到服务器去存储,那么方法可以参考如下,哈,自己搜索整理的

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
//参数1名字=参数1数据&参数2名字=参数2数据&参数3名字=参数3数据&...
NSString *postString = [NSString stringWithFormat:@"app_key=XXXXXXXXXXXXXXXXXX"];
postString = [postString stringByAppendingString:[NSString stringWithFormat:@"&device_token=%@",deviceId]];
postString = [postString stringByAppendingString:[NSString stringWithFormat:@"&teleplay_title=%@",title]];
postString = [postString stringByAppendingString:[NSString stringWithFormat:@"&job_type=%@",type]];
postString = [postString stringByAppendingString:[NSString stringWithFormat:@"&deadline=%@",time]];
postString = [postString stringByAppendingString:[NSString stringWithFormat:@"&age=%@",age]];
postString = [postString stringByAppendingString:[NSString stringWithFormat:@"&sex=%@",sex]];
postString = [postString stringByAppendingString:[NSString stringWithFormat:@"&people_num=%@",num]];
postString = [postString stringByAppendingString:[NSString stringWithFormat:@"&contact_person=%@",person]];
postString = [postString stringByAppendingString:[NSString stringWithFormat:@"&contact=%@",phone]];
postString = [postString stringByAppendingString:[NSString stringWithFormat:@"&description=%@",description]];

NSLog(@"postString:%@",postString);

//将NSSrring格式的参数转换格式为NSData,POST提交必须用NSData数据。
NSData *postData = [postString dataUsingEncoding:NSUTF8StringEncoding allowLossyConversion:YES];
//计算POST提交数据的长度
NSString *postLength = [NSString stringWithFormat:@"%d",[postData length]];
NSLog(@"postLength=%@",postLength);
//定义NSMutableURLRequest
NSMutableURLRequest *request = [[NSMutableURLRequest alloc] init];
//设置提交目的url
[request setURL:[NSURL URLWithString:[NSString stringWithFormat:@"http://www.baidu.com"]]];
//设置提交方式为 POST
[request setHTTPMethod:@"POST"];
//设置http-header:Content-Type
//这里设置为 application/x-www-form-urlencoded ,如果设置为其它的,比如text/html;charset=utf-8,或者 text/html 等,都会出错。不知道什么原因。
[request setValue:@"application/x-www-form-urlencoded" forHTTPHeaderField:@"Content-Type"];
//设置http-header:Content-Length
[request setValue:postLength forHTTPHeaderField:@"Content-Length"];
//设置需要post提交的内容
[request setHTTPBody:postData];

//定义
NSHTTPURLResponse* urlResponse = nil;
NSError *error = [[NSError alloc] init];

//设置网络状态显示
[UIApplication sharedApplication].networkActivityIndicatorVisible = YES;

//同步提交:POST提交并等待返回值(同步),返回值是NSData类型。
NSData *responseData = [NSURLConnection sendSynchronousRequest:request returningResponse:&urlResponse error:&error];

//将NSData类型的返回值转换成NSString类型
// NSString *result = [[NSString alloc] initWithData:responseData encoding:NSUTF8StringEncoding];

//将NSData装换为字典类型
NSError *jsonError = [[NSError alloc] init];
NSDictionary *personDictionary = [NSJSONSerialization JSONObjectWithData:responseData
options:NSJSONReadingMutableContainers
error:&jsonError];
NSString *status = [personDictionary objectForKey:@"status"];

if ([@"ok" compare:status] == NSOrderedSame) {
[UIApplication sharedApplication].networkActivityIndicatorVisible = NO;
return YES;
}
return NO;

关于文件目录的操作和检查

1
2
3
4
5
6
7
8
9
10
11
12
- (NSString *)dataPath:(NSString *)file  
{

NSString *path = [[NSHomeDirectory() stringByAppendingPathComponent:@"Documents"] stringByAppendingPathComponent:@"badge"];
BOOL bo = [[NSFileManager defaultManager] createDirectoryAtPath:path withIntermediateDirectories:YES attributes:nil error:nil];
NSAssert(bo,@"创建目录失败");

NSString *result = [path stringByAppendingPathComponent:file];

return result;

}

文件目录操作和文件创建(图片)

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
- (void)viewDidLoad  
{
[super viewDidLoad];
//此处首先指定了图片存取路径(默认写到应用程序沙盒 中)
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory,NSUserDomainMask, YES);

//并给文件起个文件名
NSString *imageDir = [[[paths objectAtIndex:0] stringByAppendingPathComponent:@"163"] stringByAppendingPathComponent:@"songzi"];

//存放图片的文件夹
NSString *imagePath =[imageDir stringByAppendingPathComponent:@"文件名.png"];

NSData *data = nil;

//检查图片是否已经保存到本地
if([self isExistsFile:imagePath]){
data=[NSData dataWithContentsOfFile:imagePath];
}else{
data = [NSData dataWithContentsOfURL:[NSURL URLWithString: @"网址"]];

//创建文件夹路径
[[NSFileManager defaultManager] createDirectoryAtPath:imageDir withIntermediateDirectories:YES attributes:nil error:nil];

//创建图片
[UIImagePNGRepresentation([UIImage imageWithData:data]) writeToFile:imagePath atomically:YES];
}
imageView.image = [UIImage imageWithData:data];
}

检查文件是否存在

1
2
NSString *path = [[NSBundle mainBundle] pathForResource:fileName ofType:@""];
if(path==NULL)

获取沙箱目录的完整路径

1
2
3
4
5
6
7
8
9
//获取沙箱目录的完整路径
//uuid.plist
NSArray *myPaths = NSSearchPathForDirectoriesInDomains(NSDocumentationDirectory, NSUserDomainMask, YES);
NSString *myDocPath = [myPaths objectAtIndex:0];

NSLog(@"myDocPath = %@",myDocPath);

NSString *filename = [myDocPath stringByAppendingPathComponent:@"uuid.plist"];
NSLog(@"filename = %@",filename);

获取tmp目录

1
2
3
4
//获取tmp目录
NSString *tmpPath = NSTemporaryDirectory();
NSString *tmpfilename = [tmpPath stringByAppendingPathComponent:@"uuid.plist"];
NSLog(@"tmpfilename = %@",tmpfilename);

判断路径是否存在

1
2
3
4
5
6
7
8
9
//判断路径是否存在
if([[NSFileManager defaultManager] fileExistsAtPath:filename])
{
NSLog(@"文件存在");
}
else
{
NSLog(@"文件不存在");
}

AdHoc实际主要就是你可以发布版本,通过签名Profile指定这个版本能在哪些设备上运行(不超过100个)。这样你可以把版本直接发给你的测试人员,不需要经过AppStore。起到Beta测试的作用。

取得目标机器的UDID(Unique Device Identifier )

启动iTune,连接设备。选取设备,在Summary页面,可以看到Serial Number(序列号)。点击Serial Number(看上去是文字,实际可以点的),Serial Number就变成了UDID了。

下面的部分翻译自http://www.iphonedevsdk.com/forum/iphone-sdk-development/35818-unofficial-ad-hoc-distribution-guide.html

生成包含UDID的Provision file

1.到你的iPhone Provision Potral,首先把你需要支持的Devide的UDID都输入进去。

2.然后左边选 Provisioning,然后选Distribution,就到下面页面。按下面选择好。

3.然后下载这个Provision File,双击,自动加入到Xcode中。

编译你的工程

1.生成一个 entitlements plist 文件.

2.我的这个界面和图上不一样,没有这个get-task-allow,而是其他的一些东西。我就什么都没动。

3.在工程中“Get info”,选择Configurations,创建一个adhoc的Config。

4.然后回到Build页面,Configuration选择adhoc,在Code Signing组下面,Code Signing Entitlements设为你刚刚建立的文件。

5.Code Singing Identity用你正常发布的Provision

6.Any iPhone OS Device用你刚刚创建的adhoc的Provision。

7.最后Build你的应用,记着先Clean all Targets一下,然后你就可以在工程的Build目录下找到你的目标App了。

如何安装

把你的adhoc的Provision File和你刚刚生成的App文件发给你的Tester。
他需要打开iTunes,在Libary->Applicatione页面,把Provision文件和App文件拖进去。
连接设备,确认在设备的Apps下面,这个新app已经被选中(Default应该是选中的)

同步设备,App就安装上去了。

让状态栏显示网络等待标志

1
2
[UIApplication sharedApplication].networkActivityIndicatorVisible = YES; //显示  
[UIApplication sharedApplication].networkActivityIndicatorVisible = NO; //隐藏

状态栏是可以通过UIApplication类提供的一些方法来修改的,比如完全去掉状态栏或者修改风格,不过这些改变只是在你的程序内部,当你退出你的程序又会复原。

1
UIApplication *myApp = [UIapplication sharedApplication];

1.隐藏状态栏

1
[myApp setStatusBarHidden:YES animated:YES];

记得隐藏状态栏后的你的“桌面”就增加320×20的大小,所以最好是在任何window或者view创建之前隐藏它。
2.状态栏风格

1
2
3
4
5
6
[myApp setStatusBarStyle: UIStatusbarStyleBlackOpaque];  
typedef enum {
UIStatusBarStyleDefault,
UIStatusBarStyleBlackTranslucent,
UIStatusBarStyleBlackOpaque
} UIStatusBarStyle;

3.状态栏方向

1
2
3
4
5
6
7
8
9
10
11
[myApp setStatusBarOrientation:UIInterfaceOrientationLandscapeLeft animated:NO];  
typedef enum {
UIInterfaceOrientationPortrait = UIDeviceOrientationPortrait,
//竖屏,垂直向上
UIInterfaceOrientationPortraitUpsideDown = UIDeviceOrientationPortraitUpsideDown,
//竖屏,垂直方向上下颠倒
UIInterfaceOrientationLandscapeLeft = UIDeviceOrientationLandscapeRight,
//设备逆时针旋转到横屏模式
UIInterfaceOrientationLandscapeRight = UIDeviceOrientationLandscapeLeft
//设备顺时针旋转到横屏模式
} UIInterfaceOrientation;

有时候,需要在状态栏上显示一些自定义信息,比如新浪微博的官方iOS客户端:告知用户信息处于发送队列、发送成功或者发送失败。

通过在状态栏显示自定义信息,可以给用户友好又不影响软件使用的提示。
为此,我们显得定义一个自定义状态栏类,包含一个显示信息的Label:

1
2
3
4
5
6
7
8
9
@interface CustomStatusBar : UIWindow  
{
UILabel *_messageLabel;
}

- (void)showStatusMessage:(NSString *)message;
- (void)hide;

@end

接着,设置大小和系统状态栏一致,背景为黑色:

1
2
self.frame = [UIApplication sharedApplication].statusBarFrame;  
self.backgroundColor = [UIColor blackColor];

到这里,为了让自定义的状态栏可以让用户看到,还需要设置它的windowLevel。
在iOS中,windowLevel属性决定了UIWindow的显示层次。默认的windowLevel为UIWindowLevelNormal,即0.0。
系统定义了三个层次如下,具体可参考官方文档:

1
2
3
4
const UIWindowLevel UIWindowLevelNormal;  
const UIWindowLevel UIWindowLevelAlert;
const UIWindowLevel UIWindowLevelStatusBar;
typedef CGFloat UIWindowLevel;

为了能够覆盖系统默认的状态栏,我们把自定义的状态栏的windowLevel调高点:

1
self.windowLevel = UIWindowLevelStatusBar + 1.0f;

最后,为显示信息和隐藏添加一点无伤大雅的动画:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
- (void)showStatusMessage:(NSString *)message  
{
self.hidden = NO;
self.alpha = 1.0f;
_messageLabel.text = @"";

CGSize totalSize = self.frame.size;
self.frame = (CGRect){ self.frame.origin, 0, totalSize.height };

[UIView animateWithDuration:0.5f animations:^{
self.frame = (CGRect){ self.frame.origin, totalSize };
} completion:^(BOOL finished){
_messageLabel.text = message;
}];
}

- (void)hide
{
self.alpha = 1.0f;

[UIView animateWithDuration:0.5f animations:^{
self.alpha = 0.0f;
} completion:^(BOOL finished){
_messageLabel.text = @"";
self.hidden = YES;
}];;
}

Objective-C也需要这个,我真是用到了才去看,这叫遇到了才学,不主动,呵呵,废话少说,见代码

1
2
3
NSNumber* tempnumber = [NSNumber numberWithDouble:[[NSString stringWithFormat:@"%.2f",  
(float)(rand()%100001)*0.001f -20] doubleValue]];
cell.listProgressScore = [NSString stringWithFormat:@"%0.2f",[[detailDic valueForKey:@"current_index"] doubleValue]];
0%