InAppSettingsKit icon indicating copy to clipboard operation
InAppSettingsKit copied to clipboard

Disable Multiline Text view

Open Wiwaltill opened this issue 2 years ago • 3 comments

It would be great if you could lock the input in your long text field. This would make it easier to display longer texts.

It would be an alternative to the long footer text and could be set via UserDefaults.

Wiwaltill avatar Jan 14 '23 12:01 Wiwaltill

You mean an IASKIsEditable flag in the plist? Or something more dynamic using a delegate callback?

futuretap avatar Jan 16 '23 09:01 futuretap

Yes, exactly. That's what I mean.

Wiwaltill avatar Jan 16 '23 10:01 Wiwaltill

You could subclass IASKAppSettingsViewController and override -tableView:newCellForSpecifier::

- (UITableViewCell*)tableView:(UITableView *)tableView newCellForSpecifier:(IASKSpecifier*)specifier {
    UITableViewCell *cell = [super tableView:tableView newCellForSpecifier:specifier];
    if ([specifier.type isEqualToString:kIASKTextViewSpecifier]) {
        ((IASKTextViewCell*)cell).textView.editable = NO;
    }
    return cell;
}

futuretap avatar Apr 17 '24 08:04 futuretap

I don't have that much experience with Swift and how to use it. What would an application example be like? Or how exactly could I use it for my code?

I want to use it here: image

In my code:

self.defaults.set(appInfo.releaseNotes, forKey: "dynamicTextViewUpdates")

Wiwaltill avatar May 13 '24 12:05 Wiwaltill

converted to Swift:

override func tableView(_ tableView: UITableView, newCellForSpecifier specifier: IASKSpecifier) -> UITableViewCell {
    let cell = super.tableView(tableView, newCellForSpecifier: specifier)
    if specifier.type == kIASKTextViewSpecifier {
        (cell as? IASKTextViewCell)?.textView.isEditable = false
    }
    return cell
}

futuretap avatar May 13 '24 14:05 futuretap