View Single Post
Meds

 
Member Since: Sep 14, 2008
Posts: 18
Meds is on a distinguished road

Meds is offline
All right. I'm trying to work with custom views a little and this is confusing me.

I created the custom view and wrote the files, and this is my app controller calling a method on an object of my custom class:

Code:
- (IBAction)fillBoxes:(id)sender {
	
	float topCircleValue = [topCircle floatValue];
	float bottomCircleValue = [bottomCircle floatValue];
	
	NSLog(@"We're in! %f", topCircleValue);
	
	[leftFillBox drawFillWithSliderValue:topCircleValue];
	[rightFillBox drawFillWithSliderValue:bottomCircleValue];
left and rightFillBox are my objects of class CustomView. Here's my CustomView.h file:

Code:
#import <Cocoa/Cocoa.h>


@interface CustomView : NSView {

}

- (void)drawFillWithSliderValue:(CGFloat)sliderValue;

@end
And .m file:

Code:
#import "CustomView.h"


@implementation CustomView

- (void)drawFillWithSliderValue:(CGFloat)sliderValue {
	
	int sliderValueWholeNumber = (int)sliderValue;
	
	NSLog(@"%d", sliderValueWholeNumber);
	
	NSColor* red = [NSColor redColor];
	[red set];
	
	NSRect selfTest = [self bounds];

        NSLog(@"%@", NSStringFromRect(selfTest));
	
	NSRectFill(selfTest);
	
}
All of the NSLog's are behaving exactly as they should. My objective is to get it to draw a rect using the bounds with the height coordinate replaced with sliderValueWholeNumber, but I can't even get this simple test to work. Every time, nothing. It's not filling the custom view area with red. What am I doing wrong?
QUOTE Thanks