• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: How to draw background image in my app window
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How to draw background image in my app window


  • Subject: Re: How to draw background image in my app window
  • From: M Pulis <email@hidden>
  • Date: Sat, 30 May 2009 23:04:47 -0700

No, the conclusion is : That _is_ the easy and straight way to do it.

Subclassing is your power and friend, my friend. Once you understand what those lines actually do, you should have a different point-of-view.

"Embrace the subclass, for they know what they are doing."  :-)

gary

On May 30, 2009, at 9:03 PM, cocoa learner wrote:

Ok. Let me try this.So conclusion is there is no easy and straight way to do
it. Have to subclass NSView.


Thanx Michael.
Cocoa.learner

On Sun, May 31, 2009 at 1:12 AM, Michael Vannorsdel <email@hidden>wrote:

You'd really be better off making an NSView subclass and having it draw the
image you want in drawRect:.


- (void)awakeFromNib
{
       myImage = [[NSImage alloc] init....

       [self setNeedsDisplay:YES];
}

- (void)drawRect:(NSRect)rect
{
NSSize isize = [myImage size];
[myImage drawInRect:[self bounds] fromRect:NSMakeRect(0.0, 0.0,
isize.width, isize.height) operation: NSCompositeCopy fraction:1.0];
}


*this was written in mail, may gave errors.

On May 30, 2009, at 11:45 AM, cocoa learner wrote:

Yah Andy and Michael you all were right. But still I have some problem.
1>. While resizing the window Image is not getting resized.
2>. My controls (NSButton and NSTextField) are not visible after the
awakeFromNib call.


_______________________________________________

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:
40gmail.com


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

_______________________________________________

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


References: 
 >How to draw background image in my app window (From: cocoa learner <email@hidden>)
 >Re: How to draw background image in my app window (From: Nick Zitzmann <email@hidden>)
 >Re: How to draw background image in my app window (From: cocoa learner <email@hidden>)
 >Re: How to draw background image in my app window (From: Michael Vannorsdel <email@hidden>)
 >Re: How to draw background image in my app window (From: cocoa learner <email@hidden>)
 >Re: How to draw background image in my app window (From: Michael Vannorsdel <email@hidden>)
 >Re: How to draw background image in my app window (From: cocoa learner <email@hidden>)

  • Prev by Date: Re: Message from view to viewController
  • Next by Date: Re: Several Questions
  • Previous by thread: Re: How to draw background image in my app window
  • Next by thread: Re: How to draw background image in my app window
  • Index(es):
    • Date
    • Thread