Poor font rendering (Cocoa - Mac) - objective-c

I've noticed a strange and very noticeable difference in font rendering in my xib and my final program, I've attached screenshots below:
See here for zoomed out image
See here for zoomed in
What is going on here and how can I make my app font look like it does in XCode? (Does it have something to do with subpixel rendering???).

I stole this answer from here:
If you have no background (including clear) and your text is a subview
of any layer-backed superview (you've turned on "wants layer" in code
or in IB to allow animations/transitions), you'll get blurry text. You
have to choose either no layer backed view or a label with a solid
background color.

Related

NSOutlineView in NSPopover not readable in OSX 10.10 Yosemite

I have a NSPopover containing a NSOutlineView (source list) that is displayed over a usually dark background (but it's not always dark). The NSOutlineView has a transparent background to blend nicely with the NSPopover view. This looked great in OS X 10.9 but in 10.10 the system changes the text color in the NSOutlineView based on the background. The result is that the text becomes completely gray and unreadable in some cases:
If I change the popover to be HUD style it is more readable:
However, in this case, it becomes problematic with lighter backgrounds (the top).
Is there any way to control the text color in the NSOutlineView so that the color stays the same no matter the background? I have tried setting the color of the text cell to black instead of the system colors but it does not help.
Also, can I control/remove the transparency of the NSPopover? I have read that NSPopover makes use of NSVisualEffectView, which has some appearance controls, but I don't know how to access it from NSPopover.
For aesthetic reasons I do not want to put the NSOutlineView under a solid background view. In this case there will be a ugly mismatch in color between the popover background and its arrow.
EDIT:
I was able to remove the transparency using the following code:
NSView *popoverView = popover.contentViewController.view.superview;
popoverView.appearance = [NSAppearance appearanceNamed:NSAppearanceNameAqua];
It works but feels like a ugly hack. I welcome better suggestions.
EDIT2:
This is what it looks like with the aqua style. No transparency and black text.
Set the mode to something different other than source list and you should get the pre-10.10 style, i.e. without the translucency.

MKAnnotationView not drawing transparent PNGs properly

I am having trouble getting my custom MKAnnotationView to render with proper alpha blending on its edges. As you can see from the following screenshot, the red and green dots have an ugly black edge that does not blend into the background, but the system-supplied user location (the blue dot, barely visible) does not.
The image is a transparent PNG and I have confirmed it's not the image's fault as it renders properly elsewhere.
I have set opaque = NO on the MKAnnotationView but it had no effect.
Am I missing something?
Ha, well it went away on its own. I'm honestly not sure what I did but I wasn't even worrying about it, changing some other stuff around and all of a sudden it renders properly now.
*shrug*

Specific behaviour wanted when loading and displaying an image in an NSScrollView (Mac OS X)

I am very unexperienced and rather new to Objective-C and I'd like to ask a methodical question. What I want to do is:
Load a user provided image to show on the screen. The user should be
able to zoom. So it seems best for me to use a NSScrollView to draw
the image. I have some other demands about the behavior
When the image is loaded, it should fit the NSScrollView without
being stretched in either direction.
When the user now changes the size of the NSScrollView (via changing
the size of the window) the image should be resized appropriately.
If the user at some point zooms the image, it shall not be resized
when changing the size of the NSScrollView. If the image is zoomed
to fit into the NSScrollView (means like when loaded) it should be
resized again when changing the size of the NSScrollView. I think
this is the same behavior as in Apple's preview app.
I guess this is easy to achieve for an experienced programmer, but I have some issues. Here's what I have tried.
I load the image via
[[NSImage alloc] initWithContentsOfFile:imagePathStr];
on a button click. I am also able that it is displayed to fit nicely (on load) into the NSScrollView by changing the size of the image before drawing it. But I can't get the behavior right on resizing or zoom (I use the NSScrollView biuld-in zoom ability). Can someone provide some kind of list of key points that needed to be executed to achieve what I want? Or do someone rather see my explicit code to tell me what I am doing wrong?

Chaning the background color around a PDF in a UIWebView on Device

I'm using a webview to display a PDF.
The webview displays the PDF at it's actual size which is a little smaller than the size of the webvieww itself, revealing the scroll view underneath it.
I've tried setting the Webview to opaque and setting it's background color to another color, which works fine and dandy in the simulator, but fails to change the color on the device. On the device it changes the color of the background of the view behind the scroll view, this can be seen when the PDF is pulled all the way down.
I've also tried setting all the UIView's backgrounds, by iterating through the subviews but to no avail.
I've updated a diagram to help illustrate which area I'd like to color.
Uploaded Diagram
You really shouldn't mess around with UIWebView's internals.
They can change anytime and your code might just crash on the next version of iOS.
If you need more control about pdf display, you might wanna take a look at other possibilities to show pdf, like using the CGPDFDrawPage* functions. Of course they are pretty low-level and it's a lot of work required until you can get fast page display, zooming, etc all right.

UIImage View shifting in Interface Builder

I am using interface builder to create my create my .nib file. THe first thing I did was to add an UIImage view to cover the screen with a background image that serves as part of the interface graphic. Everything was working fine, now the image is shifted up slightly in the simulator. THe Status, Top, and Bottom bar are all "Unspecified". Has anyone encountered this issue and found a way to resolve it?
Is the size of your view in the nib the same size as it will be in the simulator? If it's smaller, your autoresizing masks may be centering it vertically. Verify that it's the correct size, and then verify the autoresizing masks in IB are set the way you want them to be.