MKMapView makes the navigation bar gets transparent

狂风中的少年 提交于 2020-01-29 02:54:25

问题


I am porting my existing iOS 6 application to the new iOS 7. But whenever a MKMapView instance appears into the screen, my navigation bar loses its tint color.

Steps to reproduce:

  1. Open Xcode;

  2. Create a new Master-Detail Application;

  3. Add the next line as the first one of the AppDelegate.m didFinishLaunchingWithOptions method:

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

  4. Add the next line to the MasterViewController.m file:

    #import <MapKit/MapKit.h>

  5. Finally, add the next lines to the MasterViewController.m cellForRowAtIndexPath method:

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

  6. Build and Run

These are the results:

Am I doing something wrong? What can I do to fix this issue?

Should I start using the Google Maps API instead?


回答1:


Seems like this is fixed now (newest ios-Version). I got the error neither in the simulator nor on the device.




回答2:


dfine the size(width,height) of mapview before you use it and if not work then use it with enabled navigation controller in mapviewcontroller this may help you



来源:https://stackoverflow.com/questions/18917888/mkmapview-makes-the-navigation-bar-gets-transparent

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!