MKMapView使导航栏变得透明

时间:2013-09-20 13:20:44

标签: mkmapview uinavigationbar ios7

我将现有的iOS 6应用程序移植到新的iOS 7中。但是当屏幕上出现MKMapView实例时,我的导航栏会失去其色彩。

重现的步骤:

  1. 打开Xcode;

  2. 创建新的Master-Detail应用程序;

  3. 将下一行添加为AppDelegate.m didFinishLaunchingWithOptions方法的第一行:

    [[UINavigationBar appearance] setBarTintColor:[UIColor redColor]]

  4. 将下一行添加到MasterViewController.m文件中:

    #import <MapKit/MapKit.h>

  5. 最后,将下一行添加到MasterViewController.m cellForRowAtIndexPath方法中:

    MKMapView *view = [[MKMapView alloc] initWithFrame:CGRectMake(0, 0, 100, 40)]; [cell.contentView addSubview:view];

  6. 构建并运行

  7. 结果如下:

    Ok Navigation bar got transparent Issued UI

    我做错了吗? 我该怎么做才能解决这个问题?

    我应该开始使用Google Maps API吗?

2 个答案:

答案 0 :(得分:0)

现在似乎已修复(最新的ios-Version)。我在模拟器和设备上都没有收到错误。

答案 1 :(得分:0)

在使用之前定义mapview的大小(宽度,高度),如果不能正常工作,那么在popviewcontroller中使用启用的导航控制器可以帮助你

相关问题