New Foursquare Venue Detail Map

New foursquare venue detail map

Here's the way I manage to reproduce it:-

You need a UIViewController with a UIScrollView as its view. Then, the content of the UIView you add to your scrollview should look like this :-

Sample Image
- The frame of the MKMapView have a negative y position. In this case, we can only see 100pts of the maps in the default state (before dragging).

- You need to disable zooming and scrolling on your MKMapView instance.

Then, the trick is to move down the centerCoordinate of the MKMapView when you drag down, and adjust its center position.

For that, we compute how much 1point represent as a delta latitude so that we know how much the center coordinate of the map should be moved when being dragged of x points on the screen :-

- (void)viewDidLoad {
[super viewDidLoad];
UIScrollView* scrollView = (UIScrollView*)self.view;
[scrollView addSubview:contentView];
scrollView.contentSize = contentView.frame.size;
scrollView.delegate = self;
center = CLLocationCoordinate2DMake(43.6010, 7.0774);
mapView.region = MKCoordinateRegionMakeWithDistance(center, 1000, 1000);
mapView.centerCoordinate = center;
//We compute how much latitude represent 1point.
//so that we know how much the center coordinate of the map should be moved
//when being dragged.
CLLocationCoordinate2D referencePosition = [mapView convertPoint:CGPointMake(0, 0) toCoordinateFromView:mapView];
CLLocationCoordinate2D referencePosition2 = [mapView convertPoint:CGPointMake(0, 100) toCoordinateFromView:mapView];
deltaLatFor1px = (referencePosition2.latitude - referencePosition.latitude)/100;
}

Once those properties are initialized, we need to implement the behavior of the UIScrollViewDelegate. When we drag, we convert the move expressed in points to a latitude. And then, we move the center of the map using the half of this value.

- (void)scrollViewDidScroll:(UIScrollView *)theScrollView {
CGFloat y = theScrollView.contentOffset.y;
// did we drag ?
if (y<0) {
//we moved y pixels down, how much latitude is that ?
double deltaLat = y*deltaLatFor1px;
//Move the center coordinate accordingly
CLLocationCoordinate2D newCenter = CLLocationCoordinate2DMake(center.latitude-deltaLat/2, center.longitude);
mapView.centerCoordinate = newCenter;
}
}

You get the same behavior as the foursquare app (but better: in the foursquare app, the maps recenter tends to jump, here, changing the center is done smoothly).


How do I get the foursquare venue ID from the new pretty url

In the righthand sidebar, there is a link to Claim the location. In the URL for that claim link, the "vid" parameter is the venue ID.

Historical Data On Foursquare Venue Changes

There's no way to access the old location information, but information should only get strictly better with time. If you have a situation where location information for a venue has become less accurate, you should flag the venue and the super user community will try to fix it.

Issues with map behind UIView, similar to FourSquare venue detail

As the above posters mentioned, it is difficult to give you any authoritative information without actually seeing some code for your project - and I'm aware that you have already found a workable solution. However, in case other users find this question with similar responses:

The nature of the error message suggests that you probably had some kind of memory leak in your application. The best way to start debugging this kind of problem is to use the Memory analysis tools found in Instruments.app. For some detailed information on how to do this, take a look at this link from the Apple Developer site.

Especially if some of the items which are scrolling on or off the screen have graphical information (background images, etc) associated with them - destroying things which are off-screen might help improve performance. You will, of course, then have to re-create the items in question when they come back on-screen.

If the above doesn't help, take a look at some of the following questions/answers, which provide insight into other problems where this error occurs. Perhaps your issue is/was related:

  • Unknown reason to receive Memory Warning

    1. Too many graphics open
    2. Not using Lazy-Loading
  • Iphone App crashing due to Received memory warning even if i am releasing

    • Check that Zombies isn't turned on (crashes faster in low-memory devices)
  • I received memory warning and my app crashed. Does it kill autorelease objects?

    • Improper allocation/release of objects and their scope

Foursquare API - venue search

Andreas has made a good example iphone project that hosted on github I tried it and it's working very well take a look at https://github.com/anka/bw_examples/tree/master/FoursquareIntegration

This may help you out.

Map with annotations pins like Foursquare, swift

You can achieve this by adding UICollectionView above MapView (use addSubview method or add in storyboard) and set background color of collection view to UIColor.clearColor. By this the collection view cell will look floating above the map view.



Related Topics



Leave a reply



Submit