pickwick
pickwick

Reputation: 3154

Xcode user defined runtime attributes not working

From the posts I've found, it seems like this should work, but I can't get my runtime attribute to take. I'm developing for OSX 10.7 using Xcode 4.2.1. Here is the setting in IB:

enter image description here

Here is my code:

#import "BILAugmentedScrollView.h"

@implementation BILAugmentedScrollView {

    BOOL _ignoreScrollWheel;
}

@synthesize ignoreScrollWheel = _ignoreScrollWheel;


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

    NSLog(@"scroll ignore = %@", [NSNumber numberWithBool:self.ignoreScrollWheel]);

    if (self.ignoreScrollWheel)
        [self.nextResponder scrollWheel:theEvent];
    else
        [super scrollWheel:theEvent];
}

My output, however, is this: [7411:707] scroll ignore = 0

Any ideas? Thanks

Upvotes: 2

Views: 3686

Answers (2)

Thomas Tempelmann
Thomas Tempelmann

Reputation: 12079

I've read somewhere else that the attributes don't work when using a custom initWithCoder implementation.

(Also, kudos for using 3-letter "namespace" prefixes, as Apple (rather silently) suggested to do. I'm a bit worried that especially the Cocoa old timers keep ignoring this rule and keep using 2 letters only.)

Upvotes: 2

pickwick
pickwick

Reputation: 3154

After some experimentation, the problem seems to relate to the fact that this object ("BILAugmentedScrollView") is used in an NSCollectionView: when it stands alone, changing the attribute in IB works just fine. I don't know why the problem occurs, since each instance of the object is loaded from the nib by the collection view, but it does.

Upvotes: 0

Related Questions