Exemplo n.º 1
0
        public override void DidRotate(UIInterfaceOrientation fromInterfaceOrientation)
        {
            if (AppGlobal.CollectionsViewInListMode)
            {
                _listView.DidRotate(fromInterfaceOrientation);

                if (!_queueFraming)
                {
                    // Completely rebuild the gallery view behind the scenes so it doesn't have to rotate...
                    if (_galleryView != null)
                    {
                        _galleryView.View.RemoveFromSuperview();
                        _galleryView.Dispose();
                        _galleryView = null;
                    }
                    _galleryView  = new SeriesGalleryViewController(this, _listView);
                    _queueFraming = true;
                }
            }
            else
            {
                _galleryView.DidRotate(fromInterfaceOrientation);
            }
        }
Exemplo n.º 2
0
		public override void DidRotate(UIInterfaceOrientation fromInterfaceOrientation)
		{
			if(AppGlobal.CollectionsViewInListMode)
			{
				_listView.DidRotate(fromInterfaceOrientation);				
				
				if(!_queueFraming)
				{
					// Completely rebuild the gallery view behind the scenes so it doesn't have to rotate...
					if(_galleryView != null)
					{
						_galleryView.View.RemoveFromSuperview();
						_galleryView.Dispose();
						_galleryView = null;				
					}
					_galleryView = new SeriesGalleryViewController(this, _listView);
					_queueFraming = true;
				}				
			}
			else
			{
				_galleryView.DidRotate(fromInterfaceOrientation);				
			}
		}
Exemplo n.º 3
0
		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();
		}
Exemplo n.º 4
0
        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();
        }