Re: Creating a Big and Resizable Question Mark in the Middle of a View
Re: Creating a Big and Resizable Question Mark in the Middle of a View
- Subject: Re: Creating a Big and Resizable Question Mark in the Middle of a View
- From: Ken Ferry <email@hidden>
- Date: Sun, 15 Aug 2010 19:36:15 -0700
Hi Peter,
That code is fine, but FYI, it can be written more simply and with perhaps
slightly improved semantics:
[imageView setImage:[NSImage imageNamed:@"Question Mark"]];
Semantically, it's very similar, but the above will not actually read the
file from disk until the image data is needed. Perhaps your app can start
up faster as a result.
-Ken
On Sat, Aug 14, 2010 at 9:55 PM, Peter Zegelin
<email@hidden>wrote:
> Yep that worked:
>
> NSString *file = [[NSBundle mainBundle]pathForResource:@"Question
> Mark" ofType:@"pdf"];
> NSData *data = [NSData dataWithContentsOfFile:file];
> NSImage *image = [[NSImage alloc] initWithData:(NSData *)data];
> [imageView setImage:image];
>
> (I'm using GC).
>
> thanks!
>
>
>
> On 15/08/2010, at 2:08 PM, Quincey Morris wrote:
>
> > On Aug 14, 2010, at 20:28, Peter Zegelin wrote:
> >
> >> I would like the view to just have a large and resizable question mark
> in the middle but am not sure how to create one. None of the IB controls
> seem to fit the bill and before I get into using an NSTextView - which I
> haven't used before and it looks complicated and overkill - I was wondering
> if there is a simpler way to do this.
> >
> > Sounds like a job for NSImageView (with the appropriate scaling option),
> with content supplied by a PDF file.
> >
>
> kind regards,
>
> Peter Zegelin
> www.fracturedsoftware.com
>
> _______________________________________________
>
> Cocoa-dev mailing list (email@hidden)
>
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
>
> Help/Unsubscribe/Update your Subscription:
>
> This email sent to email@hidden
>
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden