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


C# UIButton.InsertSubviewAbove方法代码示例

本文整理汇总了C#中UIButton.InsertSubviewAbove方法的典型用法代码示例。如果您正苦于以下问题:C# UIButton.InsertSubviewAbove方法的具体用法?C# UIButton.InsertSubviewAbove怎么用?C# UIButton.InsertSubviewAbove使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在UIButton的用法示例。


在下文中一共展示了UIButton.InsertSubviewAbove方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: ViewDidLoad

		public override void ViewDidLoad()
        {
			base.ViewDidLoad();
			
			AppDelegate.NavigationBar.SetBackButtonOn(this);
			
			// Initialize the alternate list selector
			_listView = new SeriesListViewController(this);
			_listView.View.AutoresizingMask = UIViewAutoresizing.FlexibleHeight | UIViewAutoresizing.FlexibleWidth;
			_listView.View.Frame = new RectangleF(0, 0, View.Frame.Width, View.Frame.Height);
						
			// Initialize the art gallery (already in background)
			_galleryView = new SeriesGalleryViewController(this, _listView);
			_galleryView.View.AutoresizingMask = UIViewAutoresizing.FlexibleHeight | UIViewAutoresizing.FlexibleWidth;
			_galleryView.View.Frame = new RectangleF(0, 0, View.Frame.Width, View.Frame.Height);		
						
			// http://stackoverflow.com/questions/1718495/why-does-viewdidappear-not-get-triggered
			this.View.AddSubview(AppGlobal.CollectionsViewInListMode ? _listView.View : _galleryView.View);
									
			// http://www.grokkingcocoa.com/a-simple-way-to-animate-a-u.html
			// http://ykyuen.wordpress.com/2010/06/11/iphone-adding-image-to-uibarbuttonitem/
			var listViewImage = UIImage.FromBundle("Images/gallery/listView.png");
			var listViewImageHighlighted = UIImage.FromBundle("Images/gallery/listViewHighlighted.png");
						
			_buttonFrame = new RectangleF(0, 0, 29, 30);			
			_buttonListThumb = new UIImageView(listViewImage);
			listViewImage.Dispose();
			_buttonListThumb.Frame = _buttonFrame;
			_buttonListThumb.Hidden = AppGlobal.CollectionsViewInListMode;
			
			var buttonListHighlight = new UIImageView(listViewImageHighlighted);
			listViewImageHighlighted.Dispose();
			buttonListHighlight.Frame = _buttonFrame;			
			
			// Build a thumbnail button for the selected page's piece
			// TODO duplicate with code to select a piece in the list view
			// TODO shouldn't have to size something from a factory method!
			var thumb0 = ImageFactory.LoadRoundedThumbnail(_series.Pieces[_page]);
			var thumb1 = ImageHelper.ImageToFitSize(thumb0, _listViewImageSize);
			thumb0.Dispose();
			_buttonGalleryThumb = new UIImageView(thumb1);
			thumb1.Dispose();
			
			_buttonGalleryThumb.Hidden = !AppGlobal.CollectionsViewInListMode;
			_buttonGalleryThumb.Frame = _buttonFrame;
			
			// Wire up the flip button
			_buttonInner = UIButton.FromType(UIButtonType.Custom);
			_buttonInner.UserInteractionEnabled = true;
			_buttonInner.Bounds = _buttonListThumb.Bounds;
			_buttonInner.AddSubview(_buttonListThumb);			
			_buttonInner.AddSubview(_buttonGalleryThumb);
			_buttonInner.AddTarget(delegate { 
				_buttonInner.InsertSubviewAbove(_buttonListThumb, buttonListHighlight);
				buttonListHighlight.RemoveFromSuperview();
				Flip();
			}, UIControlEvent.TouchUpInside);
			_buttonInner.AddTarget(delegate { 
				_buttonInner.InsertSubviewAbove(_buttonListThumb, buttonListHighlight);
				buttonListHighlight.RemoveFromSuperview();
				Flip();
			}, UIControlEvent.TouchUpOutside);
			_buttonInner.AddTarget(delegate { 
				_buttonInner.InsertSubviewAbove(buttonListHighlight, _buttonListThumb);
				_buttonListThumb.RemoveFromSuperview();
			}, UIControlEvent.TouchDown);
			
			// Wire up the series info button
			var info = UIButton.FromType(UIButtonType.InfoLight);
			info.UserInteractionEnabled = true;
			info.AddTarget((s, a)=> { ShowSeriesDetails(); }, UIControlEvent.TouchUpInside);
			
			_infoButton = new UIBarButtonItem(info);
			_listButton = new UIBarButtonItem(_buttonInner);
			
			LayoutBarButtonItems();
		}
开发者ID:modulexcite,项目名称:artapp,代码行数:77,代码来源:SeriesViewController.cs


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