123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229 |
- //
- // GuideViewController.m
- // 双子星云手机
- //
- // Created by APPLE on 2023/8/11.
- //
- #import "GuideViewController.h"
- #import "Masonry.h"
- @interface GuideViewController ()
- {
- UIView *firstView;
- UIView *secondView;
- BOOL haveSure;
-
- UIButton *firstFlagBtn;
- UIButton *secondFlagBtn;
- }
- @end
- @implementation GuideViewController
- @synthesize delegate;
- - (void)viewDidLoad {
- [super viewDidLoad];
- haveSure = NO;
- // Do any additional setup after loading the view.
- [self drawAnyView];
- }
- - (void)drawAnyView{
- [self.view setBackgroundColor:HWF5F7FAColor];
-
- firstView = [[UIView alloc] initWithFrame:(CGRectMake(0, 0, SCREEN_W, SCREEN_H))];
- firstView.backgroundColor = HWF5F7FAColor;
- [self.view addSubview:firstView];
- UIImageView *firstImg = [[UIImageView alloc] init];
- [firstImg setBackgroundColor:[UIColor clearColor]];
- [firstImg setImage:[UIImage imageNamed:@"yindao1"]];
- [firstView addSubview:firstImg];
- [firstImg mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.mas_equalTo(0);
- make.right.mas_equalTo(0);
- make.top.mas_equalTo(0);
- make.height.mas_equalTo((SCREEN_W/375.f)*496.f);
- }];
- /*第一段文字*/
- UILabel *firstUpLabel = [[UILabel alloc] init];
- [firstUpLabel setBackgroundColor:[UIColor clearColor]];
- [firstUpLabel setTextColor:HW333333Color];
- [firstUpLabel setFont:[UIFont boldSystemFontOfSize:18]];
- [firstUpLabel setText:@"担心你的隐私被窥探?"];
- [firstUpLabel setTextAlignment:(NSTextAlignmentCenter)];
- [firstView addSubview:firstUpLabel];
- [firstUpLabel mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.mas_equalTo(0);
- make.right.mas_equalTo(0);
- make.top.equalTo(firstImg.mas_bottom).offset(-12.5);
- make.height.mas_equalTo(25);
- }];
- /*第二段文字*/
- UILabel *firstdownLabel = [[UILabel alloc] init];
- [firstdownLabel setBackgroundColor:[UIColor clearColor]];
- [firstdownLabel setTextColor:HW666666Color];
- [firstdownLabel setFont:[UIFont systemFontOfSize:14]];
- [firstdownLabel setNumberOfLines:0];
- [firstdownLabel setText:@"你的另一台隐私手机,保证隐私,你的秘密\n只有你知道"];
- [firstdownLabel setTextAlignment:(NSTextAlignmentCenter)];
- [firstView addSubview:firstdownLabel];
- [firstdownLabel mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.mas_equalTo(0);
- make.right.mas_equalTo(0);
- make.top.equalTo(firstUpLabel.mas_bottom).offset(1.5);
- make.height.mas_equalTo(54);
- }];
-
- secondView = [[UIView alloc] initWithFrame:(CGRectMake(SCREEN_W, 0, SCREEN_W, SCREEN_H))];
- secondView.backgroundColor = HWF5F7FAColor;
- [self.view addSubview:secondView];
- UIImageView *secondImg = [[UIImageView alloc] init];
- [secondImg setBackgroundColor:[UIColor clearColor]];
- [secondImg setImage:[UIImage imageNamed:@"yindao2"]];
- [secondView addSubview:secondImg];
- [secondImg mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.mas_equalTo(0);
- make.right.mas_equalTo(0);
- make.top.mas_equalTo(0);
- make.height.mas_equalTo((SCREEN_W/375.f)*496.f);
- }];
- /*第一段文字*/
- UILabel *secondUpLabel = [[UILabel alloc] init];
- [secondUpLabel setBackgroundColor:[UIColor clearColor]];
- [secondUpLabel setTextColor:HW333333Color];
- [secondUpLabel setFont:[UIFont boldSystemFontOfSize:18]];
- [secondUpLabel setText:@"想要更私密的聊天环境?"];
- [secondUpLabel setTextAlignment:(NSTextAlignmentCenter)];
- [secondView addSubview:secondUpLabel];
- [secondUpLabel mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.mas_equalTo(0);
- make.right.mas_equalTo(0);
- make.top.equalTo(secondImg.mas_bottom).offset(-12.5);
- make.height.mas_equalTo(25);
- }];
- /*第二段文字*/
- UILabel *seconddownLabel = [[UILabel alloc] init];
- [seconddownLabel setBackgroundColor:[UIColor clearColor]];
- [seconddownLabel setTextColor:HW666666Color];
- [seconddownLabel setFont:[UIFont systemFontOfSize:14]];
- [seconddownLabel setNumberOfLines:0];
- [seconddownLabel setText:@"信息端对端加密防止泄露,让你的聊天内容\n更加私密"];
- [seconddownLabel setTextAlignment:(NSTextAlignmentCenter)];
- [secondView addSubview:seconddownLabel];
- [seconddownLabel mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.mas_equalTo(0);
- make.right.mas_equalTo(0);
- make.top.equalTo(secondUpLabel.mas_bottom).offset(1.5);
- make.height.mas_equalTo(54);
- }];
-
- /*两个标签按钮*/
- firstFlagBtn = [[UIButton alloc] init];
- [firstFlagBtn setBackgroundColor:HWE3E8F1Color];
- firstFlagBtn.layer.cornerRadius = 5.f;
-
- [self.view addSubview:firstFlagBtn];
- [firstFlagBtn mas_makeConstraints:^(MASConstraintMaker *make) {
- make.width.mas_equalTo(10);
- make.height.mas_equalTo(10);
- make.top.equalTo(firstImg.mas_bottom).offset(87.f);
- make.centerX.equalTo(self.view.mas_centerX).offset(-10 - 5.f);
- }];
-
- secondFlagBtn = [[UIButton alloc] init];
- [secondFlagBtn setBackgroundColor:HW13B2EBColor];
- secondFlagBtn.layer.cornerRadius = 5.f;
-
- [self.view addSubview:secondFlagBtn];
- [secondFlagBtn mas_makeConstraints:^(MASConstraintMaker *make) {
- make.width.mas_equalTo(10);
- make.height.mas_equalTo(10);
- make.top.equalTo(firstImg.mas_bottom).offset(87.f);
- make.centerX.equalTo(self.view.mas_centerX).offset(+10 + 5.f);
- }];
-
- /*开始体验*/
- UIButton *startUseBtn = [[UIButton alloc] init];
- startUseBtn.frame = CGRectMake(0, 0, 160.f, 48.f);
- // gradient
- CAGradientLayer *gl = [CAGradientLayer layer];
- gl.frame = CGRectMake(0,0,160.f,48.f);
- gl.startPoint = CGPointMake(0, 0.5);
- gl.endPoint = CGPointMake(1, 0.5);
- gl.colors = @[(__bridge id)HW0CDEFDColor.CGColor, (__bridge id)HW058DFBColor.CGColor];
- gl.locations = @[@(0), @(1.0f)];
-
- [startUseBtn.layer addSublayer:gl];
- [startUseBtn addTarget:self action:@selector(startUseBtnPressed) forControlEvents:(UIControlEventTouchUpInside)];
- [startUseBtn setTitle:@"开始体验" forState:(UIControlStateNormal)];
- [startUseBtn setTitleColor:[UIColor whiteColor] forState:(UIControlStateNormal)];
- [startUseBtn.titleLabel setFont:[UIFont systemFontOfSize:16.f]];
- [startUseBtn.layer setCornerRadius:8.f];
- startUseBtn.clipsToBounds = YES;
- [self.view addSubview:startUseBtn];
- [startUseBtn mas_makeConstraints:^(MASConstraintMaker *make) {
- make.centerX.equalTo(self.view.mas_centerX);
- make.width.mas_equalTo(160.f);
- make.top.equalTo(secondFlagBtn.mas_bottom).offset(21.f);
- make.height.mas_equalTo(48.f);
- }];
- }
- - (void)startUseBtnPressed{
- /*记录已经用户引导*/
- [HWDataManager setBoolWithKey:Const_Have_Show_Guide value:YES];
-
- if ([delegate respondsToSelector:@selector(startUseBtnBePressed)]){
- [delegate startUseBtnBePressed];
- }
- }
- - (void)viewDidAppear:(BOOL)animated{
- [super viewDidAppear:animated];
-
- [self startAnim];
- }
- - (void)startAnim{
- if (haveSure){
- return;
- }
-
- [UIView animateWithDuration:1.2 animations:^{
- if (self->firstView.frame.origin.x == 0){
- self->firstView.frame = CGRectMake(-SCREEN_W, 0, SCREEN_W, SCREEN_H);
- self->secondView.frame = CGRectMake(0, 0, SCREEN_W, SCREEN_H);
- }else{
- self->firstView.frame = CGRectMake(0, 0, SCREEN_W, SCREEN_H);
- self->secondView.frame = CGRectMake(-SCREEN_W, 0, SCREEN_W, SCREEN_H);
- }
- } completion:^(BOOL finished) {
- if (self->firstView.frame.origin.x == 0){
- self->secondView.frame = CGRectMake(SCREEN_W, 0, SCREEN_W, SCREEN_H);
- [self->firstFlagBtn setBackgroundColor:HW13B2EBColor];
- [self->secondFlagBtn setBackgroundColor:HWE3E8F1Color];
- }else{
- self->firstView.frame = CGRectMake(SCREEN_W, 0, SCREEN_W, SCREEN_H);
- [self->firstFlagBtn setBackgroundColor:HWE3E8F1Color];
- [self->secondFlagBtn setBackgroundColor:HW13B2EBColor];
- }
- dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(2.5 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
- [self startAnim];
- });
- }];
- }
- /*
- #pragma mark - Navigation
- // In a storyboard-based application, you will often want to do a little preparation before navigation
- - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
- // Get the new view controller using [segue destinationViewController].
- // Pass the selected object to the new view controller.
- }
- */
- @end
|