高德地图API使用

引入头文件

1
2
#import <AMapFoundationKit/AMapFoundationKit.h>
#import <AMapLocationKit/AMapLocationKit.h>

调用方法

 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
NSString *strKey = @"2d8a96d668576584acebf2bab0ba0c08";//默认值
//配置里面取值
NSString *strBundleKey = [[NSBundle mainBundle] infoDictionary][@"IOSPostionkey"];
if (strBundleKey) {
    strKey = strBundleKey;
}
[AMapServices sharedServices].apiKey = strKey;

// 带逆地理信息的一次定位(返回坐标和地址信息)
self.GaodelocationManager = [[AMapLocationManager alloc] init];
[self.GaodelocationManager setDesiredAccuracy:kCLLocationAccuracyHundredMeters];
//   定位超时时间,最低2s,此处设置为2s
self.GaodelocationManager.locationTimeout =10;
//   逆地理请求超时时间,最低2s,此处设置为2s
self.GaodelocationManager.reGeocodeTimeout = 10;
//设置不允许系统暂停定位
[self.GaodelocationManager setPausesLocationUpdatesAutomatically:NO];
//    //设置允许在后台定位
//    [locationManager setAllowsBackgroundLocationUpdates:YES];
//设置允许连续定位逆地理
[self.GaodelocationManager setLocatingWithReGeocode:YES];
//    [locationManager setDelegate:self];
// [self.locationManager startUpdatingLocation];
//    // 带逆地理(返回坐标和地址信息)。将下面代码中的 YES 改成 NO ,则不会返回地址信息。
[self.GaodelocationManager requestLocationWithReGeocode:YES completionBlock:^(CLLocation *gaodeLocation, AMapLocationReGeocode *regeocode, NSError *error) {

    if (gaodeLocation==nil) {
        NSLog(@"高德没有返回地理位置,使用苹果官方定位经纬度");
        [self GetGISInfoByByLocationWithjingdu:jingdu AndWeidu:weidu];
        return ;
    }

    if (error)
    {
        NSLog(@"locError:{%ld - %@};", (long)error.code, error.localizedDescription);

        if (error.code == AMapLocationErrorLocateFailed)
        {
            NSLog(@"AMapLocationErrorLocateFailed高德没有返回地理位置,使用苹果官方定位经纬度");
            [self GetGISInfoByByLocationWithjingdu:jingdu AndWeidu:weidu];
            return;
        }
    }

    NSLog(@"使用高德location:%@", gaodeLocation);
    NSString * gaodeWeidu =  [NSString stringWithFormat:@"%.9f",gaodeLocation.coordinate.latitude];
    NSString * gaodeJingdu =  [NSString stringWithFormat:@"%.9f",gaodeLocation.coordinate.longitude];
    if (regeocode)
    {
        NSLog(@"reGeocode:%@", regeocode);
        self.theRealAdress = regeocode.formattedAddress;
    }
    [self GetGISInfoByByLocationWithjingdu:gaodeJingdu AndWeidu:gaodeWeidu];
}];

终端实现预览plantuml的插件

{% github weirongxu plantuml-previewer.vim bf4b3e5 width = 30% %}

安装依赖

1
2
3
Plug 'it-boyer/plantuml-syntax'  "plantuml语法高亮 Plug 'aklt/plantuml-syntax'
Plug 'tyru/open-browser.vim'
Plug 'weirongxu/plantuml-previewer.vim' "在线工具:http://sujoyu.github.io/plantuml-previewer/

Graphviz

下载地址

汉字拼音排序方法

{% github it-boyer sortChinese 2deab8b width = 30% %}

方法一

实现模型对象排序,当万条数据时,出现卡顿问题。

方法二

实现字符串数组的排序,暂时没有验证大量排序情况,尝试优化第一种方法的排序卡顿问题。

Git工具交互式暂存

交互式暂存

Git 自带的一些脚本可以使在命令行下工作更容易。 本节的几个互交命令可以帮助你将文件的特定部分组合成提交。 当你修改一组文件后,希望这些改动能放到若干提交而不是混杂在一起成为一个提交时,这几个工具会非常有用。 通过这种方式,可以确保提交是逻辑上独立的变更集,同时也会使其他开发者在与你工作时很容易地审核。 如果运行 git add 时使用 -i 或者 –interactive 选项,Git 将会进入一个交互式终端模式,显示类似下面的东西:

Otherlinkerflags设置ld命令执行的参数

Other linker flags设置的值实际上就是ld命令执行时后面所加的参数。

3个常用参数: -ObjC:加了这个参数后,链接器就会把静态库中所有的Objective-C类和分类都加载到最后的可执行文件中 -all_load:会让链接器把所有找到的目标文件都加载到可执行文件中,但是千万不要随便使用这个参数!假如你使用了不止一个静态库文件,然后又使用了这个参数,那么你很有可能会遇到ld: duplicate symbol错误,因为不同的库文件里面可能会有相同的目标文件,所以建议在遇到-ObjC失效的情况下使用-force_load参数。 -force_load:所做的事情跟-all_load其实是一样的,但是-force_load需要指定要进行全部加载的库文件的路径,这样的话,你就只是完全加载了一个库文件,不影响其余库文件的按需加载.

iOS插件化开发之Small

{% github it-boyer SmallDemo 5931b43 width = 30% %}

官网 small是android与iOS平台比较出名的轻巧的跨平台插件化框架,也正是被这一点吸引,决定将small应用到集团内部的应用引擎模块化方案中,本篇博文主要讲述本人基于small在iOS平台实现的定制化APP方案(运营自由配置、自由组合、自动打包)~ 特性与功能

当项目过大需要通过SSH方式Clone

设置全局提交信息

1
2
    git config --global user.email "you@example.com"
    git config --global user.name "Your Name"

修改最后一次提交的用户名信息

``git git config user.name ‘wangz’ git config user.email ‘wangz@alib.com’ git commit –amend –author=wangz

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
### 项目过大问题
>git clone 主工程出现 fatal: The remote end hung up unexpectedly3)

通常的解决办法:
1. 设置提交缓存的大小为 1G:1048576000
    git config http.postBuffer 1048576000

2. 否则,需要配置github/gitlab的公钥
    生成:`ssh-keygen -t rsa -C "$your_email"`
    拷贝:`pbcopy < ~/.ssh/id_rsa.pub`
    创建SSHKey:
    在github/gitlab新建公钥`add SSH Key`:粘贴到密钥文本框中即可。
    

隐藏导航条底部黑线

当需要导航条为透明色,与背景色一体时,需要去除底边线: 如下代码:使用空图片设置背景图,并指定bar的样式。

1
2
self.navigationController.navigationBar setBackgroundImage:[UIImage new] forBarMetrics:UIBarMetricsDefault];
self.navigationController.navigationBar.barStyle = UIBarStyleBlackTranslucent;