简体   繁体   English

在Xcode 7 iOS9中确定时,UIScrollView在Xcode8,iOS10中没有响应

[英]UIScrollView not responding in xcode8, ios10 when it was OK in Xcode 7 ios9

Inside my app, I have a UIViewController which is composed of the following elements: 在我的应用程序中,我有一个UIViewController,它由以下元素组成:

  1. Two buttons and a UILabel on the top part of it 两个按钮和顶部的UILabel

  2. A UISCrollView which contains different elements, UILabels, Buttons and more. 一个UISCrollView,其中包含不同的元素,UILabel,Button等。

I include a screenshot for you to understand the structure. 我提供了一个屏幕截图,供您了解结构。

IB的屏幕截图

When compiled in Xcode 7 with iOS 9 SDK everything has been working properly. 在使用iOS 9 SDK的Xcode 7中进行编译时,所有功能都可以正常运行。 But now I am trying to update the app for it to work in iOS 10 and the screen does not respond when trying to scroll. 但是,现在我正在尝试更新该应用程序,使其能够在iOS 10中运行,并且在尝试滚动时屏幕没有响应。 The two buttons outside the UIScrollView still are working OK. UIScrollView外部的两个按钮仍然可以正常工作。

The only warning I am receiving when running on the iPhone is: [LayoutConstraints] Unable to simultaneously satisfy constraints. 在iPhone上运行时,我收到的唯一警告是:[LayoutConstraints]无法同时满足约束。 Probably at least one of the constraints in the following list is one you don't want. 以下列表中至少有一个约束是您不想要的约束。 Try this: (1) look at each constraint and try to figure out which you don't expect; 尝试以下操作:(1)查看每个约束,并尝试找出不期望的约束; (2) find the code that added the unwanted constraint or constraints and fix it. (2)查找添加了一个或多个不必要约束的代码并进行修复。 ( "", "" ) (“”,“”)

IB also tells me that there is a mistake with the constraints (red indicator). IB还告诉我约束条件有误(红色指示符)。 It tells that ScrollVertical (UISCrollView) need constraints for: Y position or Height. 它告诉ScrollVertical(UISCrollView)需要以下约束:Y位置或高度。 But I'm quite sure that this message was shown in xcode7-ios9, when everything worked properly. 但是我很确定当一切正常时,此消息已显示在xcode7-ios9中。

Any idea what is happening? 知道发生了什么吗? Any idea would be appreciated, since I have been struggling with this for a day. 任何想法都将不胜感激,因为我已经为此努力了一天。

This arre the constraints expanded: 这对约束扩展了:

在此处输入图片说明

Thanks a lot 非常感谢

Maybe you should expend the Constraints node in your view hierarchy, and capture the constraints your have defined in Xcode, and paste it here. 也许您应该在视图层次结构中扩展“ Constraints节点,捕获在Xcode中定义的约束,然后将其粘贴到此处。 That would be helped for issue tracking. 这将有助于问题跟踪。

Same problem here, but with a twist. 这里同样的问题,但有一个转折。 On first startup of subscreen scrolling won't work. 第一次启动子屏幕时,滚动将不起作用。 After rotating the device it works fine. 旋转设备后,它可以正常工作。 It makes no difference if it starts on portrait or landscape oritation. 无论从纵向还是横向开始,都没有什么区别。 after a rotating the app works fine. 旋转后,应用程序运行正常。 No problems with IOS9 and IOS8. IOS9和IOS8没问题。

#import <QuartzCore/QuartzCore.h>
#import "ApDetailTableViewController.h"
#import "ApMailViewController.h"
#import "ApApplicatieData.h"
#import "ztatz_constants.h"
#import "ztatz_macro.h"

@interface ApDetailTableViewController ()
@property (weak, nonatomic) IBOutlet UIView *contentUIView;
@property (weak, nonatomic) IBOutlet UIScrollView *apUIScrolView;
@property (weak, nonatomic) IBOutlet NSLayoutConstraint *contentViewHeightConstraint;
@property (weak, nonatomic) IBOutlet UIView *lastSeperatorView;

@property (weak, nonatomic) IBOutlet UILabel *applicatienaam;
@property (weak, nonatomic) IBOutlet UILabel *san;
@property (weak, nonatomic) IBOutlet UILabel *beschrijving;
@property (weak, nonatomic) IBOutlet UILabel *status;
@property (weak, nonatomic) IBOutlet UILabel *updatetime;
@property (weak, nonatomic) IBOutlet UILabel *afdelingsnaam;
@property (weak, nonatomic) IBOutlet UILabel *contactpersoon;
@property (weak, nonatomic) IBOutlet UILabel *email;
@property (weak, nonatomic) IBOutlet UILabel *controledatum;

@end

@implementation ApDetailTableViewController


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

    self.applicatienaam.text = self.apDataForDetails.applicatienaam;
    self.san.text = self.apDataForDetails.san;
    self.beschrijving.text = self.apDataForDetails.beschrijving;
    self.status.text = self.apDataForDetails.status;
    self.updatetime.text = self.apDataForDetails.updatetime;
    self.afdelingsnaam.text = self.apDataForDetails.afdelingsnaam;
    self.contactpersoon.text=self.apDataForDetails.contactpersoon;
    self.email.text=self.apDataForDetails.email;
    self.controledatum.text=self.apDataForDetails.controledatum;

    // start a top of scroll view
   self.automaticallyAdjustsScrollViewInsets = NO;
}





-(void) viewDidLayoutSubviews {
    [super viewDidLayoutSubviews];
    // limit the slack space at the end of the scroll view.
    DLog(@"y = %f\n", self.lastSeperatorView.frame.origin.y);
    self.contentViewHeightConstraint.constant =                self.lastSeperatorView.frame.origin.y+4;

}

@end

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM