启动广告

app启动后显示广告,虽然这种形式违背app的设计原则,不过国内厂商很是热衷于此。

显示广告的方式有很多种。

1.启动页面即为广告

  最为简单,但是在ios7以及以前的版本是一个图片,所以无法动态设置。

2.入口页面为广告页面

  设置启动页面和入口页面尽量有一部分显示重合,然后启动页面空白的位置,在入口页面显示广告。

  这样看起来不会太仓促。

  然后设定显示时间后,modal模式跳转到主业务页面。

  坏处就是这个广告页面会一直存在。

扫描二维码关注公众号,回复: 486285 查看本文章

3.删掉storyboard的切入口,改为手动启动。

  这样就可以先进入业务主页面,然后以主页面present广告页面,参考

  http://stackoverflow.com/questions/8221787/perform-segue-on-viewdidload

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
    self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];

    // Load Main App Screen
    UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"MainStoryboard" bundle:nil];
    HomeScreenVC *homeScreenVC = [storyboard instantiateInitialViewController];
    self.window.rootViewController = homeScreenVC;
    [self.window makeKeyAndVisible];

    UIViewController *mainLoginVC = [storyboard instantiateViewControllerWithIdentifier:@"MainLoginVC"];
    [mainLoginVC setModalPresentationStyle:UIModalPresentationFullScreen];
    [homeScreenVC presentModalViewController:mainLoginVC animated:NO];

    return YES;
}

推荐第三种方式

猜你喜欢

转载自weiqingfei.iteye.com/blog/2212696
今日推荐