BarView won't run
BarView won't run
- Subject: BarView won't run
- From: David Arnold <email@hidden>
- Date: Mon, 17 May 2010 12:54:28 -0700
Hi,
I am trying to follow the app out of chapter 15 of Cocoa Applications, a step-by-step guide, with example code at:
Examples
My BarView.m follows:
#import "BarView.h"
@implementation BarView
- (IBAction)takePercentage:(id)sender
{
[self setPercentage:[sender floatValue] ];
}
/* designated initializer */
- initWithFrame:(NSRect)r
{
self = [super initWithFrame:r];
if (self) {
[self setBoundsSize:NSMakeSize(100.0,1.0)];
}
return self;
}
- (BOOL)isOpaque
{
return YES;
}
- (void)drawRect:(NSRect)aRect
{
[[NSColor blackColor] set];
NSRectFill(NSMakeRect(0,0,percentage,1));
NSDrawWindowBackground(
NSMakeRect(percentage,0,100-percentage,1));
}
- (void)setPercentage:(float)val
{
percentage = val;
[self setNeedsDisplay:YES];
}
@end
Unfortunately, the app won't run. Moving the slider does not produce the image in the window.
Source code that I've completed can be downloaded at:
msemac.redwoods.edu/~darnold/junk/BarViewApp.zip
Can anyone give me some pointers to help get this running as designed?
Thanks,
David Arnold
College of the Redwoods
_______________________________________________
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