我有一個非常簡單的應用程序。它獲取滑塊值並將其顯示在文本框中。接口和實現情況如下:Objective-C獲取滑塊值並將其顯示在文本框中
#import <Foundation/Foundation.h>
@interface HelloWorld : NSObject
@property (assign) IBOutlet NSTextField *Tf;
@property (assign) IBOutlet NSSliderCell *Sc;
@end
#import "HelloWorld.h"
@implementation HelloWorld
@synthesize Tf;
@synthesize Sc;
- (IBAction)Pressed:(id)sender {
[Tf setStringValue:@"Hey"];
}
- (IBAction)Scroll:(id)sender {
[Tf setStringValue: [Sc indexOfTickMarkAtPoint]];
}
@end
的UI:
問題: 應用崩潰,當我移動滑塊。
什麼indexOfTickMarkAtPoint回來?它聽起來像一個int? – bigkm 2012-07-29 11:52:00