iPhone 5 Image Issuses - iphone

I have an app that I am making but the background image I am using wont work on my iPhone 5. Everything works on it when I load it on my iPhone 4. It was size the -568h#2x.png right it looks massive or it will load the #2x.png and give it a tile look. Any one know would could be wrong. I've tried making a UIImage in IB and programmatically. Neither have been successful. I've even tried if else methods to loads different pngs based on the screen height. I'm at a point where I could just quit. Any direction or guidance. I have all my code but didn't know what would be the best pice to post. Thanks

Sounds like you might need to make two separate storyboards/xibs, one for an iPhone 5 and another for the iPhone 4S/4/3GS, etc. Here's a link that will tell you how to do it.

Related

xcode 8 auto layout uiimageview problems

I have a Android background and now try to code for iOS.
I use Swift as the language and it works really good so far. Now I am getting some troubles to get my layout to work on different screen resolutions that means different iPhones.
I am using storyboards for my ViewController and for now everything worked well except getting UIImageViews to look the same on each iPhone.
I tried now for 2 whole days with dozens of different approaches to get my layout work, but without any success. If I place a single UIImageView on my layout I am able to set the constraints so that it looks the same on each iPhone. Once I place a UIImageView on top of my first UIImageView it destroys everything. I won´t tell you here what I already tried, because it was a lot and nothing worked for me.
I need really some hint or just someone who could just try it on his Storyboard and tell me how he achieved it to get it work. I am using Xcode 8.2.1.
This is how it should look like (iPhone 7):
This is how it looks on a iPhone 4s --> wrong! Proportions are not the same!
It's need more params and maybe UIStackViews.
https://github.com/OMGHaveFun/exampleAutolayout

Screen sizes in Xcode 7 the using SpriteKit

I am relatively new to sprite kit and have been attempting to create my first basic game. All physics and other basics seem ok, but for some reason whenever I build and run the screen dimensions are off (looks like default is 1024×768)?
Pretty sure I'm missing something fundamental here but it doesn't seem immediately obvious on how to adapt the screen to any size iPhone screen (this is my ultimate goal).
My question is whether this is actually just a setting issue or is it necessary to implement code?
Thanks in advance and have a great day!:)
To answer the first part, you can easily change the size of your scene.
If you take the default GameScene, click out of the scene and look at the Attributes Inspector. You will see the default size of 1024,768. Personally if landscape I tend to work with an iPhone 5 design resolution of 568,320.
Regarding multiple devices, SpriteKit works pretty well out the box. You should look at the documentation regarding scaleMode, take a look in the GameViewController.swift. .AspectFit worked really well, nearly pefect across all devices apart from a little letterboxing on iPad. However, for the amount of effort put in, more than good enough.
On a side note, I've found the following iPhone Resolution Guide resource useful in the past.

Loading a 20MB png in a UIImageView embedded in a UIScrollView

I have a large png Image that I need to Zoom&Move.
I therefore created a UIScrollView and embedded a UIImageView.
The App works fine in the simulator, but when running it on the device (8GB iPod Touch) it crashes as soon as the view is loaded.
I tried with a smaller test Image (4MB) works fine and suspect the iPod can't handle a 20MB PNG. I also tried different other formats, such as JPG (in various save patterns), but that did't help either.
Any clues how I can solve this?
Ouch, 20M is a large image. The first thought that comes to mind is can you dice up the image? I.e. instead of one image have a whole bunch of small images which together make up the larger image. Then you can load on demand the same way google maps downloads image squares.
have a look at the ScrollViewSuite Example from apple. Sounds exactly like what you are trying to do.
3_Tiling demonstrates:
How to subclass UIScrollView to add content tiling
Reusing tiles to optimize performance and memory use
Changing the resolution of the content in response to zooming
I suggest the Example Photoscroller. It demonstrates CATiledLayer which you can use to tile your image and even use smaller images as lod images. It's much smaller then the complete ScrollViewSuite example but has everything you need to do what you want. It contains only 2 classes which you should be able to use in your project with minor edits.
You might want to check the WWDC 2010 Session #104 "Desinging Apps with Scroll Views"... they handle and explain that example.
You will need to tile your image. I suggest imagemagick for that :)

timer for slide show in iphone app development

Hai,
I developed sample app for image slide show
Now i want to keep timer to the app.
It has to scroll the images for every 5 seconds
Please help me with sample code
Thanks
Basanth
Its bad to ask for sample code. Because, you will not learn. If you see the documentation, along with required solution, you will get a chance to learn new things.
You can use UIImageVIew to show your images.
If you see the documentation for UIImageView, there is a property "animationImages" which will take an array of images. You can set "animationDuration" as well there.
That's it, your slide show is ready.

iPhone 3 v 4 v iPad ui. Raster vs vector

I'm the design guy on a new iPhone project and am curious on the eat practices for the up elements in the iPhone 3-4 dev. I know the dpi is different between the two and am curious how best to handle this with the dev guys. Do I need to make 2 of everything or do we need to figure how to make vectors of things like buttons , backgrounds and other images?
Any help , examples and links would be awesome. My goal is to do the best for the app with asking for dumb things from the developer
Thanks
Your only option right now is to generate PDF images, then draw them manually with core graphics if you absolutely need vector graphics. Otherwise, you can wait for someone (including myself) to get something written third-party like, or you can just make two of everything.
You need to make 2 files.
Lets say you have an image that is 48x48 called Hello.png
the hires version will be 96x96 called Hello#2x.png
The iPhone will automatically determine which image to use.
Thank you, come again.