• 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
Fill an NSView with a tile of NSImage
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Fill an NSView with a tile of NSImage


  • Subject: Fill an NSView with a tile of NSImage
  • From: malcom <email@hidden>
  • Date: Sat, 25 Feb 2006 01:13:20 +0100

Hello,
I've a problem with an NSView and NSImage.
I would to fill an NSView using a small image by duplicating it
n-times (tile?). I've tried using this code:

- (void)drawRect:(NSRect)rect {
int k;
	NSRect tmp = [self bounds];
	int repeat = (rect.size.width/7)+10;
	for (k=4; k < repeat; k++) {
		 [[NSImage imageNamed:@"bar.tif"] drawInRect: tmp fromRect: [self
bounds] operation: NSCompositeSourceOver fraction:1.0];
		tmp.origin.x = tmp.origin.x+7;

	}
}

(or replacing [self bounds] with rect). Unfortunatly it seems to be
buggy because I've some problem when I try to add a control (ex.
search field) in front of the view.
This is an example: http://img507.imageshack.us/img507/847/prova8lv.jpg

I've solved a part of this problem by adding:

- (BOOL) isOpaque {
	return YES;
}

but it does not works very well.
Now the background image draws well but I've still problems with focus ring.
This is an example:
http://img517.imageshack.us/img517/129/prova23of.jpg

Is there another way to solve this problem?
I would to replicate the background image as like in NetnewsWire
but... nothing :(
Anyone can help me?
thx
malcom
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Follow-Ups:
    • Re: Fill an NSView with a tile of NSImage
      • From: "John C. Randolph" <email@hidden>
  • Prev by Date: Re: using NSMutableDictionary in place of NSDictionary
  • Next by Date: Mute Other Applications Audio?
  • Previous by thread: Re: Solved: Link & Table Cursors in NSTextView
  • Next by thread: Re: Fill an NSView with a tile of NSImage
  • Index(es):
    • Date
    • Thread