Search code examples
xcodecocoanstextfieldblurry

Label/Text in Xcode Appears Blurry


I am trying to make a preferences view with lots of text. I cannot figure out why the text is blurry when i run the project, even though the interface builder is very sharp and clear. Here is a picture. [1]: https://i.sstatic.net/EQl6D.png

here is the code for the views:

@implementation SKMainWindowController

-(NSRect)newFrameForNewContentView:(NSView*)view {
NSWindow *window = [self window];
NSRect newFrameRect = [window frameRectForContentRect:[view frame]];
NSRect oldFrameRect = [window frame];
NSSize newSize = newFrameRect.size;
NSSize oldSize = oldFrameRect.size;

NSRect frame = [window frame];
frame.size = newSize;
frame.origin.y -= (newSize.height - oldSize.height);

return frame;

}

-(NSView *)viewForTag:(int)tag {

NSView *view = nil;
switch (tag) {
    case 0: default:
        view = welcome;
        break;
    case 1:
        view = status;
        break;
    case 2:
        view = power;
        break;
    case 3:
        view = preferences;
        break;
    case 4:
        view = about;
        break;

}

return view;

}

- (BOOL)validateToolbarItem:(NSToolbarItem *)item {

if ([item tag] == currentViewTag) return NO;
else return YES;
}

-(void)awakeFromNib {

[[self window] setContentSize:[welcome frame].size];
[[[self window] contentView] addSubview:welcome];
[[[self window] contentView] setWantsLayer:NO];

}
-(IBAction)switchWelcome:(id)sender {
int tag = [sender tag];
NSView *view = [self viewForTag:tag];
NSView *previousView = [self viewForTag:currentViewTag];
currentViewTag = tag;

NSRect newFrame = [self newFrameForNewContentView:view];

[NSAnimationContext beginGrouping];

if ([[NSApp currentEvent] modifierFlags] & NSShiftKeyMask)
    [[NSAnimationContext currentContext] setDuration:1.0];

[[[[self window] contentView] animator] replaceSubview:previousView with:view];
[[[self window] animator] setFrame:newFrame display:YES];

[NSAnimationContext endGrouping];

[welcomeButton setState:NSOnState];
[statsButton setState:NSOffState];
[powerButton setState:NSOffState];

}

I've tried changing the text fields into code by doing things like [textField setStringValue:@""];, but with no luck it is still blurry. Thanks for any help. PS: This is for cocoa, not iOS.


Solution

  • Found the answer, ended up being the stupid visual effect view not cooperating. Simple fix was to set the visual effect view to within the window, and set as inactive. (although there is now no point in having a visual effect view.)