infinitered / infinitered/ProMotion-map
Maps Pins do not display when PM Nav Bar is enabled
- Dominant language
- Ruby
- Stars
- 13
- Forks
- 11
- PR merge metrics
- No merged PRs in 30d
Description
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.
Contributor guide
No contributing guide indexed for this repository
Research direction
Start at PM::MapScreen and the PM::Screen/Home example, reproducing the issue with nav_bar true and comparing it with the working direct MKMapView setup. Trace how annotations are added and displayed when the navigation bar is enabled; done means map pins render without requiring the reported workaround.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- ruby
- Domain
- mobile
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100