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

calloutView with AutoLayout #96

Open
haashem opened this issue Nov 14, 2015 · 0 comments
Open

calloutView with AutoLayout #96

haashem opened this issue Nov 14, 2015 · 0 comments

Comments

@haashem
Copy link

haashem commented Nov 14, 2015

I want to thank you for developing this nice replicate of UICalloutView. I used these library 3 years ago for iGolestan app.

now I'm using again for another app. I have designed a custom content view and layout the subviews with auto layout. subviews are some UILabels which can shrink or grow based on their text length.
here is the final result I achieved:
smcalloutview with autolayout

but problem is here SMCalloutView initially needs contentView frame, but autolayouted contentView initially doesn't have any frame! until [self layoutIfNeeded] gets called! so I move'd =>

// layout now so we can immediately start animating to the final position if needed
    [self setNeedsLayout];
    [self layoutIfNeeded];

before

// size the callout to fit the width constraint as best as possible
    self.frameSize = [self sizeThatFits:CGSizeMake(constrainedRect.size.width, self.calloutHeight)];

as you see in the below gif, initially SMCalloutView doesn't correctly show callout, display bottom arrow at top. but after that callout appears correctly.
map

do you have any idea how can I fix that?

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

1 participant