【问题标题】:Can I choose my launch image programmatically?我可以以编程方式选择我的启动图像吗?
【发布时间】:2014-05-13 16:59:02
【问题描述】:

我的应用程序提供了我学校穿梭巴士的班车时间表,我正在更新该应用程序以检查现在是一年中的哪一天,如果是夏季则显示夏季时间表,这与正常时间表不同。那部分很容易。

我想知道是否可以根据编程条件选择使用不同的启动图像,例如:

if ( today isBetweenDate: juneFirst andDate: augustThirtyFirst ) {
     launchImage == summerLaunchImage.png 
}

【问题讨论】:

  • 如果不出意外,您可以随时实现自己的启动器屏幕

标签: ios launch


【解决方案1】:

显示的初始启动屏幕无法以编程方式更改:您需要提供单个图像来告诉应用这是启动屏幕。您无法以编程方式更改它。

当您的应用在 didFinishLaunchingWithOptions 或 UIApplicationDelegate 中获得焦点时,您可以做的是在启动屏幕后显示您自己的启动画面

【讨论】:

    【解决方案2】:

    正如其他人所说,实现您自己的启动器屏幕。最简单的方法是放置一个 NSTimer,它会在 X 秒后自动将其移动到下一个屏幕。

    这里有一些示例代码。

    在 *.h 中

    @interface v2ViewController : UIViewController
    {
        NSTimer *timer1;
        NSTimer *timer2;
    
        IBOutlet UIImageView *backgroundImgVw;
    
    }
    

    在 *.m 中

    - (void)viewDidLoad
    {
        [super viewDidLoad];
        // Do any additional setup after loading the view, typically from a nib.
    
    //set your backgroundImgVw / Launch Image here
    
    //then move on
        timer2 = [NSTimer scheduledTimerWithTimeInterval:2.5 target:self selector:@selector(moveOn) userInfo:nil repeats:NO];
    
    }
    
    - (void)viewDidUnload
    {
        [super viewDidUnload];
        // Release any retained subviews of the main view.
        // e.g. self.myOutlet = nil;
    }
    
    - (IBAction) moveOn
    {
        //Now go to the Display Call Page
        [self performSegueWithIdentifier:@"MoveOn" sender:nil];
    }
    

    【讨论】:

      猜你喜欢
      • 2013-08-30
      • 2011-02-07
      • 1970-01-01
      • 2012-02-15
      • 1970-01-01
      • 2012-04-28
      • 1970-01-01
      • 1970-01-01
      • 2011-09-18
      相关资源
      最近更新 更多