EddyVerbruggen / cordova-plugin-actionsheet

:clipboard: ActionSheet plugin for Cordova iOS and Android apps
208 stars 71 forks source link

Center actionsheet on iPad #49

Closed bash88 closed 7 years ago

bash88 commented 7 years ago

Hi Eddy,

Great plugin.

Since updating to the latest version after the iOS10 bug mentioned in #41 the actionsheet opens in the top left corner on iPad, because I didn't set position values. Now I'd like the sheet to open in the middle of the screen, like before. How would I go about doing this, other than inputting pixel values for both orientations?

Regards, Bas

kahuna76 commented 7 years ago

Yeah this is bugging me too - takes a lot of fiddling around with dynamically setting position when opening actionsheet and rotating etc. Is there a quick/easy workaround that opens it in middle as it did before ?

kahuna76 commented 7 years ago

OK got it - The below centers the popup and hides the arrow

[popPresenter setPermittedArrowDirections:0];          
popPresenter.sourceView = self.webView.superview;
popPresenter.sourceRect = CGRectMake(CGRectGetMidX(self.webView.bounds), CGRectGetMidY(self.webView.bounds),0,0);
geshub commented 7 years ago

Is there a way to center actionsheet on iPad without changing the source code of the plugin ?

geshub commented 7 years ago

@kahuna76 Your solution worked perfectly for me, could someone integrate it in the plugin ?

EddyVerbruggen commented 7 years ago

Great, published in 2.3.2

geshub commented 7 years ago

@EddyVerbruggen Hi, just tested 2.3.2, can't find the actual centering code in the changes ?

EddyVerbruggen commented 7 years ago

OMG, too much 🍾 .. hang on

EddyVerbruggen commented 7 years ago

Version 2.3.3 is a more sober version of 2.3.2. @geshub thanks for letting me know!

geshub commented 7 years ago

@EddyVerbruggen Tested and worked perfectly. Thanks again !