Exemplo n.º 1
0
        private NSView CreateBookViewWithIndex(Publication publication, int index)
        {
            var bookView = new PublicationView(BookFrameByIndex(index));

            bookView.InitializeValue(publication, index);

            return(bookView);
        }
        NSView CreateBookViewWithIndex(Publication publication, int index)
        {
            var frame    = new CGRect(0, 0, PUBLICATION_COVER_WIDTH, PUBLICATION_VIEW_HEIGHT);
            var location = new CGPoint();

            if (index != 0)
            {
                location.X = index * (PUBLICATION_COVER_WIDTH + PUBLICATION_COVER_HORIZONTAL_SPACING);
                nfloat ySpace = (bookScrollView.Bounds.Size.Height - PUBLICATION_VIEW_HEIGHT) / 2;
                location.Y = ySpace > 0?ySpace:0;
            }

            frame.Location = location;

            var bookView = new PublicationView(frame);

            bookView.InitializeValue(publication, index);

            return(bookView);
        }