Skip to content

QRadioElement NSRangeException (fix it by your own code) #739

@hqlulu

Description

@hqlulu

Xcode 7.1 IOS 9.1

QSection *section1 = [[QSection alloc] initWithTitle:@"Radio element with push"];
QRadioElement *element0 = [[QRadioElement alloc] initWithItems:[NSArray arrayWithObjects:@"Football", @"Soccer", @"Formula 1", nil] selected:0];
[section1 addElement:element0];
[root addSection:section1];

click the row, then got an exception:

QuickDialogTableView _contentOffsetForScrollingToRowAtIndexPath:atScrollPosition:]: row (0) beyond bounds (0) for section (0)

fix it by this way:

error code at QuickDialogController.m line 116

- (void)viewWillAppear:(BOOL)animated {
    _viewOnScreen = YES;
    [self.quickDialogTableView deselectRows];
    [super viewWillAppear:animated];
    if (_root!=nil) {
        self.title = _root.title;
        self.navigationItem.title = _root.title;
        if (_root.preselectedElementIndex !=nil)
            [self.quickDialogTableView scrollToRowAtIndexPath:_root.preselectedElementIndex atScrollPosition:UITableViewScrollPositionTop animated:NO];

    }
}

set a controllerName:

QSection *section1 = [[QSection alloc] initWithTitle:@"Radio element with push"];
QRadioElement *element0 = [[QRadioElement alloc] initWithItems:[NSArray arrayWithObjects:@"Football", @"Soccer", @"Formula 1", nil] selected:0];
element0.controllerName = @"ExampleViewController";
[section1 addElement:element0];
[root addSection:section1];

code for ExampleViewController

- (void)viewWillAppear:(BOOL)animated {
    [self.quickDialogTableView reloadData];
    [super viewWillAppear:animated];
}

it can be fixed

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions