我已经初始化了一个 QLabelElement,然后想更新它的值。但是,在 QLabelElement 实例上显式设置 .value 属性不会更新其值。这是我正在尝试做的一个片段。onSelected 委托在按下 sayHello 按钮时执行,但标签元素没有更新:
@implementation 我的控制器
{
QLabelElement *_theLabel;
}
- (id)初始化
{
self = [超级初始化];
QRootElement *root = [[QRootElement alloc] init];
QSection *section = [[QSection alloc] init];
_theLabel = [[QLabelElement alloc] initWithTitle:@"标签"值:@""];
QSection *sectionButton = [[QSection alloc] init];
QButtonElement *sayHello = [[QButtonElement alloc] initWithTitle:@"Say Hello"];
[添加到根目录的部分和控件等]
sayHello.onSelected = ^{
_theLabel.value = @"你好已经说过"; //<-- 这不起作用
};
//设置 _theLabel.value = @"Hello has been said" 在这里有效,但在委托中无效
self.root = 根;
回归自我;
}