#import <Cocoa/Cocoa.h>
@interface TextNoOutletAppDelegate : NSObject {
NSWindow *window;
}
@property (assign) IBOutlet NSWindow *window;
@end
Replace that code with:
#import <Cocoa/Cocoa.h>
@interface TextNoOutletAppDelegate : NSObject
// Few lines removed from this place
@property (assign) IBOutlet NSWindow *window;
// New property added here
@property (copy) NSString *text;
@end
Press Control-S to save the header file. Press Alt-Cmd-Up to switch to the m-file. Synthesize the property:
#import "TextNoOutletAppDelegate.h"
@implementation TextNoOutletAppDelegate
@synthesize window;
// synthesize new property
@synthesize text;
- (void)applicationDidFinishLaunching:(NSNotification *)aNotification {
// Insert code here to initialize your application
}
@end
New lines added to the source code have been marked with the comments. Press Control-S here to save the modification.
#import <Cocoa/Cocoa.h>
@interface TextNoOutletAppDelegate : NSObject
@property (assign) IBOutlet NSWindow *window;
@property (copy) NSString *text;
// New property for the Slider control
@property (assign) NSInteger value;
@end
It should be synthesized in the implementation file:
#import "TextNoOutletAppDelegate.h"
@implementation TextNoOutletAppDelegate
@synthesize window;
@synthesize text;
// Added line to synthesize new property
@synthesize value;
- (void)applicationDidFinishLaunching:(NSNotification *)aNotification {
// Insert code here to initialize your application
}
@end
In Interface Builder I add the slider and one more Label. Then I bind the slider with "value" property:
Have a question about something in this article? You can receive help directly from the article author. Sign up for a free trial to get started.
Comments (0)