A
A
Alexey Mistin2015-08-19 10:05:21
iOS
Alexey Mistin, 2015-08-19 10:05:21

How to do object alignment on screen in Swift app?

Hello.
How to make an object (sprite) in the application under IOS displayed in the upper right corner of the screen. The problem is that the resolutions of different iPhones are different, so this sprite always goes beyond the screen for me.
I know how it can be done through the graphical editor in Xcode, but how through the code?
PS I work on Swift SpriteKit.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
P
Petrushka, 2015-08-19
@petruska

through constants
self.view.frame.size.height - 20
self.view.frame.size.wight - 20
coordinates that the element will be down from the top and side by 20 pixels
set the element needs coordinates
(obzh-s code but you understand the logic)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question