简体   繁体   English

视图不会滚动到所选元素QuickDialog

[英]View doesn't scroll to selected element QuickDialog

I'm trying to implement a basic QuickDialog view and the placement of the elements works fine. 我正在尝试实现基本的QuickDialog视图,并且元素的放置效果很好。 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 提前致谢

On your initWithCoder: , set the following: 在您的initWithCoder:上,设置以下内容:

self.resizeWhenKeyboardPresented =YES;

This causes the view controller to listen for keyboard notifications , and adjust the inset accordingly. 这将导致视图控制器侦听键盘通知,并相应地调整插图。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 QuickDialog在其inputaccessoryview中不显示“上一个”和“下一个”工具栏 - QuickDialog doesn't show 'prev' and 'next' toolbar as it's inputaccessoryview UI滚动视图未按预期滚动 - UI Scroll View doesn't scroll as intended 滚动视图中的堆栈视图不滚动 - Stack view within a scroll view doesn't scroll 垂直滚动视图内的水平滚动视图不起作用 - Horizontal Scroll View inside Vertical Scroll view doesn't work 表格视图不会随着画外音焦点滚动 - Table view doesn’t scroll with voiceover focus Scroll View中用于UIView的UITapGestureRecognizer不起作用 - UITapGestureRecognizer for UIView in Scroll View doesn't work ios swift - 图像滚动视图不滚动 - ios swift - scroll view over image doesn't scroll 触摸并按住然后滑动时,“滚动视图”不会滚动 - Scroll View doesn't scroll when touching and holding then swiping 在滚动之前,UITableViewCell按钮不会显示选中或取消选中状态 - UITableViewCell button doesn't show selected or deselected state until scroll 如果在滚动视图下面有一个视图,则调整滚动视图缩进不起作用 - Adjust scroll view indents doesn't work if there is a view below the scrollview
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM