Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.
Oh! I completely forgot that I had the image set to an instance of NormalBlock. How I am supposed to access the methods from my NormalBlock class, if I can't have two instances, do I have to create a new class? Why can't you have two instances?
Thanks
 
You can have as many instances as you like. But you've got to hook up the connections correctly, remembering that the instances are separate from each other.

What were you trying achieve by having both a top-level object and subview?
 
I thought if I had the moveCount int in the same class it would be easier to use that int than worrying about moving an int over to another class, which brings me to another problem.
I am still trying to get the label to change so here is my new code:
I have a method in BlockHorizontal that returns the value of a static int I created:
Code:
+(int)moveCount;

This is the .m file of BlockHorizontal
Code:
static int moveCount;

- (id)init
{
    self = [super init];
    if (self) {
        // Initialization code here.
    }
    
    return self;
}


+(int)moveCount{

   
    return moveCount;


}

-(void)mouseUp:(NSEvent *)theEvent{


    moveCount++;
    NSString *testString = [NSString stringWithFormat:@"%i",moveCount];
    Block_Escape_AppDelegate *controller;
    [controller updateLabel];
    
    

}

In the App Delegate Header I have an IBOutlet and a method :
Code:
IBOutlet NSTextField *movesCountLabel;
and
Code:
-(void)updateLabel;

In the .m
Code:
-(void)updateLabel{


    int moveCount = [BlockHorizontal moveCount];
    NSString *moveCountString = [NSString stringWithFormat:@"%i",moveCount];
    [movesCountLabel setStringValue:moveCountString];



}

What's the problem this time? I get no errors but the darn label doesn't change!
Please Help, I can't figure how to get the label to change.
Thanks
 
I've considered you're whole code. But the code in red below has an issue.

Code:
-(void)mouseUp:(NSEvent *)theEvent{
    moveCount++;
    NSString *testString = [NSString stringWithFormat:@"%i",moveCount];
    [COLOR=Red]Block_Escape_AppDelegate *controller;
    [controller updateLabel];[/COLOR]
}

controller is uninitialized.
 
Here is the improved method:
Code:
-(void)mouseUp:(NSEvent *)theEvent{


    moveCount++;
    NSString *testString = [NSString stringWithFormat:@"%i",moveCount];
    Block_Escape_AppDelegate *controller = [[Block_Escape_AppDelegate alloc] init];
    [controller updateLabel];
    
    

}
The label still won't change though.. :confused:
Please Help
Thanks!
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.