1

我是新手。我对 NSMatrix 有疑问。我创建了多个 NSMatrix 但我想先加载,他们没有检查。我使用此代码创建它们,但它总是检查。

 prototype= [[NSButtonCell alloc] init];
    [prototype setTitle:@""];
    [prototype setButtonType:NSRadioButton];
    NSRect matrixRect = NSMakeRect(400, textfield_Y, 50, 20);
    myMatrix = [[NSMatrix alloc] initWithFrame:matrixRect
                                          mode:NSRadioModeMatrix
                                     prototype:(NSCell *)prototype
                                  numberOfRows:1
                               numberOfColumns:1];
    [myMatrix setTag:300+i];
    //[myMatrix setAction:@selector(radioButtonClicked:)];
    [myMatrix setTarget:self];
    NSArray *cellArray = [myMatrix cells];
    [[cellArray objectAtIndex:0] setTag:0];
    [guiView addSubview:myMatrix];
    [prototype release];
    [myMatrix release];

有任何想法吗?非常感谢

4

1 回答 1

2

在 NSButtonCell 上,您将使用以下setState方法NSCell

[prototype setState:NSOffState]

于 2013-08-08T08:56:33.097 回答