ios - 如何更新 QLabelElement 的值?

标签 ios quickdialog

我已经初始化了一个 QLabelElement,然后想更新它的值。但是,在 QLabelElement 实例上显式设置 .value 属性不会更新其值。这是我正在尝试做的一个片段。 onSelected 委托(delegate)在按下 sayHello 按钮时执行,但标签元素没有更新:

@implementation 我的 Controller
{
QLabelElement *_theLabel;
}

- (id)初始化
{
self = [ super 初始化];
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"在这里有效,但在委托(delegate)中无效

self.root = 根;

回归自我;
}

最佳答案

您需要在加载后重新加载该元素的单元格。另外,要小心保留循环,使用弱变量:

__weak QLabelElement *weakLabel = _theLabel;
sayHello.onSelected = ^{
    weakLabel.value = @"Hello has been said"; //<-- this isn't working
   [self.quickDialogTableView reloadCellForElements:weakLabel, nil];
};

QD 有一个分支可以自动解决这个问题,但它肯定还没有准备好使用。

关于ios - 如何更新 QLabelElement 的值?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15819102/

相关文章:

ios - 核心图 : Autoscaling y-axis labels according to plot data

ios - 从 Action 中调用类共享函数

ios - 如何在动画期间清除 Collection View 单元格的 View /图层缓存?

ios - 将数据从 ViewControllerA 传递到 ViewControllerB(QuickDialog)

objective-c - 如何使用quickdialog实现滑动删除

ios - View 不会滚动到选定的元素 QuickDialog

ios - 从 Swift 4 中的核心数据对 TableView 中的数据进行分组

ios - 将数组从 1 个 View Controller 发送到 2 个其他单独的 View Controller

ios - 如何在 IOS 7 中使用 QuickDialog 库删除桌面填充?

ios - 如何从 iOs 中的 QuickDialog 获取值