Skip to content

Maps Pins do not display when PM Nav Bar is enabled #39

@serialbandicoot

Description

@serialbandicoot

This is the weirdest issue I've seen with PM::MapScreen and how it interacts with the nav bar.

class Home < PM::Screen
  title 'Map Screen'
  nav_bar true

  def on_load
    map_view = MyMapScreen.new
    rmq.add_subview(map_view.view).style do |st|
      st.frame = {t: 100, w: device.width, h: 200}
    end
  end
end

In the MyMapScreen the annotations have been added and the pins setup correctly. However they don't display!

When I remove the nav_bar true, hey presto the pins appear!

I've tried all sorts of ways to fix this, manually adding a nav_bar:

UINavigationController.alloc.initWithRootViewController(self)
nav = self.navigationController.navigationBar
nav.frame = CGRectMake(0, 0, device.width, 70)

Or

navigation = UINavigationBar.alloc.initWithFrame(CGRectMake(0, 0, device.width, 70)) Anyway I've ended up going with the following and ditching PM Maps.

map_view = MKMapView.alloc.init
map_view.delegate = self
map_view.frame = CGRectMake(5, 80, device.width - 10, 200)
region = MKCoordinateRegionMake(CLLocationCoordinate2D.new(50.85, 4.35), MKCoordinateSpanMake(8, 8))
map_view.setRegion(region)
Beer::All.each { |beer| map_view.addAnnotation(beer) } #lifted from Samples
rmq.add_subview(map_view)

I'm not sure if anyone has had this issue, or similar, if so pls let me know, it would be nice to use the awesome map library.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions