仿Uber注册页背景视屏效果
来源:互联网 发布:淘宝别人盗用我的品牌 编辑:程序博客网 时间:2024/06/07 02:51
// Created by qpc on 15/12/24.
// Copyright © 2015年 qpc. All rights reserved.
//
#import "ViewController.h"
#import <MediaPlayer/MediaPlayer.h>
#define screenW [UIScreen mainScreen].bounds.size.width
#define screenH [UIScreen mainScreen].bounds.size.height
#define btnW ((screenW - 3 * 20)/2)
@interface ViewController ()
//播放器视图控制器
@property (nonatomic,strong) MPMoviePlayerViewController *moviePlayerViewController;
@end
@implementation ViewController
- (void)viewDidLoad
{
[super viewDidLoad];
[self playMovie];
//延时操作,保证视屏和文字同时启动
dispatch_after(1.3, dispatch_get_main_queue(), ^{
[self setupTitleLabel];
[self setupButton];
});
}
//创建视频控制器
- (void) playMovie
{
NSString *path = [[NSBundle mainBundle] pathForResource:@"8" ofType:@"mp4"];
self.moviePlayerViewController = [[MPMoviePlayerViewController alloc]
initWithContentURL:[NSURL fileURLWithPath:path]];
self.moviePlayerViewController.moviePlayer.repeatMode = MPMovieRepeatModeOne;
self.moviePlayerViewController.moviePlayer.controlStyle = MPMovieControlStyleNone;
self.moviePlayerViewController.moviePlayer.scalingMode = MPMovieScalingModeAspectFill;
// self.moviePlayerViewController.moviePlayer.fullscreen = NO;
// //在当前view上添加视频的视图
[self.view addSubview:self.moviePlayerViewController.view];
NSLog(@"-------");
}
{
UILabel *titleLabel = [[UILabel alloc] initWithFrame:CGRectMake(screenW * 0.5 -50, screenH * 0.5 - 100, 120, 40)];
titleLabel.backgroundColor = [UIColor clearColor];
titleLabel.text = @"我是测试数据";
titleLabel.font = [UIFont systemFontOfSize:30.0];
titleLabel.textColor = [UIColor whiteColor];
[self.moviePlayerViewController.view addSubview:titleLabel];
float detailY = CGRectGetMaxY(titleLabel.frame);
UILabel *detailLabel = [[UILabel alloc] initWithFrame:CGRectMake(screenW * 0.5 -90, detailY - 10, 200, 40)];
detailLabel.backgroundColor = [UIColor clearColor];
detailLabel.textAlignment = NSTextAlignmentLeft;
detailLabel.text = @"程序猿帅气";
detailLabel.font = [UIFont systemFontOfSize:20.0];
detailLabel.textColor = [UIColor grayColor];
[self.moviePlayerViewController.view addSubview:detailLabel];
}
//创建登陆和注册按钮
- (void)setupButton
{
[self createBtnWithFrame:CGRectMake(20, screenH - 20 - 40 , btnW, 40) backColor:[UIColor colorWithRed:209/255.0 green:210/255.0 blue:211/255.0 alpha:1.0] title:@"登录" titleColor:[UIColor blackColor] action:@selector(login)];
[self createBtnWithFrame:CGRectMake(btnW + 40, screenH - 20 - 40 , btnW, 40) backColor:[UIColor colorWithRed:57/255.0 green:185/255.0 blue:186/255.0 alpha:1.0] title:@"注册" titleColor:[UIColor whiteColor] action:@selector(regist)];
}
- (void)createBtnWithFrame:(CGRect)frame backColor:(UIColor *)backcolor title:(NSString *)title titleColor:(UIColor *)titleColor action:(SEL)action
{
UIButton *btn = [[UIButton alloc] initWithFrame:frame];
btn.layer.cornerRadius = 5;
btn.layer.masksToBounds = YES;
btn.backgroundColor = backcolor;
[btn setTitle:title forState:UIControlStateNormal];
[btn setTitleColor:titleColor forState:UIControlStateNormal];
[btn addTarget:self action:action forControlEvents:UIControlEventTouchUpInside];
[_moviePlayerViewController.view addSubview:btn];
}
- (void)login
{
NSLog(@"login");
UIViewController *loginVC = [[UIViewController alloc] init];
loginVC.view.backgroundColor = [UIColor whiteColor];
[self presentViewController:loginVC animated:YES completion:nil];
}
- (void)regist
{
NSLog(@"regist");
UIViewController *registVC = [[UIViewController alloc] init];
registVC.view.backgroundColor = [UIColor whiteColor];
[self presentViewController:registVC animated:YES completion:nil];
}
@end
// Copyright © 2015年 qpc. All rights reserved.
//
#import "ViewController.h"
#import <MediaPlayer/MediaPlayer.h>
#define screenW [UIScreen mainScreen].bounds.size.width
#define screenH [UIScreen mainScreen].bounds.size.height
#define btnW ((screenW - 3 * 20)/2)
@interface ViewController ()
//播放器视图控制器
@property (nonatomic,strong) MPMoviePlayerViewController *moviePlayerViewController;
@end
@implementation ViewController
- (void)viewDidLoad
{
[super viewDidLoad];
[self playMovie];
//延时操作,保证视屏和文字同时启动
dispatch_after(1.3, dispatch_get_main_queue(), ^{
[self setupTitleLabel];
[self setupButton];
});
}
//创建视频控制器
- (void) playMovie
{
NSString *path = [[NSBundle mainBundle] pathForResource:@"8" ofType:@"mp4"];
self.moviePlayerViewController = [[MPMoviePlayerViewController alloc]
initWithContentURL:[NSURL fileURLWithPath:path]];
self.moviePlayerViewController.moviePlayer.repeatMode = MPMovieRepeatModeOne;
self.moviePlayerViewController.moviePlayer.controlStyle = MPMovieControlStyleNone;
self.moviePlayerViewController.moviePlayer.scalingMode = MPMovieScalingModeAspectFill;
// self.moviePlayerViewController.moviePlayer.fullscreen = NO;
// //在当前view上添加视频的视图
[self.view addSubview:self.moviePlayerViewController.view];
NSLog(@"-------");
}
//创建主题文字,可优化
{
UILabel *titleLabel = [[UILabel alloc] initWithFrame:CGRectMake(screenW * 0.5 -50, screenH * 0.5 - 100, 120, 40)];
titleLabel.backgroundColor = [UIColor clearColor];
titleLabel.text = @"我是测试数据";
titleLabel.font = [UIFont systemFontOfSize:30.0];
titleLabel.textColor = [UIColor whiteColor];
[self.moviePlayerViewController.view addSubview:titleLabel];
float detailY = CGRectGetMaxY(titleLabel.frame);
UILabel *detailLabel = [[UILabel alloc] initWithFrame:CGRectMake(screenW * 0.5 -90, detailY - 10, 200, 40)];
detailLabel.backgroundColor = [UIColor clearColor];
detailLabel.textAlignment = NSTextAlignmentLeft;
detailLabel.text = @"程序猿帅气";
detailLabel.font = [UIFont systemFontOfSize:20.0];
detailLabel.textColor = [UIColor grayColor];
[self.moviePlayerViewController.view addSubview:detailLabel];
}
//创建登陆和注册按钮
- (void)setupButton
{
[self createBtnWithFrame:CGRectMake(20, screenH - 20 - 40 , btnW, 40) backColor:[UIColor colorWithRed:209/255.0 green:210/255.0 blue:211/255.0 alpha:1.0] title:@"登录" titleColor:[UIColor blackColor] action:@selector(login)];
[self createBtnWithFrame:CGRectMake(btnW + 40, screenH - 20 - 40 , btnW, 40) backColor:[UIColor colorWithRed:57/255.0 green:185/255.0 blue:186/255.0 alpha:1.0] title:@"注册" titleColor:[UIColor whiteColor] action:@selector(regist)];
}
- (void)createBtnWithFrame:(CGRect)frame backColor:(UIColor *)backcolor title:(NSString *)title titleColor:(UIColor *)titleColor action:(SEL)action
{
UIButton *btn = [[UIButton alloc] initWithFrame:frame];
btn.layer.cornerRadius = 5;
btn.layer.masksToBounds = YES;
btn.backgroundColor = backcolor;
[btn setTitle:title forState:UIControlStateNormal];
[btn setTitleColor:titleColor forState:UIControlStateNormal];
[btn addTarget:self action:action forControlEvents:UIControlEventTouchUpInside];
[_moviePlayerViewController.view addSubview:btn];
}
- (void)login
{
NSLog(@"login");
UIViewController *loginVC = [[UIViewController alloc] init];
loginVC.view.backgroundColor = [UIColor whiteColor];
[self presentViewController:loginVC animated:YES completion:nil];
}
- (void)regist
{
NSLog(@"regist");
UIViewController *registVC = [[UIViewController alloc] init];
registVC.view.backgroundColor = [UIColor whiteColor];
[self presentViewController:registVC animated:YES completion:nil];
}
@end
效果图:
0 0
- 仿Uber注册页背景视屏效果
- 仿Uber得动态背景登陆布局
- 仿陌陌注册登录引导页背景效果
- 点击扩散效果(仿uber取消行程的动画)(ios)
- 仿Uber筛选栏
- 仿支付宝注册页面效果
- 仿Uber滑动选择地图
- Uber/优步App动画效果启动页实现
- 如何注册uber司机赚钱
- JS模拟ALERT半透明背景,仿关机效果
- Android实现仿有道云笔记头像背景(模糊效果)
- Keil MDK背景颜色配置方法,实现仿Sublime效果
- 仿Uber的侧拉视图
- 高仿Uber的类型选择控件
- 仿IOS底部选项效果--底部弹出PopupWindow,背景变为半透明效果
- 整图背景登录/注册页
- 仿Android QQ实现的QQ顶栏椭圆透明背景移动效果
- Android用VideoView实现MP4作为页面背景(仿QQ登录页面效果)
- 图---BFS之从源点到目的点最少拐点问题
- 自动化管理工具Saltstack之服务管理(10)
- 今天开通了CSDN博客,决定以后将学习到的新知识记录下来
- Glassfish域
- 【CSS】如何去除页面滚动条
- 仿Uber注册页背景视屏效果
- 23种设计模式(21)_行为型_策略模式(Stragety Pattern)
- layoutInflater的用法2
- JFinal+FullCallender.js开发终极排班管理系统
- matlab 2014a 安装以及 打包成java文件
- 关于『65535问题』的一点研究与思考
- 通信课程二
- 使用python实现HMM
- iOS开发之数据的写入与读取(plist存储)