Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SMCalloutView is placed at end of cgrect.width instead of centered in iOS 8 #67

Open
DrBeak1 opened this issue Sep 29, 2014 · 2 comments

Comments

@DrBeak1
Copy link

DrBeak1 commented Sep 29, 2014

I found that I needed to update a project using SMCalloutView because the callouts point was pointing at the far right edge of the specified rect instead of in it's horizontal center. I fixed this in my code by using calloutOffset = CGPoint(-view.frame.size.width/2, 0.0);

Also, thanks for easy to use class :)

@nfarina
Copy link
Owner

nfarina commented Sep 29, 2014

Glad that fixed your problem - I'm not seeing it myself in the sample project though, can you explain more how to reproduce?

@DrBeak1
Copy link
Author

DrBeak1 commented Sep 29, 2014

Sorry for not explaining better - Perhaps it had to do with my setup. I was showing the callout from a UIToolbar like so:

-(void)displayCallout
{ 
    UIView *editButton = (UIView *)[self.keyboardToolbar.subviews lastObject];
    if (SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(@"8.0")){
        CGPoint offset = CGPointMake(-editButton.frame.size.width/2, 0.0);
        [self.callout setCalloutOffset:offset];
    }
    [self.callout presentCalloutFromRect:editButton.frame
                                  inView:self.keyboardToolbar
                       constrainedToView:self.view
                                animated:YES];    
}

You'll notice that in the above I included what I did to fix the offset in iOS 8.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants