iOS开发有关app启动时的动态页面展示(非启动页面)

很多APP启动的时候,需要动态的更换启动页面,可以在这个地方增添广告或者是将APP中新加入的一些活动信息等展示给用户。废话不多说,上代码:

一般都是在AppDelegate中的这个方法进行实现,当然这里面的图片可以随意的更改。

- (BOOL)application:(UIApplication *)applicationdidFinishLaunchingWithOptions:(NSDictionary*)launchOptions
{
self.window.rootViewController = self.viewController;
[self.window makeKeyAndVisible];

//图片扩大淡出的效果开始;

//设置一个图片;这里的图片可以从后台请求,这样我们就可以实现每天弹出不同图片
UIImageView *niceView = [[UIImageView alloc]initWithFrame:CGRectMake(0,0, 320, 480)];
niceView.image = [UIImage imageNamed:@"Default.png"];

//添加到场景
[self.window addSubview:niceView];

//放到最顶层;
[self.window bringSubviewToFront:niceView];

//开始设置动画;
[UIView beginAnimations:nil context:nil];
[UIView setAnimationDuration:2.0];
[UIView setAnimationTransition:UIViewAnimationTransitio
nNoneforView:self.window cache:YES];
[UIView setAnimationDelegate:self];
//这里还可以设置回调函数;

//[UIViewsetAnimationDidStopSelector:@selector(startupAnimationDone:finished:context:)];

niceView.alpha = 0.0;
niceView.frame = CGRectMake(-60, -85, 440, 635);
[UIView commitAnimations];
[niceView 
release];

//结束;

return YES;
}

不得不说苹果还是很贴心的,好多东西都在考虑,我们只需要调用就行


可以参考一下这样的:

- (BOOL)<a target=_blank href="http://www.codes51.com/article/search_Application/" target="_blank" style="color: rgb(0, 0, 0); text-decoration: none;"><strong>Application</strong></a>:(UI<a target=_blank href="http://www.codes51.com/article/search_Application/" target="_blank" style="color: rgb(0, 0, 0); text-decoration: none;"><strong>Application</strong></a> *)<a target=_blank href="http://www.codes51.com/article/search_Application/" target="_blank" style="color: rgb(0, 0, 0); text-decoration: none;"><strong>Application</strong></a> didFinishLaunchingWithOptions:(NS<a target=_blank href="http://www.codes51.com/article/search_Dictionary/" target="_blank" style="color: rgb(0, 0, 0); text-decoration: none;"><strong>Dictionary</strong></a> *)launchOptions
    [self.window makeKeyAndVisible];
    ADView = [[NSBundle mainBundle ]loadNibNamed:@"LaunchScreen" owner:nil options:nil][0];
    ADView.frame = CGRectMake(0, 0, self.window.screen.bounds.size.width, self.window.screen.bounds.size.height);
    [self.window addSubview:ADView];
    UIImageView *imageV = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, UISCREEN_WIDTH, UISCREEN_HEIGHT)];
    NSString *str = @"http://pic.nipic.com/2008-04-01/20084113367207_2.jpg";
    [imageV sd_setImageWithURL:[NSURL URLWithString:str] placeholderImage:[UIImage imageNamed:@"new_feature_1"]];
    [ADView addSubview:imageV];
    [self.window bringSubviewToFront:ADView];
    [NSTimer scheduledTimerWithTimeInterval:15 <span id="4_nwp" style="width: auto; height: auto; float: none;"><a target=_blank id="4_nwl" href="http://cpro.baidu.com/cpro/ui/uijs.php?adclass=0&app_id=0&c=news&cf=1001&ch=0&di=128&fv=18&is_app=0&jk=9a3525226eacaadf&k=target&k0=target&kdi0=0&luki=6&n=10&p=baidu&q=85048100_cpr&rb=0&rs=1&seller_id=1&sid=dfaaac6e2225359a&ssp2=1&stid=0&t=tpclicked3_hc&td=1797308&tu=u1797308&u=http%3A%2F%2Fwww%2Ecodes51%2Ecom%2Farticle%2Fdetail%5F147339%2Ehtml&urlid=0" target="_blank" mpid="4" style="color: rgb(0, 0, 0); text-decoration: none;"><span style="color: rgb(0, 0, 255); width: auto; height: auto;">target</span></a></span>:self selector:@selector(removeADView) userInfo:nil repeats:NO];
#pragma <span id="3_nwp" style="width: auto; height: auto; float: none;"><a target=_blank id="3_nwl" href="http://cpro.baidu.com/cpro/ui/uijs.php?adclass=0&app_id=0&c=news&cf=1001&ch=0&di=128&fv=18&is_app=0&jk=9a3525226eacaadf&k=mark&k0=mark&kdi0=0&luki=5&n=10&p=baidu&q=85048100_cpr&rb=0&rs=1&seller_id=1&sid=dfaaac6e2225359a&ssp2=1&stid=0&t=tpclicked3_hc&td=1797308&tu=u1797308&u=http%3A%2F%2Fwww%2Ecodes51%2Ecom%2Farticle%2Fdetail%5F147339%2Ehtml&urlid=0" target="_blank" mpid="3" style="color: rgb(0, 0, 0); text-decoration: none;"><span style="color: rgb(0, 0, 255); width: auto; height: auto;">mark</span></a></span> - 移除广告View
-(void)removeADView
{
    [ADView removeFromSuperview];
}

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值