I'm developing a new ios 8 application using SpriteKit. Recently I read a lot about adaptive UI but found no way to implement it with SpriteKit.
Suppose for example that I programmatically create a subclass of SKNode, call it MyNode.
In interface builder there is nothing that lets me put on the screen the node I just created.
I found on raywenderlich a snippet of code that checkes whether the app is running in iPad or iPhone and resizes a playable area of 320x480 opportunely.
Is there a method to adapt the ui with ib? Or should I do this programmatically via that snippet? Thanks.
This is an example of what I mean. These are the app screens in iPad and iPhone. How do you think the developer achieved the goal?
iPad
iPhone
Related
I'm trying to make my first iOS app in xcode 7 for iOS 9
and i want to make it for all the iphone devices like iphone 4,4s,5,5s,6.
Do i have to make a different xib file for each one of the iphone or there is a simple way to make it for EVERY iOS device also like iPad???
There's a magical thing called autolayout. And another thing called universal app
You Can do both in single storyboard first you have to choose Universal while creating project. You need to do autoresize or apply auto layout.
No, you shouldn't need to do device or resolution detection. iOS includes lots of features for adaptive user interfaces. See here for example: https://developer.apple.com/design/adaptivity/
You just use auto layout concept in your application and you will find lots of document on net for auto layout and re sizing class.
You can make one app for all device using autolayout and make your app universal and in xcode 7 and ios 9 there is new feature available stack view using this you can do this.
I am newbie in game development,currently I am using the sprite-kit framework. I have added scene on SKView. On scene I am setting images to SKSpriteNode and building it on iPhone 6 plus simulator, its looking perfect on it,but problem is that, when i build it on lower version like iPhone 5s,4 or 3 ,the some part of images are going outside the simulator screen.I have tried all the scale modes for scene but its not working.
You can use the property of SKScene called scaleMode. You may want to use SKSceneScaleModeFill or SKSceneScaleModeResizeFill.
More information here
I am making a landscape universal game with Spritekit and Swift in Xcode 6.1. I have been researching about how to make a universal app, and there seems to be a lot to do in regards to layout so that your game looks the same across all devices.
I have read that you can do this by defining a "playable area" in which you put all your game features into. The link below shows a image explaining the playable area idea.
http://cdn5.raywenderlich.com/wp-content/uploads/2013/09/Aspect-Ratio-Diff.jpg
Apart from the 1 tutorial I have found online talking about this, (which wasn't for Swift) I cannot find anything about how to actually "define" a playable area for Swift in Spritekit.
Is there a way I can create a rectangle, lets say on the iPhone 6 for example, so that it will cover all devices as long as I build my game within that rectangle?
Basically how do I define a "playable area" so that I can see the boundaries that I have to build my app within? Like in the linked picture?
To make the layout appear the same on every device , assuming u support iPhone 5 and above only . You can make use of .Aspectfill under your GameViewController to scale the scene to fit all the resolutions. This means that you will be using the iOS 5 simulator and that you will relinquish support of iPhone 4s.
The best way to define a playable area would be to either create a rectangle node that encompasses a certain area while ensuring that your physics world is showing physics for testing.
If you want to build for each screen size natively, you would have to adjust your content manually as technically , devices such as the iPhone 6 plus for example are designed so you can see more things.
I am trying to create an iPhone and iPad compatible app.
Is there any good tutorial and example I can follow?
Can I create one view or storyboard for each view and use it for iPhone and iPad?
If I use a storyboard, can I do something like this:
If it's iPhone, use this storyboard design, if iPad, use the other storyboard design.
Or do I need to create a new view or storyboard for iPad and one for iPhone?
I have no clue how to start at this moment.
You only need one storyboard to build an interface that is compatible with both iPad and iPhone models.
Apple is now encouraging developers to embrace Adaptive User Interfaces. As their guide states, "With the latest advancements with View Controllers in iOS 8 and Auto Layout in Xcode, it’s now even easier for you to adapt your user interface to context and different sized devices". In other words, you only need a single storyboard for all iOS devices, also known as a "Universal" storyboard.
This tutorial should get you started with Universal Storyboards and adaptive layout.
So I recently got my iPhone 6, and I was working on a project earlier. When the new device arrived, the application looked messed up. For example, I have UIWebViews on the app, and when loaded on the iPhone 6, it just appears as if it where the iPhone 5s screen with white around.
Please help!
Xcode has an auto layout tool that allows you to add constraints to the objects that you add to your story board so that in the event of the app being displayed on a different screen size, it has the logic to intelligently place your objects and lay them out to fit the new screen size.
I'd start here: https://developer.apple.com/library/IOs/documentation/UserExperience/Conceptual/AutolayoutPG/Introduction/Introduction.html
...but there's a wealth of good tutorials and youtube videos out there showing examples of good practice.