zoukankan      html  css  js  c++  java
  • 从storyBoard的里面加载控制器的方法

    这个方法不常用,容易被忽略,但是用起来还是蛮方便的

    @implementation HMAdViewController

    - (void)viewDidLoad

    {

        [super viewDidLoad];

        

        // 1.背景图片

        UIImageView *bg = [[UIImageView alloc] init];

        bg.image = [UIImage imageNamed:@"Default"];

        bg.frame = self.view.bounds;

        [self.view addSubview:bg];

        

        // 2.广告图片(真实的广告图片应该要先下载广告图片)

        UIImageView *ad = [[UIImageView alloc] init];

        ad.image = [UIImage imageNamed:@"ad"];

        ad.width = 280;

        ad.height = 300;

        ad.centerX = self.view.width * 0.5;

        ad.y = 60;

        [self.view addSubview:ad];

        

        // 3.2s后调到下一个主界面

        dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(2.0 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{

            UIWindow *window = [UIApplication sharedApplication].keyWindow;

            UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"Main" bundle:nil];

            window.rootViewController = [storyboard instantiateViewControllerWithIdentifier:@"Main"];

        });

    }

    @end

  • 相关阅读:
    day14 多态与抽象
    day13 类的补充
    day12 继承
    第三周总结 类、对象、包
    day11 细节记忆
    Dapper使用
    修改SQL Server 中数据库的Collation
    Web API 输出文件缓存
    Sql从邮件中提取国家代码
    解决Nuget:https://api.nuget.org/v3/index.json 访问不了的问题
  • 原文地址:https://www.cnblogs.com/BinZone/p/4444940.html
Copyright © 2011-2022 走看看