我可以在滚动视图上添加一些图像(3)来将其翻转为页面控制器,并将其包含在启动画面中,以便仅在某人安装了应用程序或安装了较新版本时才会显示它们吗?以编程方式代替添加xib ..任何帮助...编码将不胜感激..预先感谢
You cant show them along with the Default launch image. You can only show a static image there. But when the user is using the app for the first time, you can show this particular view once the app is launched and then from second time onwards you can disable it. You can set a property in NSUserDefaults
for this once you have shown this view to the user so that from second time onwards, user wont see it again.
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
NSString *string = [defaults objectForKey:@"didShowCustomView"];
if ([string isEqualToString:@"YES"]) {
//show the custom view
//once it is shown, set the value in user defaults
[defaults setObject:@"YES" forKey:@"didShowCustomView"];
[defaults synchronize];
}
This one worked for me as NSUserDefault really did the trick ..
But i had to put the loop in reverse for working it out in my very first view controller i did like this ...
- (void)viewDidLoad {
NSString *type = [[NSUserDefaults standardUserDefaults] objectForKey:@"myText1"];
if([type isEqualToString:@"Kill"]) {
// put the method of view like images,buttons or anything you have in your method
// for loading on to the first view that you want to run after splash
}
if(!type) {
type = @"Kill";
[[NSUserDefaults standardUserDefaults] setObject:type forKey:@"myText1"];
// put the code for your splash image here ..
}
}
So now the splash will only run once the app get's installed as a fresh copy .. This one Helped me out ... if any one looking for the same thing can try my code above .. Thank you
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.