This question already has answers here:
Detect when a Mac OS X window is resized or moved
(5 answers)
Closed 1 year ago.
I’ve got an objective C sprite kit game that works fine in a standard window size, however when the game window is resized to full screen, the main character sprite needs to have its y axis changed. In order to implement this, I need to check if the window has been resized in the game loop. how do I go about doing this?
You can use NSWindowDelagate. The NSWindowDelegate protocol has windowWillResize:toSize: and windowWillMove: methods.
Related
This question already has answers here:
Draw lines between points(multiple)
(2 answers)
Closed 8 years ago.
Can someone show me an example on how to plot points and connect them in iOS objective C. Do I need to put CGPoint's in an array or can we draw one point at a time? What we want to do is calculate the corresponding y value from x value and make a CGPoint and plot them, in a for loop.
Thank you
It's not really about what language you are using, it's about what technology stack you are using. iOS? Mac? Then there are many options: 3rd party library, Core Plot, Core Graphics (2D procedural drawing API), Open GL, Core Animation (2D/3D compositing and animation API) or even some combination of these.
The correct answer depends on what you are building, big picture.
As it stands I think the question is to broad to answer.
This question already has an answer here:
Is it possible? camera api ios [closed]
(1 answer)
Closed 9 years ago.
I was wondering if its possible to show a layer (UIImageView?) on top of the camera view while taking a picture. I know its easy to implement a layer after the photo is taken but I want to show that layer while taking the picture. Think of it like a frame for your picture.
I've never seen an app that has done this before so I was wondering if it's even possible.
The term you are looking for is an overlay
Here's Apple's sample code.
This question already has answers here:
Images for iphone 5 retina display
(5 answers)
Closed 9 years ago.
So typically on storyboard, you assign an imageview with the image you want (foo.png) and then the phones automatically upsize to the retina version if one is on the iPhone 4 or 4s (foo#2x.png).
The question is, how do you get an image to display properly on a 4'' iPhone 5? It is all out of whack when I try it in the simulator and Apple has yet to address this situation with a simple solution as they did with the Retina display of the iPhone 4's. Any help? Thanks!
iPhone 5 support can be added very simply by adding a default#2x-568.png file to your project. Beyond that, it is only a case of making certain the app scales to a new size correctly. Make sure your views accomodate to the new size either programatically, or by setting springs and struts correctly in your UI archives (XIBs or Storyboards as appropriate). You shouldn't need any new images (*). If you already
support retina devices, then you only need to add the new splash screen as above.
(*) If you do for whatever reason, I'd recommend reading this answer:
ios6 UIImageView - Loading -568h image
Apple doesn't provide a good way of using different images on the iPhone 5, because you aren't supposed to use any!
This question already has answers here:
Closed 10 years ago.
Possible Duplicate:
Specify images for iPad in Xcode like #2x for iPhone 4
I'm having trouble finding current conclusive information about how to properly use images based on device classes (Apple documentation being like a maze of twisted corridors, all alike). My sense is that this is something that has evolved a bit over time. Suppose I want to support non-retina and retina iphones and ipads with different images.
Here are all the permutations of filenames that I can think of:
image.png
image#2x.png
image~iphone.png
image~ipad.png
image#2x~iphone.png
image#2x~ipad.png
I could do this:
myview.xib
myview~ipad.xib
Suppose I have four devices, iPhone 3GS, iPhone 4, iPad 2, iPad 3 (or 'new iPad' for purists).
Let's talk about how I would set up my xibs (i.e. I add a UIImageView, what do I choose for an image?) to use the appropriate image and how, if I use code, [UIImage imageNamed:#"image"] would behave.
It's my understanding that in code I could fall back on UI_USER_INTERFACE_IDIOM() but I'm not convinced that I need to.
If someone could explain what will and won't work, I know that it'll be a help to me, and I suspect to others. If I've somehow duplicated another SO question I couldn't find, well, we can close this up and link to it. Thanks!
in iphone xib you have to use image~iphone. on ipad xib you have to use image~ipad. #2x is automatic selected when file is needed.
This question already has answers here:
Closed 11 years ago.
Possible Duplicate:
Drawing on desktop in Mac OS X
How can I draw directly to the desktop (behind the icons) in OSX Lion using objective c? I know it is possible because there are some applications in the app store that allow you to do this.
Take a look at this question Drawing on desktop in Mac OS X
You never draw directly to the desktop. The best you can do is to create a transparent window just above the desktop and draw in there.