zoukankan      html  css  js  c++  java
  • 当前界面最上面添加视图(UIWimdow)

    -(void)windowAddPushVc:(UIView *)pushView WithTitle:(NSString *)title {

        UIWindow *window = [UIApplication sharedApplication].keyWindow;

        UINavigationBar *navigationBar = [[UINavigationBar alloc]initWithFrame:CGRectMake(0, 0, kScreenWidth, 64)];

        UILabel *label = [UILabel rf_labelWithFontName:kFontPingFangMedium FontSize:36 TextAligent:NSTextAlignmentCenter TextColor:[UIColor whiteColor] CanChangeLine:NO];

        label.text = title;

        [navigationBar addSubview:label];

        [label mas_makeConstraints:^(MASConstraintMaker *make) {

            make.centerX.mas_equalTo(navigationBar);

            make.centerY.mas_equalTo(navigationBar).offset(10);

        }];

        navigationBar.backgroundColor = kGlobelMainColor;

        //添加导航栏的阴影效果

        navigationBar.layer.shadowOpacity = 0.26;

        navigationBar.layer.shadowOffset = CGSizeMake(0, 3);

        navigationBar.layer.shadowColor = HexColor(0x000000).CGColor;

        //添加返回按钮

        [self addBackBtn:navigationBar];

        pushView.tag = 1099;

        navigationBar.tag = 1098;

        pushView.frame = CGRectMake(0, 64, kScreenWidth, kScreenHeight);

        navigationBar.frame = CGRectMake(0, 0, kScreenWidth, 64);

        [window addSubview:pushView];

        [window addSubview:navigationBar];

    }

    - (void)addBackBtn:(UINavigationBar *)navigationBar

    {

        //设置导航栏的返回按钮

        RFNavButton *backBtn = [[RFNavButton alloc]initWithFrame:CGRectMake(10, 32, kFitW(100), 20)];

        [backBtn setImage:[UIImage imageNamed:@"nav_backarrow_icon"] forState:UIControlStateNormal];

        backBtn.titleLabel.font = [UIFont fontWithName:kFontPingFangRegular size:kFitFontSize(28)];

        [backBtn setTitle:@"返回" forState:UIControlStateNormal];

        [backBtn addTarget:self action:@selector(backBtnClick:) forControlEvents:UIControlEventTouchUpInside];

        [navigationBar addSubview:backBtn];

    }

    //导航栏返回按钮的响应事件

    - (void)backBtnClick:(UIButton *)btn

    {

        //只要是从消息在详情界面返回时,通知总的消息列表进行数据的刷新

        [[NSNotificationCenter defaultCenter]postNotificationName:kPushListReload object:nil];

        UIWindow *window = [UIApplication sharedApplication].keyWindow;

        UIView *pushView  =  [window viewWithTag:1099];

        UIView *navgationBar  = [window viewWithTag:1098];

        [UIView animateWithDuration:0.5 animations:^{

           pushView.alpha = 0;

           navgationBar.alpha = 0;

        }

                         completion:^(BOOL finished) {

                            [pushView removeFromSuperview];

                            [navgationBar removeFromSuperview];

                         }];

    }

    获取带有tabbar的控制器的最外层控制器

    //获取当前的控制器

    -(UIViewController *)gerCurrentVc{

        

        UIViewController *rootVc = [UIApplication sharedApplication].keyWindow.rootViewController;

        

      

        UIViewController *view = rootVc.childViewControllers[0];

        

        RFTabBarController *tabbarView = (RFTabBarController *)view.presentedViewController;

        

        UIViewController *rootNav = tabbarView.childViewControllers[tabbarView.selectedIndex];

        

        UIViewController *currentVc = rootNav.childViewControllers[rootNav.childViewControllers.count-1];

        

        return currentVc;

    }

  • 相关阅读:
    Storm并行度详解
    Storm 1.0 新特性
    Storm的本地运行模式示例
    Storm-6 Storm的并行度、Grouping策略以及消息可靠处理机制简介
    Strom-7 Storm Trident 详细介绍
    Storm入门教程 第五章 一致性事务【转】
    storm入门教程 第四章 消息的可靠处理【转】
    Storm入门教程 第三章Storm集群安装部署步骤、storm开发环境
    Storm 01之 Storm基本概念及第一个demo
    storm入门教程 第一章 前言[转]
  • 原文地址:https://www.cnblogs.com/chaoyueME/p/6243697.html
Copyright © 2011-2022 走看看