简体   繁体   中英

Adding version number on Xamarin.iOS Splash screen

Anyone has an idea how can I update the label and put a version number on there so that I don't need it to write manually every time I publish the new version on iOS. Please download my sample project in this link Splashscreen with version number .

I try to add UIViewController to use it on Storyboard but it's not working.

first thing, it is not possible to provide dynamic value on the launch screen which comes as a default view with the IOS project. you have to create your own splashscreen by storyboard so you will have viewcontroller code behind and there you can do whatever the details you want to display. you can show the animation also there.

you have to set this splashviewcontroller as a rootviewcontroller in finishlaunching() of appdelegate.

check below code:- try something like this.

public override UIWindow Window { get; set; } public RootViewController RootViewController { get; set; }

  public override bool FinishedLaunching(UIApplication application, NSDictionary launchOptions){
     this.Window = new UIWindow(UIScreen.MainScreen.Bounds);
     UINavigationController navigationController = new 
     UINavigationController(new SplashViewController());
     Window.RootViewController = navigationController;

}

I cannot download your code for security reasons on my network, but In Xamarin.iOS, You can get the version number from the info.plist then set your label text to the value. This way as you update the version for releases the label will automatically reflect the current version number.

var appVersion = NSBundle.MainBundle.InfoDictionary["CFBundleVersion"].ToString();

lblAppVersion.Text = appVersion;

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM