Music Player

User avatar
Mr. Kibernetik
Site Admin
Posts: 4786
Joined: Mon Nov 19, 2012 10:16 pm
My devices: iPhone, iPad, MacBook
Location: Russia
Flag: Russia

Re: Music Player

Post by Mr. Kibernetik »

Ramzan wrote:Ok.

So how do I create a button that be on every screen?

I want to create 13 buttons in total, one below the other. So I need to create them in such a way that they are all on the screen on every iPhone and iPad. How do I do this?
Think and code. This is your creativity.
If you will have any questions regarding sB commands, please feel free to ask.

Ramzan
Posts: 26
Joined: Mon Jan 04, 2016 11:13 pm
My devices: iPad
Flag: Great Britain

Re: Music Player

Post by Ramzan »

I think I'll just give up.

User avatar
rbytes
Posts: 1338
Joined: Sun May 31, 2015 12:11 am
My devices: iPhone 11 Pro Max
iPad Pro 11
MacBook
Dell Inspiron laptop
CHUWI Plus 10 convertible Windows/Android tablet
Location: Calgary, Canada
Flag: Canada
Contact:

Re: Music Player

Post by rbytes »

No need to give up. There is a simple solution. I will post it in Other topics, since this section is meant for posting programs rather than how-to discussion.
The only thing that gets me down is gravity...

Henko
Posts: 814
Joined: Tue Apr 09, 2013 12:23 pm
My devices: iPhone,iPad
Windows
Location: Groningen, Netherlands
Flag: Netherlands

Re: Music Player

Post by Henko »

Hi Ramzan,
All comments made here are right. I think that the confusion is caused by the fact that mr. K. is talking about ABSOLUTE positions on a screen and you talk about RELATIVE positions (i.e. "near the bottom of the screen").
Now, as the vertical resolution of the various iPhones and iPads differ, you have to recalculate the actual vertical position to ensure a equal RELATIVE position on any hardware.
The same goes for a relative horizontal position.
So, if you want a button in the mid of the screen and at 90% near the bottom at ANY iphone/pad, the code would be:

sw=screen_width() ! sh=screen_height()
button "blops" at 0.5*sw, 0.9*sh size bx,by

I put bx and by as size in this example, because probably you would want the size of buttons be adapted to the size of the screen too.
It's a nasty thing to make an app that looks similar on ALL hardware, but i think that goes for most if not all programming languages.

Post Reply