加载中…
个人资料
real小辉侠
real小辉侠 新浪个人认证
  • 博客等级:
  • 博客积分:0
  • 博客访问:8,271
  • 关注人气:13
  • 获赠金笔:0支
  • 赠出金笔:0支
  • 荣誉徽章:
正文 字体大小:

IOS - 常用开发Tips(常用技巧三)

(2014-05-06 09:15:40)
标签:

ios-常用开发tips(常

it

分类: Mac/IOS那些事

消息提示框使用:
http://img.ph.126.net/Pp4FMEm70PdztOhI8YdOQA==/2380996827996263476.jpg常用开发Tips(常用技巧三)" />
文件进行操作:
             // 获取当前目录下得Currency.plist文件路径
            NSString *locationPath = [[NSBundle mainBundle] pathForResource:@"Currency" ofType:@"plist"];
            // 获取沙盒得路径
            NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
            NSString *strCopyPath = [paths objectAtIndex:0];
            // 将路径和取得得文件名组合成一个新路径
            NSString *strPath = [strCopyPath stringByAppendingPathComponent:@"Currency.plist"];
            // 文件管理
            NSFileManager *man = [NSFileManager defaultManager];
            NSError *error = nil ;
            // 开始复制
            [man copyItemAtPath:locationPath toPath:strPath error:&error];
            [man release];
            // 获取strCopyPath路径下的文件数组
            NSArray *array = [man contentsOfDirectoryAtPath:strCopyPath error:nil];
            [array count];
            // 判断文件是否存在
            if ([[NSFileManager defaultManager] fileExistsAtPath:self.savePath])
调用GPS位置:
            导入#import
            CLLocationManager *clLocationManager = [[CLLocationManager alloc] init];
            [clLocationManager setDesiredAccuracy:kCLLocationAccuracyBest];
            [clLocationManager setDelegate:self];  // deldegate
            [clLocationManager startUpdatingLocation];
            [clLocationManager release];
            - (void)locationManager:(CLLocationManager *)manager didUpdateToLocation:(CLLocation *)newLocation fromLocation:(CLLocation *)oldLocation {
                  [manager stopUpdatingLocation]; // 停止执行此方法
                  newLocation.coordinate.longitude; // 获取当前的经度
                  newLocation.coordinate.latitude;   // 获取当前的纬度
            }
获取UUID的值:
            CFUUIDRef uuidObj = CFUUIDCreate(nil);
            NSString *uuidString = (NSString *)CFUUIDCreateString(nil, uuidObj);
            CFRelease(uuidObj); // uuidString就是唯一得了
            [uuidString release];
ico图标有弧线:
            http://img.ph.126.net/pyWHwTW5sH3IuntyTiItZA==/2380996827996263477.jpg常用开发Tips(常用技巧三)" />
            例如这种,系统默认的是带ico图标中间带弧线。
            不加弧线的方法:
            在****-info.plist中添加一项:Icon already includes gloss effects 然后value的多选筐勾选住。
ico图标大小:
            1.iPhone -- 57*57
            2.iPhone4 -114*114
            3.iPad       --72*72
#pragma mark 获得时间戳
             - (NSString *)_generateTimestamp
                     return [NSString stringWithFormat:@"%d", time(NULL)];
#pragma mark 获得随时字符串
             - (NSString *)_generateNonce {
                    CFUUIDRef theUUID = CFUUIDCreate(NULL);
                    CFStringRef string = CFUUIDCreateString(NULL, theUUID);
                    NSMakeCollectable(theUUID);
                    return (NSString *)string;
              }
原文地址 :http://longjining.blog.163.com/blog/static/18317102820116635337586/

0

阅读 收藏 喜欢 打印举报/Report
  

新浪BLOG意见反馈留言板 欢迎批评指正

新浪简介 | About Sina | 广告服务 | 联系我们 | 招聘信息 | 网站律师 | SINA English | 产品答疑

新浪公司 版权所有