iOS 錄屏大師啓動頁廣告

隱藏系統狀態欄  讓app啓動時圖片全屏 進入程序後顯示狀態欄方法。   

1.在<APP>-info.list文件中,加上“Status bar is initially hidden”選項,選擇yes

2在程序裏面添加 [[UIApplication sharedApplication]setStatusBarHidden:NO withAnimation:UIStatusBarAnimationNone];
即可 


iOS 啓動頁廣告


<span style="font-size:14px;">//
//  LaunchScreenView.h
//  ScreenRecordMaster
//
//  Created by feimo on 15/9/10.
//  Copyright (c) 2015年 feimo. All rights reserved.
//

#import <UIKit/UIKit.h>

typedef void (^dismissBlock)();//聲明回調Block

@interface LaunchScreenView : UIWindow

@property (strong,nonatomic) UIImageView *splashView;
@property (nonatomic, copy) dismissBlock dismissBlock;
- (void)dismiss:(dismissBlock)block;//設置回調Block

@end</span><strong style="font-size:24px;">
</strong>


//
//  LaunchScreenView.m
//  ScreenRecordMaster
//
//  Created by feimo on 15/9/10.
//  Copyright (c) 2015年 feimo. All rights reserved.
//

#import "LaunchScreenView.h"

@implementation LaunchScreenView

- (id)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        // Initialization code
        self.windowLevel = UIWindowLevelNormal;
        self.windowLevel = UIWindowLevelStatusBar + 1.0f;
        self.backgroundColor = [UIColor whiteColor];
        [self addSplashView];
    }
    return self;
}

-(void)addSplashView
{
    
    self.splashView = [[UIImageView alloc]initWithFrame:[[UIScreen mainScreen] bounds]];
    [self.splashView setImage:[UIImage imageNamed:@"New_02.png"]];
    [self addSubview:self.splashView];
    [self performSelector:@selector(removeAdImageView) withObject:nil afterDelay:3];

}


- (void)removeAdImageView
{
    [UIView animateWithDuration:0.2f animations:^{
        //self.splashView.transform = CGAffineTransformMakeScale(0.3f, 0.3f);
        self.splashView.alpha = 0.f;
        self.alpha = 0.f;
    } completion:^(BOOL finished) {
        [self.splashView removeFromSuperview];
        if (self.dismissBlock) {
            self.dismissBlock();
        }
    }];
    
}

- (void)dismiss:(dismissBlock)block
{
    self.dismissBlock = block;
    
}//設置回調Block



/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

@end

調用:

__block LaunchScreenView *launchView = [[LaunchScreenView alloc] initWithFrame:CGRectMake(0.0, 0.0, kDeviceWidth, kDeviceHeight)];
        [launchView makeKeyAndVisible];
        [launchView dismiss:^{
            
            [launchView removeFromSuperview];
            [launchView resignKeyWindow];
            launchView=nil;//及時銷燬
            
        }];



發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章