Skip to content

Commit 71c4f21

Browse files
committed
Correct frame size on opening
1 parent 272c89f commit 71c4f21

File tree

3 files changed

+8
-8
lines changed

3 files changed

+8
-8
lines changed

Naxam.ExpandingCollection.iOS/BasePageCollectionCell.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ public class BasePageCollectionCell : UICollectionViewCell
1515
/// </summary>
1616
/// <value>The Y Offset.</value>
1717
[Export("yOffset"), Browsable(true), DisplayName("Y Offset")]
18-
public nfloat YOffset { get; set; }
18+
public nfloat YOffset { get; set; } = 40;
1919

2020
const string BACK_CONTAINER_KEY = "backContainerViewKey";
2121

@@ -123,7 +123,7 @@ public void CellIsOpen(bool isOpen, bool animated = true)
123123
var widthConstant = BackContainerView.GetConstraint(NSLayoutAttribute.Width);
124124
if (widthConstant != null)
125125
{
126-
widthConstant.Constant = isOpen == true ? FrontContainerView.Bounds.Size.Height + YOffset : FrontContainerView.Bounds.Size.Height;
126+
widthConstant.Constant = isOpen == true ? FrontContainerView.Bounds.Size.Width + YOffset : FrontContainerView.Bounds.Size.Width;
127127
}
128128

129129
var heightConstant = BackContainerView.GetConstraint(NSLayoutAttribute.Height);
@@ -141,7 +141,7 @@ public void CellIsOpen(bool isOpen, bool animated = true)
141141
Animate(
142142
duration: 0.3,
143143
delay: 0,
144-
options: default(UIViewAnimationOptions),
144+
options: UIViewAnimationOptions.TransitionNone,
145145
animation: ContentView.LayoutIfNeeded,
146146
completion: null);
147147
}

Naxam.ExpandingCollection.iOS/PageCollectionLayout.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ public class PageCollectionLayout : UICollectionViewFlowLayout
1313
public nfloat ScalingOffset { get; set; } = 200f;
1414
public nfloat MinimumScaleFactor { get; set; } = 0.9f;
1515
public nfloat MinimumAlphaFactor { get; set; } = 0.3f;
16-
public bool ScaleItems { get; set; } = false;
16+
public bool ScaleItems { get; set; } = true;
1717

1818
public PageCollectionLayout(NSCoder coder) : base(coder)
1919
{

Naxam.ExpandingCollection.iOS/TransitionDriver.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ public void PushTransitionAnimationIndex(int currentIndex,
7171
UIView.Animate(
7272
duration: duration,
7373
delay: 0,
74-
options: default(UIViewAnimationOptions),
74+
options: UIViewAnimationOptions.TransitionNone,
7575
animation: () =>
7676
{
7777
view.LayoutIfNeeded();
@@ -117,7 +117,7 @@ public void PopTransitionAnimationContantOffset(nfloat offset, UIImage backImage
117117
copyCell.BackContainerView.AnimationCornerRadius(copyCell.BackContainerView.Layer.CornerRadius, duration: duration);
118118
copyCell.FrontContainerView.AnimationCornerRadius(copyCell.FrontContainerView.Layer.CornerRadius, duration: duration);
119119

120-
UIView.Animate(duration: duration, delay: 0, options: default(UIViewAnimationOptions), animation: () =>
120+
UIView.Animate(duration: duration, delay: 0, options: UIViewAnimationOptions.TransitionNone, animation: () =>
121121
{
122122
if (rightCell != null)
123123
{
@@ -256,7 +256,7 @@ private void OpenFrontViewConfigureConstraints(BasePageCollectionCell cell, nflo
256256
var widthConstraint = cell.FrontContainerView.GetConstraint(NSLayoutAttribute.Width);
257257
if (widthConstraint != null)
258258
{
259-
width = frontViewFrame.Size.Width;
259+
width = widthConstraint.Constant;
260260

261261
widthConstraint.Constant = view.Bounds.Size.Width;
262262
}
@@ -281,7 +281,7 @@ private void OpenBackViewConfigureConstraints(BasePageCollectionCell cell, nfloa
281281
var widthConstraint = cell.BackContainerView.GetConstraint(NSLayoutAttribute.Width);
282282
if (widthConstraint != null)
283283
{
284-
width = backViewFrame.Size.Width;
284+
width = widthConstraint.Constant;
285285

286286
widthConstraint.Constant = view.Bounds.Size.Width;
287287
}

0 commit comments

Comments
 (0)