Bug 34697 - Xamarin.Forms.Page.OnAppearing() called after ViewDidAppear on iOS
Summary: Xamarin.Forms.Page.OnAppearing() called after ViewDidAppear on iOS
Status: RESOLVED NOT_ON_ROADMAP
Alias: None
Product: Forms
Classification: Xamarin
Component: Forms (show other bugs)
Version: 1.5.0
Hardware: PC Mac OS
: --- normal
Target Milestone: ---
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2015-10-08 15:05 UTC by Pablo Biagioli
Modified: 2016-04-13 18:36 UTC (History)
4 users (show)

See Also:
Tags:
Is this bug a regression?: ---
Last known good build:


Attachments

Description Pablo Biagioli 2015-10-08 15:05:13 UTC
Hi, I wanted to make a custom CarouselPage with Circular/infinite scrolling to both sides. I discovered that in Android works fine, but in iOS I can't start displaying a middle positioned the page before showing the first page declared in Children by code (not XAML). This is, in my opinion, due to having the Xamarin.Forms.Page.SendAppearing after calling ViewDidAppear in iOS.

According to the Xamarin.Forms documentation for OnAppearing method:
When overriden, allows devs to customize the behavior immediately prior to the Page becoming visible.

The Result is that if I set the CurrentPage property within OnAppearing method, the CarouselPage swipes automatically to the page set as Current one.

SampleProject.CustomControls.CircularCarouselPage.OnAppearing ()
Xamarin.Forms.Page.SendAppearing () 
Xamarin.Forms.Platform.iOS.CarouselPageRenderer.ViewDidAppear (animated=false)
ObjCRuntime.Messaging.void_objc_msgSendSuper_bool () 
UIKit.UIViewController.ViewDidAppear (animated=false) in /Users/builder/data/lanes/2077/1d27ac2c/source/maccore/src/build/ios/native/UIKit/UIViewController.g.cs:1112
Xamarin.Forms.Platform.iOS.NavigationRenderer.ViewDidAppear (animated=false) in 
UIKit.UIApplication.UIApplicationMain () in 
UIKit.UIApplication.Main (args={string[0]}, principal=0x0, delegate=0x551694f0) in /Users/builder/data/lanes/2077/1d27ac2c/source/maccore/src/UIKit/UIApplication.cs:74
UIKit.UIApplication.Main (args={string[0]}, principalClassName=(null), delegateClassName="AppDelegate") in /Users/builder/data/lanes/2077/1d27ac2c/source/maccore/src/UIKit/UIApplication.cs:58
SampleProject.iOS.Application.Main (args={string[0]}) in /.../sample_project/SampleProject/SampleProject.iOS/Main.cs:19

The Xamarin.Forms version is the latest stable 1.5.0 release.

Best Regards
Comment 1 Rui Marinho 2015-11-18 11:56:07 UTC
This seems the normal behaviour can you attach a reproduction please?
Comment 2 Pablo Biagioli 2015-11-18 12:03:35 UTC
isn't the stacktrace enough?
Please read the whole stack trace above.

In Android OnAppearing happens BEFORE the View is displayed. This should be OK.
In iOS on the other hand, OnAppearing happens AFTER the View is displayed on the screen.

The Normal behavior is in your Xamarin.Forms documentation
http://developer.xamarin.com/api/member/Xamarin.Forms.Page.OnAppearing()/

Please provide a more human answer.

Regards
Comment 3 Jason Smith [MSFT] 2016-04-13 18:36:07 UTC
CarouselPage is being deprecated due to issues like this and replaced with CarouselView which should allow you to fix this. CarouselView is available in 2.2.0-pre1 and newer.

Note You need to log in before you can comment on or make changes to this bug.