如何改变分割单元中1段的属性?我找不到。这是我尝试过的:
- 谷歌
- 一些实验:
_segmentedcell.SelectedSegment
(不工作)
这是我的appdelegate。h
#import <Cocoa/Cocoa.h>
#import <WebKit/WebKit.h>
@interface AppDelegate : NSObject <NSApplicationDelegate>
@property (weak) IBOutlet NSSegmentedCell *BackForward;
@property (weak) IBOutlet WebView *WebBrowser;
- (IBAction)BackForwardAction:(id)sender;
@property (assign) IBOutlet NSWindow *window;
@end
这是我的appdelegate。m
#import "AppDelegate.h"
@implementation AppDelegate
- (void)applicationDidFinishLaunching:(NSNotification *)aNotification
{
// Insert code here to initialize your application
}
- (IBAction)BackForwardAction:(id)sender {
if (_BackForward.selectedSegment == 0) {
_WebBrowser.goBack;
if (_WebBrowser.canGoBack == false) {
//here it does need to disable segment 0
}
} else if (_BackForward.selectedSegment == 1) {
_WebBrowser.goForward;
if (_WebBrowser.canGoForward == false) {
// here it does neet to disable segment 1
}
}
}
@end
我不知道为什么Google没有引导您找到NSSegmentedControl
的类参考,但是:
[_BackForward setEnabled:NO forSegment:0];