更新约束值不起作用IOS 9 Beta

时间:2015-08-05 18:40:01

标签: ios objective-c iphone autolayout

- (void)viewDidLoad {
    [super viewDidLoad];
    self.sendMessageButton.layer.cornerRadius = 3;
    self.messageText.layer.cornerRadius = 3;
    self.imageView.layer.cornerRadius = 3;
    self.messageText.delegate = self;
    self.objectImage.hidden = YES;
    self.sendImageButton.hidden = NO;
    self.imageView.hidden= NO;
    [self updateViewsHeight];

}

-(void)updateViewsHeight{
        NSLog(@"--------------------- %f -----------------------", self.view.frame.size.height);

        if (self.view.frame.size.height == 568.0){ //5s & 5
            self.textViewHeight.constant = 500.f;
            self.ImageViewHeight.constant = 10.f;
            [super updateViewConstraints];}
    }

这不会更新约束。她得到了原来的高度但是我确定if中的代码被读取了,因为当我在应用程序中放入一个中断时会破坏它。

这是我的财产:

@property (weak, nonatomic) IBOutlet NSLayoutConstraint *imageViewHeight;
@property (weak, nonatomic) IBOutlet NSLayoutConstraint *textViewHeight;

2 个答案:

答案 0 :(得分:0)

显然,发生了什么是IOS 9 Beta中的错误。当您删除常量并删除设备应用程序时,代码可以正常工作。色调

答案 1 :(得分:0)

试试这个

        static Dictionary<string, Tuple<int, string>> GetDict(DataTable dt)
    {
        return dt.AsEnumerable()
          .ToDictionary<DataRow, string, Tuple<int, string>>(
            row => row.Field<string>(0), row => new Tuple<int, string>
                (row.Field<int>(1), row.Field<string>(2)) );
    }
相关问题