andreamazz / BubbleTransition

A custom modal transition that presents and dismiss a controller with an expanding bubble effect.
MIT License
3.32k stars 250 forks source link

transition.startingPoint = BubbleBtn.center does not work #30

Closed kiwo12345 closed 8 years ago

kiwo12345 commented 8 years ago

I am using the button inside my Navbar like:

Right bar button -> bar button items -> BubbleBtn

But when I set: transition.startingPoint = BubbleBtn.center it will make the transition start form the very top right corner of my screen:

dis

How can I make it start from the center of the button?

andreamazz commented 8 years ago

is it a UIButton or a UIBarButtonItem?

kiwo12345 commented 8 years ago

@andreamazz UIButton :)

Right bar button -> bar button items -> UIButton

andreamazz commented 8 years ago

Ok, so it's inside a navigation bar. It's always tricky finding the right position for those buttons. Take a look at this SO thread

kiwo12345 commented 8 years ago

@andreamazz look like someone else was asking the same thing I will try to convert the answer into swift 3 and see if it works

kiwo12345 commented 8 years ago

@andreamazz That didnt work : / I also added a image to my btn and tried to use the image center which did not work. Do you think I could wrap the btn inside a uiview and use the center of that view? running out of ideas now

andreamazz commented 8 years ago

It's always tricky getting the right position in the navigation bar. You can add some hardcoded offsets, it's not pretty, but it'll get the job done.

I'm closing this issue if you don't mind, since it's not directly related to the library.

kiwo12345 commented 8 years ago

@andreamazz this worked out perfect:

transition.startingPoint = CGPoint(x: bubbleBtn.center.x, y: bubbleBtn.center.y + 20)