I'm a bit annoyed that the display menulet in Mountain Lion no longer lets you adjust the screen resolution.
So I'm working on a simple menulet using NSStatusItem, but I've never really delved into the world of adjusting the display resolution.
How can I create a simple menu which will list a screen's supported resolutions and change to that one when you select it?
Related
I am new to Mac application development using Cocoa. I am confused as to what should be the window/view size. Like in an iOS app we have proper dimensions for small iPod as well as latest iPods. But how to set the size in a Cocoa App.
Also I want to set the deployment target to OS X 10.6, which does not support AutoLayout.
So what would be a good way to resize the windows which should fit every desktop?
There are a couple of things you need to consider when sizing windows for a display under OS X.
First, there's the size of the display area. You could use
NSRect frame = [[NSScreen mainScreen] frame];
but that's a bit simplistic because the user may be displaying the Dock, and there's almost always the menu bar displayed as well. So a better way of determining the maximum display area for the Desktop would be:
NSRect frame = [[NSScreen mainScreen] visibleFrame];
which respects the menu bar and Dock.
As others have pointed out, this rectangle is seldom the most ideal size for a window. Understand too that this rectangle is only a starting point, because your user may have multiple displays, and they contribute to the total area in which a window may be displayed. But when displaying a new window, you always start within this rectangle. Look to NSScreen's documentation to determine this; the methods above will provide a springboard to your understanding.
I don't know how you plan to create and use your window, but for all but the most simple applications, you'll probably use a subclass of NSWindowController with it. If so, it will be your window's delegate. And so there's an important window delegate method that you'll need to implement in it, and it's this:
- (NSRect)windowWillUseStandardFrame:(NSWindow *)window defaultFrame:(NSRect)newFrame
This is where you determine the 'standard' location and size of your window's frame. It's called by the window when the window is zoomed 'out' to what is called the "standard state" (versus the size the user makes it, the "user state"). In other words, it's the rectangle that best suits the content of your window, yet keeps in mind the rectangle describing the 'safe' area in which you can display it. Unfortunately, I can't tell you exactly how to code it, because it depends entirely on what you're displaying inside your window.
You can see, then, that the definition of 'proper' is something entirely different from that in iOS. Best wishes to you in your endeavors.
Don't think too much like programming for an iOS device. On OS X the user can display multiple windows on the screen next by each other. He may want to do that depending on the task your app has.
You're going to have to design your window so that all objects fit inside. Based on that, you can set a minimum size as well as a maximum size. Consider the smallest screen resolutions are around 1200 x 700 and thus your minimum size shouldn't exceed that.
Before autolayout there existed a "springs & struts" way to define how objects resize or position with a resizing window frame.
I recommend you start laying out your app on aper or with a graphics tool and then see how much space is necessary. If more space than minimum resolution is necessary, you will have to start using scroll views, split views or similar to make the interface working in different window sizes.
A lot of useful information can be taken from OS X HIG.
i developed a game for the iphone4. Now i got problems with the iphone5 and the 4inch screen. My game is on the left side of the 4inch screen and i have a big black border on the right side. But the buttons from the game are in the middle of screen, they have same position like on the iphone4. I checked everythin but i dont know why the background-images and the sprites are on the left side and the buttons are in the middle. I want that everything is in the middle or on the left side. It would be great if anybody could help me!! Thanks!!
COCOS2d-iPhone:
If you're using the latest beta, the only change you should need to
make is export all your images at twice the size and use the "-hd"
suffix, similar to Apple's "#2x". The documentation also says you need
to set the content scale factor of the director.
You can find the documentation here.
and more detail here.
COCS2d-X:
Cocos2D-x has a very easy solution for multi-resolution problem.
In fact you just need to set your DesignResolution and then just imagine your target device will has this resolution.
If target device really has this resolution ( or some other but with same ratio) cocos2d will handle to fix screen and your game looks same in all devices.
And when ratio of target device is different, you have many option ( as cocos2d language, policy) to manage that.
For example if you use Exact fit policy, cocos2d will force your game ( and design) to fit target device screen (without that black boarder).
Exact fit
The entire application is visible in the specified area without trying
to preserve the original aspect ratio. Distortion can occur, and the
application may appear stretched or compressed.
For more detail just take a look at this link : http://www.cocos2d-x.org/projects/cocos2d-x/wiki/Multi_resolution_support
I have implemented the usual examples of accessing the camera roll on ipad and selecting a photo (I think). I'm a bit disappointed in the little tiny popout window that shows all my photos. Im much more impressed by the way you can select a wallpaper on iPad, and the photo viewer.
So what I would really like to have is control that displays a full screen of camera roll thumbnails, which if you then select one, it displays full screen with options to move and scale, and then you can select that image.
Does anything like this already exist that I can use? Do I have to roll my own? Or is there something already built in that I am missing?
Thanks!
Personally, I absolutely love AGImagePickerController. It's big, it's cross platform, but most importantly, it allows multiple selection.
In some applications like Sparrow Mail are set two different application icons. The default icon used in dock, in icon view e cover flow. Then a second smaller for list view, column view and title bar. How do you set the icon smaller? In file.plist there is only this.
Thanks.
Xcode includes the Icon Composer.app application which allows you to create .icns (Icon Suite) files which support multiple resolutions like shown in the following image:
As you can see in the image above, the Get Info panel’s “proxy” icon (in the titlebar) is using the small 16 x 16 icon, while the lower icon is using one of the larger sizes. If you are used to the single-size-only ways of UIImage, how an NSImage works in OS X may be confusing at first. In iOS, a UIImage represents a single bitmap image, and is basically a wrapper around a CoreGraphics CGImageRef. An NSImage in OS X works at a higher level, and as such, is quite different than a UIImage. An NSImage contains one or more specifically-sized NSImageReps, which are more analogous to a UIImage. In the screenshot you provided, both the window title bar button’s image and the NSImageView’s image are set to the same instance of an NSImage. When that image is asked to draw itself, however, the image is choosing 2 different NSImageReps based on the size requested. For more information on how this works, see Cocoa Drawing Guide: Image Basics - How an Image Representation is Chosen.
If you’re using the all-in-one Xcode.app app bundle, launch Xcode and choose Xcode > Open Developer Tool > Icon Composer. If you’re using the older style of the Xcode tools, with multiple folders, it’ll be at <Developer Tools>/Applications/Utilities/Icon Composer.app.
In a project that I am currently working on I have an transparent NSWindow overlayed on a QTMovieView. At certain points I slide a custom view into this child window with animation so that it is displayed over the movie for a short period of time. The only odd behavior is that the animation is smooth on a Mac Book Pro but on a Mac Book(Same OS-X Version) there is significant flicker. The flicker only occurs on the portion of the window that has the actual QTMovie behind it.
Has anyone seen this behavior before or found a way to work around it?
The older MacBooks don't have real video hardware and used shared memory, so it's probably an issue with a slow video card trying to update # 30fps. Have you tried smaller movies to see if the issue goes away?
You may be better off with a pipeline like in the QTCoreVideo101 sample code from Apple. That would be a bit more work, you'd have to take care of the animation yourself, but you would get ultimate control over what is being drawn.