zoukankan      html  css  js  c++  java
  • iOS--导航栏样式

    push返回按钮样式:

    UIBarButtonItem *item = [[UIBarButtonItem alloc] initWithTitle:@"" style:UIBarButtonItemStylePlain target:nil action:nil];
        self.navigationItem.backBarButtonItem = item;
        self.navigationController.navigationBar.tintColor = [UIColor grayColor];
        [self.navigationItem setHidesBackButton:YES];

    自由点击事件:

    //用户协议跳转
        UITapGestureRecognizer *labelTapGestureRecognizer = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(labelClick)];
        
        // 2. 将点击事件添加到label上
        [self.UserRate addGestureRecognizer:labelTapGestureRecognizer];
        self.UserRate.userInteractionEnabled = YES; // 可以理解为设置label可被点击

    创建左右导航栏按钮,搜索与个人中心:

    //创建左右导航栏按钮,搜索与个人中心
        self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc] initWithImage:[self scaleToSize:[UIImage imageNamed:@"sousuo.png"] size:CGSizeMake(20, 19.6)] style:UIBarButtonItemStylePlain target:self action:@selector(Actionleft:)];
        
        self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithImage:[self scaleToSize:[UIImage imageNamed:@"persons.png"] size:CGSizeMake(20, 20)] style:UIBarButtonItemStylePlain target:self action:@selector(Actionright:)];
    
    
    
    //导航栏个人信息按钮
    -(void)Actionright:(id)send{
        NSLog(@"跳转到个人中心页面");
        PersonalViewController *PersonalView = [self.storyboard instantiateViewControllerWithIdentifier:@"PersonalView"];
        [self.navigationController pushViewController:PersonalView animated:PersonalView];
    }
    //导航栏搜索按钮点击事件
    -(void)Actionleft:(id)send{
        NSLog(@"跳转到搜索页面");
        SearchViewController *search = [self.storyboard instantiateViewControllerWithIdentifier:@"search"];
        [self.navigationController pushViewController:search animated:search];
        
    }
    //设置图片大小
    - (UIImage *)scaleToSize:(UIImage *)img size:(CGSize)size{
        // 创建一个bitmap的context
        // 并把它设置成为当前正在使用的context
        UIGraphicsBeginImageContext(size);
         // 绘制改变大小的图片
        [img drawInRect:CGRectMake(0, 0, size.width, size.height)];
         // 从当前context中创建一个改变大小后的图片
        UIImage* scaledImage = UIGraphicsGetImageFromCurrentImageContext();
       // 使当前的context出堆栈
        UIGraphicsEndImageContext();
       // 返回新的改变大小后的图片
        return scaledImage;
    }
  • 相关阅读:
    Ubantu常用命令
    移动 Ubuntu16.04 桌面左侧的启动器到屏幕底部
    Win10上安装TensorFlow(官方文档翻译)
    Win10上安装Keras 和 TensorFlow(GPU版本)
    课程四(Convolutional Neural Networks),第二 周(Deep convolutional models: case studies) —— 1.Practice questions
    课程四(Convolutional Neural Networks),第二 周(Deep convolutional models: case studies) —— 0.Learning Goals
    Difference Between Session.run and Tensor.eval
    tf.cast()的用法(转)
    Tensflow的equal函数
    Tensflow的targmax函数
  • 原文地址:https://www.cnblogs.com/qiyiyifan/p/6265899.html
Copyright © 2011-2022 走看看