zoukankan      html  css  js  c++  java
  • ios UISegmentedControl 用法举例

    UISegmentedControl * segmentControl = [[UISegmentedControl alloc]initWithFrame:CGRectMake(0, 0, 160, 30)];

    segmentControl.tintColor = kMainOrangeColor;

    [segmentControl insertSegmentWithTitle:@"XX" atIndex:0 animated:NO];

    [segmentControl insertSegmentWithTitle:@"XX" atIndex:1 animated:NO];

    segmentControl.selectedSegmentIndex = 0;

    //    [segmentControl setTitle:@"关注" forSegmentAtIndex:0];

    //    [segmentControl setTitle:@"订阅" forSegmentAtIndex:1];

    self.navigationItem.titleView = segmentControl;

    //设置普通状态下(未选中)状态下的文字颜色和字体

    //    [self.segmentedControl setTitleTextAttributes:@{NSFontAttributeName:[UIFont systemFontOfSize:12],NSForegroundColorAttributeName: [UIColor blackColor]} forState:UIControlStateNormal];

    //设置选中状态下的文字颜色和字体

    //    [self.segmentedControl setTitleTextAttributes:@{NSFontAttributeName:[UIFont systemFontOfSize:16],NSForegroundColorAttributeName: [UIColor blackColor]} forState:UIControlStateSelected];

    //添加监听

    [segmentControl addTarget:self action:@selector(sementedControlClick:) forControlEvents:UIControlEventValueChanged];

    //监听方法

    - (void)sementedControlClick:(UISegmentedControl *)controlllll{

        NSLog(@"%lu ",controlllll.selectedSegmentIndex);

        

    }

  • 相关阅读:
    asp.net linux 环境部署, jexus
    SAP选择屏幕下拉框实现
    SAP 选择屏幕的上方 (sscrfields) 按钮设置
    SAP笔记
    SAP导出内表数据到excel
    SAP笔记---非-现存任务/请求XXX上的请求锁定
    ABAP知识点笔记
    关联带出字段内容
    REUSE_ALV_GRID_DISPLAY详解
    django发送邮件send_mail&send_mass_mail
  • 原文地址:https://www.cnblogs.com/isItOk/p/4873154.html
Copyright © 2011-2022 走看看