0

I'm trying to implement a basic QuickDialog view and the placement of the elements works fine. But when I select an element the view won't scroll it into view. I thought the library would do this by itself or am I missing something?

Here is my code:

- (id)initWithCoder:(NSCoder *)aDecoder {
    if ((self = [super initWithCoder:aDecoder])) {
        QRootElement *root = [[QRootElement alloc] init];

        root.title = @"";
        root.grouped = YES;        

        self.root = root;
    }
    return self;
}

- (void)viewDidLoad
{
    [super viewDidLoad];
    // Do any additional setup after loading the view.    

    QSection *driverSection = [[QSection alloc] initWithTitle:@"xxx"];
    QEntryElement *lblDriverSsn = [[QEntryElement alloc] initWithTitle:@"xxx" Value:@""];
    lblDriverSsn.key = @"driverSsn";    

    QSection *vehicleSection = [[QSection alloc] initWithTitle:@"xxx"];

    NSArray *component1 = @[@"xxx", @"xxx"];
    QPickerElement *EventDescriptionPicker = [[QPickerElement alloc] initWithTitle:@"xxx" items:@[component1] value:@""];
    EventDescriptionPicker.key = @"eventDescription";

    NSMutableArray *speedValues = [[NSMutableArray alloc]init];
    for (int i = 0; i <= 201; i+=5)
    {
        [speedValues addObject:[NSString stringWithFormat:@"%d%@", i,@" km/h"]];
    }
    QPickerElement *vehicleSpeed = [[QPickerElement alloc] initWithTitle:@"xxx" items:@[speedValues] value:@""];

    self.damageReported = [[QBooleanElement alloc] initWithTitle:@"xxx" BoolValue:NO];
    self.damageReported.onImage = [UIImage imageNamed:@"imgOn"];
    self.damageReported.offImage = [UIImage imageNamed:@"imgOff"];
    self.damageReported.controllerAction = @"showReportNumber:";   

    QEntryElement *lblReportNumber = [[QEntryElement alloc] initWithTitle:@"xxx" Value:@""];
    lblDriverSsn.key = @"reportNumber";

    //Sections
    [driverSection addElement:lblDriverSsn];

    [self.root addSection:driverSection];   

    [vehicleSection addElement:EventDescriptionPicker];
    [vehicleSection addElement:vehicleSpeed];
    [vehicleSection addElement:self.damageReported];
    [vehicleSection addElement:lblReportNumber];

    [self.root addSection:vehicleSection];


}

Am I missing something here? Thanks in advance

PaperThick
  • 2,749
  • 4
  • 24
  • 42
  • What do you mean by "Scroll it into view" ? What behavior are you expecting? If you're selecting the element, isn't it already being displayed? – Eduardo Scoz Dec 05 '13 at 18:40
  • @EduardoScoz Hi, yes it is not "Hidden" if that is what you mean, but if the TextField is far down in the view it is beeing blocked by the kayboard and the scroll doesn't scroll it above the keyboard – PaperThick Dec 06 '13 at 09:36

1 Answers1

1

On your initWithCoder: , set the following:

self.resizeWhenKeyboardPresented =YES;

This causes the view controller to listen for keyboard notifications , and adjust the inset accordingly.

Eduardo Scoz
  • 24,653
  • 6
  • 47
  • 62