futuretap/InAppSettingsKit

Disable Multiline Text view

Wiwaltill opened this issue · 5 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.

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

Yes, exactly. That's what I mean.

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;
}

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")

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
}