- Home /
Moving a button out of screen in iPhone
I am trying to move a Horizontally Centered Button out of screen by changing the x position. So I've subtracted the ScreenWidth to that button's X position. It works for larger screen like iPhone 12 pro max (width 1284). But when I run it on iphone se 2020 (width: 750) the button moves just half of the sceen, not entirely out of the screen.
The black line denotes the translation of button though in both cases translation magnitude is screenwidth. I have checked screenwidths for both devices (1284 for 12 promax, 750 for se2020). Shows currectly even in the inspector on runtime.
Answer by lvskiprof · Oct 09, 2021 at 11:42 PM
I am wondering why you want to move it off the screen at all. If you want it so they can't interact with it, just disable it. If it is disabled, it doesn't require any processing time and you can enable it later if you want it back.
Some UI hide/show effects needs to be done in my projects where UI elements move away from middle to some where out of screen back and forth. That's the reason. Is there any other way to do this @lvskiprof ?
Still not sure why you need them off the screen like that, but it sounds like somehow the way you are setting the position is using the wrong values somehow. I assume you have checked the values you are using in both cases. Can you share your code with us and show what values you end up using for the two different screens?
That may help show what is going on.
Your answer
Follow this Question
Related Questions
UI Button onclick not detected 0 Answers
Using a 3D model as a button, in Unity's UI system? 3 Answers
Cannot click UI button. 4 Answers
Why have my unity UI buttons suddenly stopped working?,UI Buttons Suddenly Not Working 2 Answers
Lags when clicking so many times,Have problem when clicking so many times 1 Answer