Skip to content

calloutView with AutoLayout #96

Open
@haashem

Description

@haashem

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions