【发布时间】:2017-05-26 06:54:50
【问题描述】:
我正在使用 Xamarin.IOS,我在 UIScrollView 中有 UIprogressView,其中也有两个按钮。
我在 ViewWillLayoutSubviews 方法中通过代码设置 UIprogressView 框架:
CGRect newFrame;
newFrame.Width = MyScrollView.Frame.Width / 2;
newFrame.Location = new CGPoint(0, NextButton.Frame.Y);
MyProgressView.Frame = newFrame;
MyProgressView.Transform = CGAffineTransform.MakeScale(1, 20f);
MyProgressView.TrackTintColor = CustomColors.CustomColors.GetColor(CustomColors.CustomColors.ColorGray);
MyProgressView.ProgressTintColor = CustomColors.CustomColors.GetColor(CustomColors.CustomColors.ColorBlue);
问题是当我将设备从纵向旋转到横向时,只有进度视图会消失。同时下一个按钮在那里,进度视图和下一个按钮都有相同的 Y!。
如果我停止使用MyProgressView.ProgressTintColor,我可以看到旋转后的进度视图,但它没有缩放。
知道怎么解决吗?
这就是我说的 UIProgressView:
【问题讨论】:
-
使用AutoLayout会更好。
-
newFrame.Location = new CGPoint(0, NextButton.Frame.Y + you Buttons height)。试试这个
标签: ios xamarin.ios rotation scale uiprogressview