当前位置: 首页>>代码示例>>C#>>正文


C# UIView.CenterX方法代码示例

本文整理汇总了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;
		}
开发者ID:richardboegli,项目名称:KinderChat,代码行数:37,代码来源:AvatarCollectionViewCell.cs

示例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));
		}
开发者ID:tamifist,项目名称:KinderChat,代码行数:41,代码来源:UICollectionViewFriendCell.cs


注:本文中的UIView.CenterX方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。