• 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: Dividing NSView to subviews
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Dividing NSView to subviews


  • Subject: Re: Dividing NSView to subviews
  • From: Peter N Lewis <email@hidden>
  • Date: Fri, 24 Apr 2009 13:10:56 +0800


On 23/04/2009, at 14:11 , Naresh Kongara wrote:

I have a NSView which i want to divide into to required sub views.

I implemented it using NSView's dataWithPDFInsideRect: (NSRect )aRect, i.e constructed a image view with the data i got .
This process is taking long time if the view is large one..


Is there any other way to get the required part of a View.


Ironically (or perhaps fortuitously) I've been dealing with this issue reasonly and just posted a result of my research and experiments at

<http://www.stairways.com/blog/2009-04-21-nsimage-from-nsview>

The end result was a category on NSView:

- (NSImage *)imageWithSubviews
{
NSSize mySize = self.bounds.size;
NSSize imgSize = NSMakeSize( mySize.width, mySize.height );

NSBitmapImageRep *bir = [self bitmapImageRepForCachingDisplayInRect: [self bounds]];
[bir setSize:imgSize];
[self cacheDisplayInRect:[self bounds] toBitmapImageRep:bir];

NSImage* image = [[[NSImage alloc]initWithSize:imgSize] autorelease];
[image addRepresentation:bir];
return image;
}
Based on Greg Knobs post <http://www.cocoabuilder.com/archive/message/cocoa/2007/11/17/193329 >.
Enjoy,
Peter.


--
     Run macros from your iPhone with Keyboard Maestro Control!
         or take a break with Derzle for your iPhone

Keyboard Maestro <http://www.keyboardmaestro.com/> Macros for your Mac
Aragom Space War <http://www.stairways.com/iphone/aragom> Don't get killed!
Derzle <http://www.stairways.com/iphone/derzle> Enjoy a relaxing puzzle.
<http://www.stairways.com/> <http://download.stairways.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


  • Follow-Ups:
    • Re: Dividing NSView to subviews
      • From: Naresh Kongara <email@hidden>
References: 
 >Dividing NSView to subviews (From: Naresh Kongara <email@hidden>)

  • Prev by Date: Re: CF autorelease?
  • Next by Date: RE: Bindings making NSNumberFormatter strange
  • Previous by thread: Re: Dividing NSView to subviews
  • Next by thread: Re: Dividing NSView to subviews
  • Index(es):
    • Date
    • Thread