Esempio n. 1
0
            public TableSource(ConnectMainPageViewController parent)
            {
                Parent = parent;

                // create the primary table cell
                PrimaryTableCell         = new PrimaryCell(parent.View.Bounds.Size, UITableViewCellStyle.Default, PrimaryCell.Identifier);
                PrimaryTableCell.Bounds  = parent.View.Bounds;
                PendingPrimaryCellHeight = PrimaryTableCell.Title.Frame.Bottom;// + Rock.Mobile.Graphics.Util.UnitToPx( 2 );
            }
            public override UITableViewCell GetCell(UITableView tableView, NSIndexPath indexPath)
            {
                PrimaryCell cell = tableView.DequeueReusableCell(PrimaryCell.Identifier) as PrimaryCell;

                // if there are no cells to reuse, create a new one
                if (cell == null)
                {
                    cell = new PrimaryCell(UITableViewCellStyle.Default, PrimaryCell.Identifier);
                    cell.SelectionStyle  = UITableViewCellSelectionStyle.None;
                    cell.BackgroundColor = Rock.Mobile.UI.Util.GetUIColor(ControlStylingConfig.BG_Layer_Color);
                }
                cell.Bounds = new CGRect(cell.Bounds.X, cell.Bounds.Y, tableView.Bounds.Width, cell.Bounds.Height);

                // set the image for the cell
                if (News[indexPath.Row].Image != null)
                {
                    cell.ContentView.Layer.Contents = News[indexPath.Row].Image.CGImage;
                }
                else
                {
                    cell.ContentView.Layer.Contents = ImagePlaceholder.CGImage;
                }

                cell.PrivateOverlay.Hidden = !News[indexPath.Row].News.Developer_Private;

                // scale down the image to the width of the device
                nfloat imageWidth  = cell.ContentView.Layer.Contents.Width;
                nfloat imageHeight = cell.ContentView.Layer.Contents.Height;

                nfloat imageAspect = PrivateNewsConfig.NewsMainAspectRatio;

                cell.Bounds = new CGRect(0, 0, tableView.Bounds.Width, tableView.Bounds.Width * imageAspect);
                cell.PrivateOverlay.Frame = new CGRect(0, 0, cell.Bounds.Width, 30);

                PendingCellHeight = cell.Bounds.Height;
                return(cell);
            }
            public override UITableViewCell GetCell (UITableView tableView, NSIndexPath indexPath)
            {
                PrimaryCell cell = tableView.DequeueReusableCell (PrimaryCell.Identifier) as PrimaryCell;

                // if there are no cells to reuse, create a new one
                if (cell == null)
                {
                    cell = new PrimaryCell (UITableViewCellStyle.Default, PrimaryCell.Identifier);
                    cell.SelectionStyle = UITableViewCellSelectionStyle.None;
                    cell.BackgroundColor = Rock.Mobile.UI.Util.GetUIColor( ControlStylingConfig.BG_Layer_Color );
                }
                cell.Bounds = new CGRect( cell.Bounds.X, cell.Bounds.Y, tableView.Bounds.Width, cell.Bounds.Height );

                // set the image for the cell
                if ( News[ indexPath.Row ].Image != null )
                {
                    cell.ContentView.Layer.Contents = News[ indexPath.Row ].Image.CGImage;
                }
                else
                {
                    cell.ContentView.Layer.Contents = ImagePlaceholder.CGImage;
                }

                cell.PrivateOverlay.Hidden = !News[ indexPath.Row ].News.Developer_Private;

                // scale down the image to the width of the device
                nfloat imageWidth = cell.ContentView.Layer.Contents.Width;
                nfloat imageHeight = cell.ContentView.Layer.Contents.Height;

                nfloat aspectRatio = (float) (imageHeight / imageWidth);
                cell.Bounds = new CGRect( 0, 0, tableView.Bounds.Width, tableView.Bounds.Width * aspectRatio );
                cell.PrivateOverlay.Frame = new CGRect( 0, 0, cell.Bounds.Width, 30 );

                PendingCellHeight = cell.Bounds.Height;
                return cell;
            }
            public TableSource( ConnectMainPageViewController parent )
            {
                Parent = parent;

                PrimaryTableCell = new PrimaryCell( parent.View.Bounds.Size, UITableViewCellStyle.Default, PrimaryCell.Identifier );
                PrimaryTableCell.TableSource = this;

                // take the parent table's width so we inherit its width constraint
                PrimaryTableCell.Bounds = parent.View.Bounds;

                // configure the cell colors
                PrimaryTableCell.BackgroundColor = Rock.Mobile.UI.Util.GetUIColor( ControlStylingConfig.BG_Layer_Color );
                PrimaryTableCell.SelectionStyle = UITableViewCellSelectionStyle.None;

                //PendingPrimaryCellHeight = PrimaryTableCell.BottomBanner.Frame.Bottom;
                PendingPrimaryCellHeight = PrimaryTableCell.Title.Frame.Bottom;
            }
            public TableSource ( ConnectMainPageViewController parent )
            {
                Parent = parent;

                // create the primary table cell
                PrimaryTableCell = new PrimaryCell( parent.View.Bounds.Size, UITableViewCellStyle.Default, PrimaryCell.Identifier );
                PrimaryTableCell.Bounds = parent.View.Bounds;
                PendingPrimaryCellHeight = PrimaryTableCell.Title.Frame.Bottom;// + Rock.Mobile.Graphics.Util.UnitToPx( 2 );


                // create the seperator table cell
                SeperatorTableCell = new SeperatorCell( parent.View.Bounds.Size, UITableViewCellStyle.Default, SeperatorCell.Identifier );
                SeperatorTableCell.Bounds = parent.View.Bounds;
                PendingSeperatorCellHeight = SeperatorTableCell.Title.Frame.Bottom;// + Rock.Mobile.Graphics.Util.UnitToPx( 2 );
            }
            UITableViewCell GetPrimaryCell( UITableView tableView, int rowIndex )
            {
                PrimaryCell cell = tableView.DequeueReusableCell( PrimaryCell.Identifier ) as PrimaryCell;

                // if there are no cells to reuse, create a new one
                if (cell == null || PrimaryCellDirty == true )
                {
                    PrimaryCellDirty = false;

                    cell = new PrimaryCell( UITableViewCellStyle.Default, PrimaryCell.Identifier, this );

                    // setup the members in this family
                    cell.SetFamily( Parent.Family );
                }

                cell.LayoutFamily( tableView.Bounds.Size );

                PrimaryCellHeight = cell.Bounds.Height;

                return cell;
            }