滴滴出行SDK的接入以及配置

2017-02-06  本文已影响1159人  沐泽sunshine

最近公司项目在做关于出行方面的功能,需要接入滴滴出行,但是滴滴出行开放平台没有提供Demo,只有简单的文档,所以就只能自己一点点的研究了,顺便写下了这篇文章记录一下接入的大概过程。

创建应用并下载SDK

导入并配置SDK

调用滴滴SDK

 - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {

[DIOpenSDK registerApp:DIAppID secret:DISecret];

return YES;

}
[DIOpenSDK showDDPage:self animated:YES params:nil delegate:self];

到此为止,就可以使用滴滴打车的基本功能了。

效果图.gif
   - (DITopNavigationTheme *)diopensdkTopNavigationTheme{
     DITopNavigationTheme *theme = [[DITopNavigationTheme alloc]init];
     theme.backgroundColor       = MainColor;
     theme.statusBarStyle        = UIStatusBarStyleLightContent;
     theme.titleTextColor        = [UIColor whiteColor];
     theme.titleFont             = [UIFont systemFontOfSize:18];
     theme.leftBtnsShowStyle     = DITopNavLeftBtnsShowStyleAlwaysShowBack;
     theme.backHighlightImage    = [UIImage imageNamed:@"backButton"];
     theme.backNormalImage       = [UIImage imageNamed:@"backButton"];

     return theme;
 }

这样就可以实现自定义滴滴出行页面的导航栏了。

效果图.gif
上一篇 下一篇

猜你喜欢

热点阅读