本文整理汇总了C#中UIView.CenterX方法的典型用法代码示例。如果您正苦于以下问题:C# UIView.CenterX方法的具体用法?C# UIView.CenterX怎么用?C# UIView.CenterX使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UIView
的用法示例。
在下文中一共展示了UIView.CenterX方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Initialize
void Initialize()
{
strokeEmulator = new UIView {
TranslatesAutoresizingMaskIntoConstraints = false,
BackgroundColor = UIColor.White
};
strokeEmulator.Layer.MasksToBounds = false;
strokeEmulator.Layer.ShadowOffset = new CGSize (0, 0.5f);
strokeEmulator.Layer.ShadowRadius = 0;
strokeEmulator.Layer.ShadowOpacity = 0.2f;
strokeEmulator.Layer.ShadowColor = UIColor.Black.CGColor;
avatar = new UIImageView {
TranslatesAutoresizingMaskIntoConstraints = false,
ClipsToBounds = true,
ContentMode = UIViewContentMode.ScaleAspectFill
};
ContentView.AddSubviews (strokeEmulator, avatar);
avatarCenterY = NSLayoutConstraint.Create (avatar, NSLayoutAttribute.CenterY, NSLayoutRelation.Equal, ContentView, NSLayoutAttribute.Top, 1, 0);
avatarWidth = Layout.Width (avatar, 0);
avatarHeight = Layout.Height (avatar, 0);
ContentView.AddConstraints (new NSLayoutConstraint[]{ avatarCenterY, avatarWidth, avatarHeight});
strokeEmulatorCenterY = NSLayoutConstraint.Create (strokeEmulator, NSLayoutAttribute.CenterY, NSLayoutRelation.Equal, ContentView, NSLayoutAttribute.Top, 1, 0);
strokeEmulatorWidth = Layout.Width (strokeEmulator, 0);
strokeEmulatorHeight = Layout.Height (strokeEmulator, 0);
ContentView.AddConstraints (new NSLayoutConstraint[]{ strokeEmulatorCenterY, strokeEmulatorWidth, strokeEmulatorHeight});
avatar.CenterX ();
strokeEmulator.CenterX ();
BackgroundView = new UIView ();
UIImageView cycleView = new UIImageView ();
cycleView.Image = UIImage.FromBundle ("avatarSelectionMask");
SelectedBackgroundView = cycleView;
}
示例2: Initialize
void Initialize()
{
strokeEmulator = new UIView {
TranslatesAutoresizingMaskIntoConstraints = false,
BackgroundColor = UIColor.White
};
strokeEmulator.Layer.MasksToBounds = false;
strokeEmulator.Layer.ShadowOffset = new CGSize (0, 0.5f);
strokeEmulator.Layer.ShadowRadius = 0;
strokeEmulator.Layer.ShadowOpacity = 0.2f;
strokeEmulator.Layer.ShadowColor = UIColor.Black.CGColor;
avatar = new UIImageView {
TranslatesAutoresizingMaskIntoConstraints = false,
ClipsToBounds = true,
ContentMode = UIViewContentMode.ScaleAspectFill
};
nickname = new UILabel {
TranslatesAutoresizingMaskIntoConstraints = false,
TextAlignment = UITextAlignment.Center,
Lines = 2
};
ContentView.AddSubviews (strokeEmulator, avatar, nickname);
avatarCenterY = NSLayoutConstraint.Create (avatar, NSLayoutAttribute.CenterY, NSLayoutRelation.Equal, ContentView, NSLayoutAttribute.Top, 1, 0);
avatarWidth = Layout.Width (avatar, 0);
avatarHeight = Layout.Height (avatar, 0);
ContentView.AddConstraints (new NSLayoutConstraint[]{ avatarCenterY, avatarWidth, avatarHeight});
strokeEmulatorCenterY = NSLayoutConstraint.Create (strokeEmulator, NSLayoutAttribute.CenterY, NSLayoutRelation.Equal, ContentView, NSLayoutAttribute.Top, 1, 0);
strokeEmulatorWidth = Layout.Width (strokeEmulator, 0);
strokeEmulatorHeight = Layout.Height (strokeEmulator, 0);
ContentView.AddConstraints (new NSLayoutConstraint[]{ strokeEmulatorCenterY, strokeEmulatorWidth, strokeEmulatorHeight});
avatar.CenterX ();
strokeEmulator.CenterX ();
nickNameTopSpacing = NSLayoutConstraint.Create (nickname, NSLayoutAttribute.Top, NSLayoutRelation.Equal, ContentView, NSLayoutAttribute.Top, 1, 0);
ContentView.AddConstraint (nickNameTopSpacing);
ContentView.AddConstraints (Layout.PinLeftRightEdges(nickname, 0, 0));
}