Git Product home page Git Product logo

calloutview's People

Contributors

1ec5 avatar adamcohenrose avatar adlai-holler avatar alvarhansen avatar dmiedema avatar friedbunny avatar incanus avatar karsten-rohweder-intive avatar kimar avatar mars271 avatar nfarina avatar rousseauo avatar u10int avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

calloutview's Issues

Open Source License Not Specified.

I'd like to use this in a work related project but you haven't specified what license it's available under so I have no clue if I'm able to do so. Would you be able specify what open source license this code is available under in the project? Thanks in advance.

Blurred callout on non-retina devices

Might not be a frequent thing, but under some circumstances the callout origin's x or y coordinate can end up being a fraction (.5). This is fine on retina devices, but causes the callout to be blurry on non-retina devices.

(Note: the rect I pass to presentCalloutFromRect: has integer values, so that can't be the cause)

I found that typecasting the origin's x and y coordinate to integer solves this:

CGPoint calloutOrigin = {
    .x = (int)(calloutX + adjustX),
    .y = bestDirection == SMCalloutArrowDirectionDown ? 
        (int)(anchorY - self.calloutHeight + BOTTOM_ANCHOR_MARGIN) :
        (int)anchorY
};

The callouts always look fine this way - but I wonder, if this does any harm.

Accessory tappable area smaller than Apple's native callout

Hi Nick,

I really like your SMCalloutView class and I'd like to use it. One quick question though, is it possible to increase the tappable area of the left/right accessory views?

The tappable area seems to be smaller than the tappable area that Apple provides in their callout. Apple treats a tap within the accessory margin and/or view as a tap on the accessory, whereas the SMCalloutView only seems to process taps within the (somewhat small) accessory view itself.

Because of the small area of the SMCalloutView accessory view, in our testing the users wind up dismissing the callout when they mean to tap on the detail disclosure.

Other than that issue, SMCalloutView is fantastic and perfect for our needs.

Thanks for any help/info/suggestions,

Justin

testing of background methods

I'm up to date on master and here's what I found with https://github.com/mapbox/mapbox-ios-sdk testing:

  • Using the new default, drawn background has some performance issues with rapid pinch-zooming of the map in our usage. Might be related, but during zooms, since annotations can move, I repeatedly call presentCalloutFromRect… on the already-visible callout to adjust it's attach point to follow the annotation.
  • Using the image background does not provide the actual images by default.
  • Using [SMCalloutBackgroundView systemBackgroundView] background works like before with no problems.

AppDelegate.m (CalloutViewSamples project)

Hi,
in the AppDelegate.m at line 56 you create a button to be added to the callout. But this button is actually never added and the right accessory view of the map only works because it uses the same button as the one from the mars. This isn't actually a problem here because both buttons do the same but the example is kinda hard to understand there (took me some time to figure out why there was a button that wasn't ever added to the callout and in my project nothing happened :-))

Calloutview anchor doesn't shows precisely on Pin view

Hello, nfarina, thanks for developing this nice api for us to use.

But now I'm facing a little strange problem with it, I think it's not a bug,
but still wish getting some assist from you.

I tried to add callout view to show on the MKPinAnnotationView.
but the anchor doesn't show really precisely on the pin, it just moved a little bit behind it.

2013-08-14 12 14 12

But it should show like this:

2013-08-14 12 15 30

Do you have any suggestions?
thank you

Update Podspec

Hi,

Can you update your podspec to include the lastest commit with stretchable backgrounds?

Thanks

-Matt

Update title/subtitle of current displayed calloutview

I working on a project that need to group annotation on the map. and when the number of annotation change, I expect to update the title/subtitle on current displayed calloutview.

I use to set title and subtitle, but that is not work. because the attribute of property is copy.

I also try another way, is dismiss and present, it work if I am not navigation map to another region, but if I change it will navigation map back to selected annotation.

I wonder how could I update title/subtitle to current callout view for selecting annotation.

Regards,
Ratha

Form like callout, touch events forwarding.

What I am trying to achieve is essentially a simple callout, which is actually a form where user enters some data. There are two text fields, one segmented control and one button. So the user taps the pin, callout appears, user types in the data required, presses a button and "it just works", except it doesn't really. Seems like map view interferes with taps quite heavily not allowing me to do pretty much anything when the callout it tapped. And since the default action, when user taps the callout, is to make it disappear, that is all I get.

I have a custom subclass of MKPinAnnotation called PlaceCreatorAnnotation

http://pastebin.com/f9N5KTA7

So I read the header in the sample project, which says that I should override hitTest in order to make things behave correctly in terms of touch delivery. As you can see I changed self.calloutView to self.calloutView.contentView. Why? In case of just self.calloutView the result is pretty much the same, whenever I click on a callout, map view treats it as deselection, and dismisses the callout. If on another hand I go for self.calloutView.calloutView, then it kinda seems to work. Why kinda? Well, button and segmented control at least change their appearance on tap, I don't know if they send the action yet, but they get something. What is really interesting that tap on any of the text views, seems to work for a split second, as I can see the keyboard starting to appear. But after it appears completely, again, for some reason map decides to deselect the pin, dismiss the keyboard and the callout.

How do I create the callout ?

Code :

http://pastebin.com/ZiQ5BGik

I don't know how to make it format properly on github.

So the question is how do I make sure that map does not decide to unselect the annotation. Inside the call back methods like did select annotation view, did deselect annotation view, its too late to determine where the user tapped on the screen, so I can't really make the right decision from there.

Customizing calloutview

Hi
I want to change the margin between calloutview and content view, and margin between text and its boarder.
as you see in the below picture this margin is a lot

how can I achieve that?

Screen Shot 2013-02-14 at 3 28 38 PM

presentCalloutFromRect inLayer not working

Hello and thank you for your great library.

I have a problem using a disclosure button along with the SMCalloutView. More specifically, I have added a UIButton as a rightAccessoryView to my SMCalloutView object.

Everything works fine when I use presentCalloutFromRect:inView. The button is clickable and performs the desired actions.

When I change to presentCalloutFromRect:inLayer (which is what I want), the callout view is displayed correctly, but the disclosure button is not touchable.

The only thing I change is the call to the above methods.

Could you please help me figure it out?

Thank you in advance.

Touching custom contentView will close the calloutView

Using the "standard" view (with title + subtitle), if I tap the callout view, nothing will happen (or calloutViewClicked will be called, if the delegate is implemented).
However if I set a custom contentView to my calloutView and then tap that custom view, the calloutView won't handle the touch. Instead, the map will dismiss it.

How can I avoid this behavior and prevent the callout view from hiding?

Right accessory view tap is not working...

Hello All,

I am using currently SMCalloutViews, in my project but right accessory view is not getting tapped, its showing fine, but for some reason its not working i don't know why, can you help NFarina??
I am no�t using ARC in my Project. Further its an array of SMCalloutViews from which i show the one selected.
What could be the reason ??

Thanks
iOS Guy.

SMCalloutView doesn't replace standard callout view.

Hello,

I tried to used SMCalloutView in my project but run into some problem. SMCalloutView doesn't replace standard callout view. Please look at screenshot.

callout_problem

I has MapViewController subclass of UIViewController with MKMapViewDelegate protocol and MKMapView mapView as property inside. And mapView: viewForAnnotation: method like:

- (MKAnnotationView *)mapView:(MKMapView *)pMapView viewForAnnotation:(id <MKAnnotation>)annotation
{
    if ([annotation isKindOfClass:[MKUserLocation class]])
        return nil;  //return nil to use default blue dot view

    static NSString* AnnotationIdentifier = @"AnnotationIdentifier";
    MKAnnotationView* customPinView = (MKAnnotationView *)[pMapView dequeueReusableAnnotationViewWithIdentifier:AnnotationIdentifier];

    if (!customPinView)
    {
        customPinView = [[MKAnnotationView alloc] initWithAnnotation:annotation reuseIdentifier:AnnotationIdentifier];

        customPinView.canShowCallout = YES;

        UIButton* rightButton = [UIButton buttonWithType:UIButtonTypeDetailDisclosure];
        customPinView.rightCalloutAccessoryView = rightButton;
    }

    customPinView.annotation = annotation;

    if ([annotation isKindOfClass:[POI class]])
    {
        POI *poi = (POI*)annotation;

        NSString *image_name = @"";

        if ([poi.ID isEqualToString:SEARCH_CENTER_ID_STRING] || [poi.ID isEqualToString:USER_ADDED_ID_STRING])
        {
            customPinView.rightCalloutAccessoryView = nil;
            customPinView.image = [UIImage imageNamed:@"custom_pin_sc.png"];
        }
        else
        {
            //set right image name for another cases
            image_name = …

            customPinView.image = [UIImage imageNamed:image_name];
        }
    }

    return customPinView;
}

And after I make MapViewWithCustomCallouts subclass of MapViewController with SMCalloutViewDelegate protocol.

Here is MapViewWithCustomCallouts.m :

#import "MapViewWithCustomCallouts.h"
#import "CalloutBodyView.h"

@interface MapViewWithCustomCallouts ()

@end

@implementation MapViewWithCustomCallouts

#pragma mark - Lazy instantiation

- (SMCalloutView *)calloutView
{
    if (!_calloutView)
    {
        _calloutView = [SMCalloutView new];
        _calloutView.delegate = self;
    }

    return _calloutView;
}

#pragma mark - MKMapView

- (void)mapView:(MKMapView *)mapView didSelectAnnotationView:(MKAnnotationView *)view
{
    // dismiss out callout if it's already shown but on a different parent view
    if (self.calloutView.window)
        [self.calloutView dismissCalloutAnimated:NO];

    [self performSelector:@selector(popupMapCalloutViewForView:) withObject:view afterDelay:1.0/3.0];
}

- (void)mapView:(MKMapView *)mapView didDeselectAnnotationView:(MKAnnotationView *)view
{
    [self.calloutView performSelector:@selector(dismissCalloutAnimated:) withObject:nil afterDelay:1.0/3.0];
}

#pragma mark - SMCCallout View

- (void)popupMapCalloutViewForView: (MKAnnotationView *)view
{
    //load callout body view from nib
    CalloutBodyView *calloutBodyView = [CalloutBodyView calloutBodyView];

    calloutBodyView.titleLabel.text = @"THOMAS";
    calloutBodyView.subTitleLabel.text = @"huemas";

    calloutBodyView.imgView.imageURL = [NSURL URLWithString:@"http://kittybloger.files.wordpress.com/2012/05/cats-in-the-hats-15-amazing-pictures-5.jpg"];

    self.calloutView.contentView = calloutBodyView;
    self.calloutView.backgroundView = nil; // reset background view to the default SMCalloutDrawnBackgroundView

    // just to mix things up, we'll present the callout in a Layer instead of a View. This will require us to override
    // -hitTest:withEvent: in our CustomMapView subclass.
    [self.calloutView presentCalloutFromRect:view.bounds
                                 inView:view
                      constrainedToView:self.mapView
               permittedArrowDirections:SMCalloutArrowDirectionAny
                               animated:YES];
}

@end

So, can you tell me there is a problem?

Thank you in advance for answer!

problem in coordinating MSCallOutView in ScrollView

I have a strange problem!
I have a Label with attributed text. and I can target MSCallOutView to target links. everything works well.

but when I add the label to the scroll view popover has a strange behavior and most of the time targets a constant position! or sometimes target another position.

I was amazed how its happening and worked on that a lot solve the problem but couldn't reach any solution.
I have attached the sampleCode may you see it:
works well:
http://upload.ugm.ac.id/194worksWell.zip

after adding the label to the scrollView:
link updated
http://upload.ugm.ac.id/541worksBad.zip

Callout direction not rendering properly, as of latest version.

Hi,

I've update to the latest (as of earlier to day), and now the callout direction is being rendered incorrectly when it switches. It was working, but now isn't. See the green circle; as I drag the element to the top of the screen, the callout is correctly rendered below the bounding box of the circle, but it is now upside down.

Joe

Screen Shot 2013-02-17 at 20 27 48
Screen Shot 2013-02-17 at 20 28 02

calloutview in iPad Calendar.app

Hi Nick!

Your implementaion of the calloutview is almost identical to calloutview that it used in iPad's Calendar.app.

Calendar callout view

The main difference is showing / hiding animation. You can see that if go to Calendar, to month view and then tap next or previous year button at the bottom of the screen.

Basically when tap next year button, callout is shown with linear animation and the is hidden with exactly the same linear animation but in the opposite direction :D

But when you tap previous year button, view is shown with bounce animation with overshoot, just like in Maps.app, and the is hidden with simple alpha animation.

I think that's good idea to implement some other types of showing / hiding animations:

  • with bounce (overshoot)
  • linear (scale from 0.001 to 1.0)
  • alpha (0 to 1)

or event some delegate method to privide custom CAAnimation

I can handle it, but want to ask what do you think?

Static layout doesn't appear to layout with custom title views very well.

What are your plans for having a more dynamic kind of layout?

I'm having trouble using titleView with my own views, mainly because the callout appears to have a static height constraint.

I'm happy to put some work into fixing this, but I would like to know what your thoughts are first, as there is no point developing anything that you would not consider pulling back into your code.

Thanks,
Joe

RUN ERROR

I can not run demo application (Samples):

/calloutview-master 2/SMCalloutView.h:21:47: Expected ';' after top level declarator

/calloutview-master 2/SMCalloutView.h:54:31: Unknown type name 'SMCalloutAnimation'

private API reference?

Great job on this; looking forward to integrating it into the MapBox iOS SDK.

One question though: are you aware if any apps have been rejected since your source code references UICalloutView? I know it doesn't actually call it, but with rejections, you never know when they will shoot you down.

ContentView display issue

It seems there is a problem when using SMCalloutView with ContentView. There is confusion between the heights, widths and margins I think. Attached screenshots.

I intentionally put the yellow background color of the contentView

I would have liked an equal margin around the contentView and right accessory view well right of the callout view..

See this repository for a example : https://github.com/iDevelopper/TestSMCallout.git

Best regards,

Patrick

present calloutView immediately after dismiss it with animation will cause error

the code:

[calloutView dismissCalloutAnimated:YES];
[calloutView presentCalloutFromRect:rect inView:self constrainedToView:self permittedArrowDirections:SMCalloutArrowDirectionAny animated:YES];

I get dismiss animation, but the dismiss animation will not complete, and the present animation will start. After some seconds, I think that after dismiss animation's duration, the calloutView will remove from super view:

- (void)animationDidStop:(CAAnimation *)anim finished:(BOOL)finished {
    BOOL presenting = [[anim valueForKey:@"presenting"] boolValue];

    if (presenting) {
        if ([_delegate respondsToSelector:@selector(calloutViewDidAppear:)])
            [_delegate calloutViewDidAppear:self];
    }
    else if (!presenting) {

        [self removeFromParent]; // it will be remove, although I present it.
        [self.layer removeAnimationForKey:@"dismiss"];

        if ([_delegate respondsToSelector:@selector(calloutViewDidDisappear:)])
            [_delegate calloutViewDidDisappear:self];
    }
}

How should I do for it?

Please add semantic version tags

I’ve recently added SMCalloutView to the CocoaPods package manager repo.

CocoaPods is a tool for managing dependencies for OSX and iOS Xcode projects and provides a central repository for iOS/OSX libraries. This makes adding libraries to a project and updating them extremely easy and it will help users to resolve dependencies of the libraries they use.

However, calloutview doesn't have any version tags. I’ve added the current HEAD as version 0.0.1, but a version tag will make dependency resolution much easier.

Semantic version tags (instead of plain commit hashes/revisions) allow for resolution of cross-dependencies.

In case you didn’t know this yet; you can tag the current HEAD as, for instance, version 1.0.0, like so:

$ git tag -a 1.0.0 -m "Tag release 1.0.0"
$ git push --tags

greatly reduced performance during presentCalloutFromRect:...

Related issue: mapbox/DEPRECATED-mapbox-ios-sdk#421

This might not necessarily be a primary concern of this library, but I wanted to flag it.

One thing we do over in my project is to move the callout with the map's pan and zoom. On pan, the callout's layer is just moved around; no big deal. But on zoom, we repeatedly call -presentCalloutFromRect:inLayer:constrainedToLayer:animated: when the callout is on a vector shape in order to adjust the callout position in a more dynamic way than for simple points.

In the new iOS 7 version as of 58ce460, calling this has much higher overhead since it works its way down to -[SMCalloutMaskedBackgroundView contentMask], which in turn calls -[CALayer renderInContext:].

I'm not sure how much trouble this is, but I'm going to look into modifying my library to possibly not reposition this way.

Nice job + a little comment

Nice job! :) It looks really nice!

I think that it would be fairly easy to implement this using CoreGraphics though. The performance would probably be better, and it's be easier to position the arrow and animate :)

I'll do this when I have time, and we can compare :) using CoreGraphics is obviously a much more complex implementation, and will take me longer, but it'll be interesting to see the tradeoff.

layer animation issue when dismissing

Thanks for the layer-based support in b9631ff -- it's working great except for one thing.

If I do an animated dismiss, I see the default fade out, but then a quick flash re-appearance of the callout for a moment before it disappears again. I don't see this with your demo app and a view-based approach, regardless of whether I animate the dismissal or not.

I'm digging into this now, but figured you might have an inkling of where this is happening. I think it might have something do with a lack of removeFromSuperlayer during the dismiss animation?

How to use SMCalloutView with MKMapView

Hi
I'd like to use SMCalloutView with MKMapView (I'd like to customize the callout in my app).
and showing SMCalloutView instead of UICalloutView for multiple MKAnnotation/MKPinAnnotationView.

Could you please help me, or give me a hint, what I'm doing wrong or what I'm missing here.

So far I defined two classes, one for the annotation and one for the view:

@interface MapAnnotation : NSObject <MKAnnotation>
@property (nonatomic, copy) NSString *title, *subtitle;
@property (nonatomic, assign) CLLocationCoordinate2D coordinate;
@end

@interface CustomPinAnnotationView : MKPinAnnotationView
@property (strong, nonatomic) SMCalloutView* calloutView;
@end

the implementation of CustomPinAnnotationView

@implementation CustomPinAnnotationView
- (UIView *)hitTest:(CGPoint)point withEvent:(UIEvent *)event {
    UIView *calloutMaybe = [self.calloutView hitTest:[self.calloutView convertPoint:point fromView:self] withEvent:event];
    if (calloutMaybe) {
        return calloutMaybe;
    }
    return [super hitTest:point withEvent:event];
}
@end

in viewDidLoad I create an SMCalloutView as instance variable and I'm adding two annotation:

    _calloutView = [[SMCalloutView alloc] init];
    _calloutView.delegate = self;


    MapAnnotation *anno1 = [[MapAnnotation alloc] init];
    anno1.coordinate = CLLocationCoordinate2DMake(47.388154, 41.604200);
    anno1.title = @"Pin 1";
    anno1.subtitle = @"Pin 1";
    [_mapView addAnnotation:anno1];

    MapAnnotation *anno2 = [[MapAnnotation alloc] init];
    anno2.coordinate = CLLocationCoordinate2DMake(58.588154, 24.804200);
    anno2.title = @"Pin 2";
    anno2.subtitle = @"Pin 2";
    [_mapView addAnnotation:anno2];

the views for CustomPinAnnotationView are instantiated in

- (MKAnnotationView *)mapView:(MKMapView *)mapView viewForAnnotation:(id<MKAnnotation>)annotation {
...
if ([annotation isKindOfClass:[MapAnnotation class]]) {
        static NSString* identifier = @"MapAnnotation";
        CustomPinAnnotationView *annotationView = (CustomPinAnnotationView*)[self.mapView dequeueReusableAnnotationViewWithIdentifier:identifier];
        if (!annotationView) {
            annotationView = [[CustomPinAnnotationView alloc] initWithAnnotation:annotation reuseIdentifier:identifier];
        } else {
            annotationView.annotation = annotation;
            [annotationView setNeedsDisplay];
        }
        return annotationView;
    }
...

and finally here I'm showing the _calloutView above the selected pin

- (void)mapView:(MKMapView *)mapView didSelectAnnotationView:(MKAnnotationView *)view {
    if (_calloutView.window) {
        NSLog(@"window=%@", _calloutView.window);
        [_calloutView dismissCalloutAnimated:NO];
    }
    if ([view isKindOfClass:[CustomPinAnnotationView class]]) {
        CustomPinAnnotationView* bottomPin = (CustomPinAnnotationView*)view;
        bottomPin.calloutView = _calloutView; //for handling the disclosure click
        _calloutView.calloutOffset = bottomPin.calloutOffset;
        _calloutView.title = bottomPin.annotation.title;
        _calloutView.subtitle = bottomPin.annotation.subtitle;

        UIButton *bottomDisclosure = [UIButton buttonWithType:UIButtonTypeDetailDisclosure];
        [bottomDisclosure addGestureRecognizer:[[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(disclosureTapped)]];
        _calloutView.rightAccessoryView = bottomDisclosure;

        [_calloutView presentCalloutFromRect:bottomPin.bounds
                                      inView:bottomPin
                           constrainedToView:_mapView
                    permittedArrowDirections:SMCalloutArrowDirectionAny
                                    animated:YES];
    }
}

- (void)mapView:(MKMapView *)mapView didDeselectAnnotationView:(MKAnnotationView *)view {
    NSLog(@"didDeselectAnnotationView");
    // again, we'll introduce an artifical delay to feel more like MKMapView for this demonstration.
    [_calloutView performSelector:@selector(dismissCalloutAnimated:) withObject:nil afterDelay:1.0/3.0];
}

unfortunately that doesn't really work.
Touching an other pin, after the first animates the callout in, but closes it immediately
A second touch on the same pin doesn't show the callout.

looking for your help,
regards,
Flori

Touch title will be ignored :(

the code:

- (BOOL)pointInside:(CGPoint)point withEvent:(UIEvent *)event {
    // we want to match the system callout view, which doesn't "capture" touches outside the accessory areas. This way you can click on other pins and things *behind* a translucent callout.
    return
        [self.leftAccessoryView pointInside:[self.leftAccessoryView convertPoint:point fromView:self] withEvent:nil] ||
        [self.rightAccessoryView pointInside:[self.rightAccessoryView convertPoint:point fromView:self] withEvent:nil] ||
        [self.contentView pointInside:[self.contentView convertPoint:point fromView:self] withEvent:nil] ||
        (!self.contentView && [self.titleView pointInside:[self.titleView convertPoint:point fromView:self] withEvent:nil]) ||
        (!self.contentView && [self.subtitleView pointInside:[self.subtitleView convertPoint:point fromView:self] withEvent:nil]);
}

I think that if I set the title, the contentView and titleView will be nil! So this method will get NO when I touch the title!!

Please check it, thanks.

Separate UIView (SMFrameAdditions) Category Into it's Own Header and Implementation Files

I just found this repo, and I've gotta say, "This is really great stuff!"

Regarding the "custom_drawn_bg" branch, perhaps it would be better to separate the "UIView (SMFrameAdditions)" category into its own header and implementation files?

That is, this category is pretty useful on its own even!

This also has the benefit that doing such would allow the "UIView+SMFrameAdditions.h" to be added to a project's precompiled header, .pch, file, which would ensure that Xcode sees it in all classes as you're working within the IDE... as the existence of the category's implementation actually affects all classes importing the UIView class already anyways.

Demo: Example project for Google Maps iOS SDK

Not so much an issue, but I put together a demo project which may help others trying to integrate SMCalloutView with the new Google Maps iOS SDK.

Their SDK allows specifying a custom view for a callout, but it handles the positioning and displaying of that view for you - so you miss out on the 'bounce' display animation, and controls within the view did not work. I had to resort to displaying and moving the callout manually with the map delegate calls the SDK provides.

UITableView cann't scroll in contentView in google map

I want to customize a popview instead of standard view in google map.So I create a UITable and set this table to contentView. But the table in popview cann't scroll.Someone can help me?
The code like:

  • (UIView *)mapView:(GMSMapView *)mapView markerInfoWindow:(GMSMarker *)marker {
    CLLocationCoordinate2D anchor = marker.position;
    CGPoint point = [mapView.projection pointForCoordinate:anchor];

//just for test
[self.calloutView.contentView addSubview:[[TableViewController alloc] init].view] ;
CGRect calloutRect = CGRectZero;
calloutRect.origin = point;
calloutRect.size = CGSizeZero;

[self.calloutView presentCalloutFromRect:calloutRect
                                  inView:mapView
                       constrainedToView:mapView
                permittedArrowDirections:SMCalloutArrowDirectionDown
                                animated:YES];

return self.calloutView;

}

Current Country

Hi,

How could I show just the current country on the map not whole MAP for worldwide ?

Appreciated

contentView should be resized to fit within callout view

We are using a variable width contentView (sized to fit text labels and other content). When SMCalloutView resizes itself to fit within the parent view (e.g., MKMapKit), it should resize the contentView as well. Here is a patch for the private presentCalloutFromRect method that adjusts the contentView's width to fit (we did not try to use a dynamic height):

@@ -220,16 +220,25 @@ NSTimeInterval kSMCalloutViewRepositionDelayForUIScrollView = 1.0/3.0;
     [self rebuildSubviews];

     // apply title/subtitle (if present
     titleLabel.text = self.title;
     subtitleLabel.text = self.subtitle;

     // size the callout to fit the width constraint as best as possible
     self.$size = [self sizeThatFits:CGSizeMake(constrainedRect.size.width, self.calloutHeight)];
+   
+   // If we have a contentView, resize it to fit within the callout.
+   if (self.contentView)
+   {
+       CGFloat margin = self.innerContentMarginLeft + self.innerContentMarginRight;
+       CGRect r = self.contentView.frame;
+       r.size.width = self.$size.width - margin;
+       self.contentView.frame = r;
+   }

     // how much room do we have in the constraint box, both above and below our target rect?
     CGFloat topSpace = CGRectGetMinY(rect) - CGRectGetMinY(constrainedRect);
     CGFloat bottomSpace = CGRectGetMaxY(constrainedRect) - CGRectGetMaxY(rect);

     // we prefer to point our arrow down.
     SMCalloutArrowDirection bestDirection = SMCalloutArrowDirectionDown;

Update graphics for iOS 7

Hi,
I am using your lib through mapbox-ios-sdk.
There are many interface changes in iOS 7, and old design doesn't work so well (tested on xcode 5 preview, ios 7 simulator).
Do you think it is possible to update design to match iOS 7 design ?

Here is a comparison between iOS 6 (left) and iOS 7 (right) for the Maps application:
30

And the result in my app (iOS 6 is up, iOS 7 is down), no change in code, only the simulator is not the same:
capture dcran 2013-07-08 17 01 20
capture dcran 2013-07-08 17 01 56

Thank you.

Touch MapView

How can I know if the user is touching the mapview "background" or touching the annotation?

Set any instance of UIView for both titleView and subtitleView properties

This should be similar how UINavigationItem's title and titleView properties work; then SMCalloutView's interface would be similar to:

@interface SMCalloutView : UIView

// ...

@property (nonatomic, copy) NSString *title, subtitle;
@property (nonatomic, retain) UIView *titleView, *subtitleView;

// ...

@end

Ideal custom image sizes in documentation?

Hi,

Is there ideal widths and heights for the custom images for SMCalloutBackgroundView? I put mine in and they look just odd. Is this documented anywhere?

Thanks :)

using CalloutView with OHAttributedLabel

Im trying to use OHAttributedLabel in my app.
this class lets me to attribute my text and can fire my desired method after tapping your special attributed text.(like hypelinks) this API uses UILabel for its tag processing in text.
I want to show a callout view after touching these texts.
but it seems callout view doesn't appear after touching! (the method fires).

-(void)popOutCalloutView
{

calloutView = [SMCalloutView new];
calloutView.delegate = self;
calloutView.title = @"wow!!";
[calloutView presentCalloutFromRect:_basicMarkupLabel.frame inView:_basicMarkupLabel constrainedToView:_basicMarkupLabel permittedArrowDirections:SMCalloutArrowDirectionDown animated:YES];

}

you can download my test project from here :
http://upload.ugm.ac.id/775OHAttributedLabel-master%202.zip

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.