• 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
BarView won't run
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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

  • Follow-Ups:
    • Re: BarView won't run
      • From: Reinhard Segeler <email@hidden>
  • Prev by Date: Project Builder Files -> XCode
  • Next by Date: Re: creating a UITableView on an "Utility application" project
  • Previous by thread: Re: Project Builder Files -> XCode
  • Next by thread: Re: BarView won't run
  • Index(es):
    • Date
    • Thread