IOS 动态加载启动业的代码

#import "AppDelegate.h" 
#import "UIImageView+WebCache.h" 
@interface AppDelegate ()
@property (strong, nonatomic) UIView *lunchView;
@end
@implementation AppDelegate
@synthesize lunchView;
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
    [self.window makeKeyAndVisible];
    lunchView = [[NSBundle mainBundle ]loadNibNamed:@"LaunchScreen" owner:nil options:nil][0];
    lunchView.frame = CGRectMake(0, 0, self.window.screen.bounds.size.width, self.window.screen.bounds.size.height);
    [self.window addSubview:lunchView];
    UIImageView *imageV = [[UIImageView alloc] initWithFrame:CGRectMake(0, 50, 320, 300)];
    NSString *str = @"http://www.jerehedu.com/images/temp/logo.gif";
    [imageV sd_setImageWithURL:[NSURL URLWithString:str] placeholderImage:[UIImage imageNamed:@"default1.jpg"]];
    [lunchView addSubview:imageV];
    [self.window bringSubviewToFront:lunchView];
    [NSTimer scheduledTimerWithTimeInterval:3 target:self selector:@selector(removeLun) userInfo:nil repeats:NO]; return YES;
}
-(void)removeLun {
    [lunchView removeFromSuperview];
}


猜你喜欢

转载自blog.csdn.net/czl0325/article/details/49796139