精华内容
下载资源
问答
  • iOS 实现下拉选项框

    2015-07-15 13:29:04
    iOS 使用tableview实现下拉选项框,可以直接使用
  • 原生js select下拉选项框给文本框赋值代码 原生js select下拉选项框给文本框赋值代码 原生js select下拉选项框给文本框赋值代码 原生js select下拉选项框给文本框赋值代码
  • 微信小程序中没有select下拉选项框,所以只有自定义。这篇文章主要介绍了微信小程序自定义select下拉选项框组件,需要的朋友可以参考下
  • 下拉选项框EXCEL.XLS

    2011-01-23 17:30:18
    EXCEL下拉选项框的应用方法,进入VBA单击设计模式,即可复制编辑
  • js+css下拉选项框+动画特效的例子资源中附加 jquery脚本库。
  • android自定义Spinner下拉菜单(下拉列表)样式
  • 如何对下拉菜单进行截图

    千次阅读 2019-05-31 20:34:45
    方法一: 按着ctrl+alt键点击下拉菜单,然后再加按A键,可以利用QQ截图。 方法二: 按着ctrl+alt键点击下拉菜单,然后松开ctrl键,再加按A键,可以利用微信截图。 ...

    方法一:

    按着ctrl+alt键点击下拉菜单,然后再加按A键,可以利用QQ截图。

    方法二:

    按着ctrl+alt键点击下拉菜单,然后松开ctrl键,再加按A键,可以利用微信截图。

    展开全文
  • iOS 自定义下拉选项框 —— HERO博客

    千次阅读 2017-01-07 15:31:16
    iOS 自定义下拉搜索选项框

    之前两篇简述了UISearchbar的属性、方法,以及UISearchbar的简单使用。本篇在此基础上简单封装了一个下拉选项框。

    先看一下效果图:



    封装的HWOptionButton属性:

    @property (nonatomic,strong)NSArray *array; //需要显示的选项数组

    @property (nonatomic,copy,readonly)NSString *title; //选择的标题

    @property (nonatomic,assign,readonly)NSInteger row; //选择的行数

    @property (nonatomic,assign)BOOL showPlaceholder;  //是否显示提示文字,默认为显示

    @property (nonatomic,assign)BOOL showSearchBar;  //是否显示搜索条,默认为不显示


    下面贴上代码:

    ViewController:

    #import <UIKit/UIKit.h>
    
    @interface ViewController : UIViewController
    
    @end
    
    /*** ---------------分割线--------------- ***/
    
    #import "ViewController.h"
    #import "HWOptionButton.h"
    
    @interface ViewController ()<HWOptionButtonDelegate>
    
    @property (nonatomic, weak) HWOptionButton *optionButton;
    
    @end
    
    @implementation ViewController
    
    - (void)viewDidLoad {
        [super viewDidLoad];
    
        self.view.backgroundColor = [UIColor blackColor];
        
        [self creatControl];
    }
    
    - (void)creatControl
    {
        HWOptionButton *optionBtn = [[HWOptionButton alloc] initWithFrame:CGRectMake(50, 100, 200, 44)];
        optionBtn.array = @[@"mac", @"kobe", @"tracy", @"allen", @"ios", @"android", @"swift", @"object", @"activity"];
        optionBtn.delegate = self;
        optionBtn.showSearchBar = YES;
    //    optionBtn.showPlaceholder = NO;
        [self.view addSubview:optionBtn];
        self.optionButton = optionBtn;
        
        UIButton *sureBtn = [[UIButton alloc] initWithFrame:CGRectMake(50, 450, 200, 44)];
        [sureBtn setTitle:@"确认" forState:UIControlStateNormal];
        sureBtn.backgroundColor = [UIColor orangeColor];
        [sureBtn addTarget:self action:@selector(sureBtnOnClick) forControlEvents:UIControlEventTouchUpInside];
        [self.view addSubview:sureBtn];
    }
    
    - (void)sureBtnOnClick
    {
        if ([_optionButton.title isEqualToString:@"-请选择-"]) {
            NSLog(@"未选择");
            return;
        }
        
        NSLog(@"选择了第%ld行,标题为%@", _optionButton.row, _optionButton.title);
    }
    
    #pragma mark - HWOptionButtonDelegate
    - (void)didSelectOptionInHWOptionButton:(HWOptionButton *)optionButton
    {
        //do something...
    }
    
    @end


    HWOptionButton:

    #import <UIKit/UIKit.h>
    
    @class HWOptionButton;
    
    @protocol HWOptionButtonDelegate <NSObject>
    
    //确认选项后,如有其它特殊操作,用此代理事件
    - (void)didSelectOptionInHWOptionButton:(HWOptionButton *)optionButton;
    
    @end
    
    @interface HWOptionButton : UIView
    
    @property (nonatomic, strong) NSArray *array;
    @property (nonatomic, copy, readonly) NSString *title;
    @property (nonatomic, assign, readonly) NSInteger row;
    @property (nonatomic, assign) BOOL showPlaceholder; //default is YES.
    @property (nonatomic, assign) BOOL showSearchBar; //default is NO.
    @property (nonatomic, weak) id<HWOptionButtonDelegate> delegate;
    
    @end
    
    /*** ---------------分割线--------------- ***/
    
    #import "HWOptionButton.h"
    
    #define KMainW [UIScreen mainScreen].bounds.size.width
    #define KMainH [UIScreen mainScreen].bounds.size.height
    #define KMarginYWhenMoving 20.0f
    #define KRowHeight 44.0f
    #define KMaxShowLine 6
    #define KFont [UIFont systemFontOfSize:15.0f]
    #define KBackColor [UIColor whiteColor]
    
    @interface HWOptionButton ()<UITableViewDelegate, UITableViewDataSource, UISearchBarDelegate>
    
    @property (nonatomic, strong) NSArray *searchArray;
    @property (nonatomic, strong) UIWindow *cover;
    @property (nonatomic, strong) UITableView *tableView;
    @property (nonatomic, strong) UISearchBar *searchBar;
    @property (nonatomic, weak) UIView *view;
    @property (nonatomic, weak) UIButton *button;
    @property (nonatomic, copy, readwrite) NSString *title;
    @property (nonatomic, assign, readwrite) NSInteger row;
    
    @end
    
    @implementation HWOptionButton
    
    static NSString *KOptionButtonCell = @"KOptionButtonCell";
    
    - (instancetype)initWithFrame:(CGRect)frame
    {
        if (self = [super initWithFrame:frame]) {
            [self setup];
        }
        
        return self;
    }
    
    - (instancetype)initWithCoder:(NSCoder *)coder
    {
        if (self = [super initWithCoder:coder]) {
            [self setup];
        }
        
        return self;
    }
    
    - (void)setup {
        self.title = @"-请选择-";
        
        UIButton *button = [[UIButton alloc] initWithFrame:self.bounds];
        [button setTitleColor:[UIColor colorWithRed:180/255.0 green:180/255.0 blue:180/255.0 alpha:1.0f] forState:UIControlStateNormal];
        [button setTitleColor:[UIColor blackColor] forState:UIControlStateSelected];
        [button setTitle:_title forState:UIControlStateNormal];
        button.titleLabel.font = KFont;
        [button setBackgroundImage:[UIImage imageNamed:@"optionBtn_nor"] forState:UIControlStateNormal];
        [button addTarget:self action:@selector(buttonAction:) forControlEvents:UIControlEventTouchUpInside];
        [self addSubview:button];
        self.button = button;
        
        //搜索框
        _searchBar = [[UISearchBar alloc] init];
        _searchBar.barTintColor = KBackColor;
        _searchBar.layer.borderWidth = 1.0f;
        _searchBar.layer.borderColor = [[UIColor blackColor] CGColor];
        _searchBar.delegate = self;
        _searchBar.keyboardType = UIKeyboardTypeASCIICapable;
        
        //选项视图
        _tableView = [[UITableView alloc] init];
        _tableView.rowHeight = KRowHeight;
        _tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
        _tableView.layer.borderWidth = 1.0f;
        _tableView.layer.borderColor = [[UIColor blackColor] CGColor];
        _tableView.dataSource = self;
        _tableView.delegate = self;
        
        self.showPlaceholder = YES;
        self.showSearchBar = NO;
    }
    
    - (void)buttonAction:(UIButton *)button
    {
        [self creatControl];
        
        [self endEditing];
    }
    
    - (void)creatControl
    {
        //遮盖window
        _cover = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
        _cover.windowLevel = UIWindowLevelAlert;
        _cover.hidden = NO;
        
        //window视图
        UIView *view = [[UIView alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
        [_cover addSubview:view];
        self.view = view;
        
        //遮盖视图
        UIView *backview = [[UIView alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
        backview.backgroundColor = [UIColor colorWithRed:(0)/255.0 green:(0)/255.0 blue:(0)/255.0 alpha:0.0f];
        [backview addGestureRecognizer:[[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(Tap:)]];
        [self.view addSubview:backview];
        
        //坐标转换
        CGRect frame = [self.superview convertRect:self.frame toView:self.view];
        
        //显示选项按钮
        UIButton *button = [[UIButton alloc] initWithFrame:CGRectMake(frame.origin.x, frame.origin.y, self.frame.size.width, self.frame.size.height)];
        button.titleLabel.font = KFont;
        [button setTitle:_button.titleLabel.text forState:UIControlStateNormal];
        [button setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
        [button addTarget:self action:@selector(btnOnClick) forControlEvents:UIControlEventTouchUpInside];
        [button setBackgroundImage:[UIImage imageNamed:@"optionBtn_sel"] forState:UIControlStateNormal];
        [self.view addSubview:button];
        
        //搜索框
        if (_showSearchBar) {
            _searchBar.frame = CGRectMake(frame.origin.x, CGRectGetMaxY(frame), frame.size.width, KRowHeight);
            [self.view addSubview:_searchBar];
        }
        
        //设置tableviewFrame
        NSInteger rowCount = _showSearchBar ? KMaxShowLine - 1 : KMaxShowLine;
        CGFloat tabelViewY = _showSearchBar ? CGRectGetMaxY(_searchBar.frame) : CGRectGetMaxY(frame);
        if (_array.count <= rowCount) {
            _tableView.frame = CGRectMake(frame.origin.x, tabelViewY, frame.size.width, _array.count * KRowHeight);
        }else {
            _tableView.frame = CGRectMake(frame.origin.x, tabelViewY, frame.size.width, rowCount * KRowHeight);
        }
        
        [self.view addSubview:_tableView];
    }
    
    - (void)endEditing
    {
        [[[self findViewController] view] endEditing:YES];
    }
    
    - (UIViewController *)findViewController
    {
        id target = self;
        while (target) {
            target = ((UIResponder *)target).nextResponder;
            if ([target isKindOfClass:[UIViewController class]]) {
                break;
            }
        }
        return target;
    }
    
    - (void)setArray:(NSArray *)array
    {
        _array = array;
        
        self.searchArray = [_array copy];
        
        [self setInfo];
    }
    
    - (void)setShowPlaceholder:(BOOL)showPlaceholder
    {
        _showPlaceholder = showPlaceholder;
        
        [self setInfo];
    }
    
    - (void)setInfo
    {
        if (!_showPlaceholder && _array.count > 0) {
            [_button setSelected:YES];
            _title = _array[0];
            [_button setTitle:_title forState:UIControlStateNormal];
        }
        
        [_tableView reloadData];
    }
    
    - (void)btnOnClick
    {
        [self dismissOptionAlert];
    }
    
    - (void)Tap:(UITapGestureRecognizer *)recognizer
    {
        [self dismissOptionAlert];
    }
    
    - (void)dismissOptionAlert
    {
        [_searchBar resignFirstResponder];
        
        if (self.view.frame.origin.y == 0) {
            [self removeCover];
        }else {
            [self searchBarTextDidEndEditing:_searchBar];
        }
    }
    
    - (void)removeCover
    {
        [_searchBar resignFirstResponder];
        _cover.hidden = YES;
        _cover = nil;
    }
    
    #pragma mark - UISearchBarDelegate
    - (void)searchBar:(UISearchBar *)searchBar textDidChange:(NSString *)searchText
    {
        if (searchText.length > 0) {
            NSPredicate *predicate = [NSPredicate predicateWithFormat:@"SELF CONTAINS[c] %@", searchText];
            _searchArray = [[_array filteredArrayUsingPredicate:predicate] copy];
        }else {
            _searchArray = [_array copy];
        }
        
        [_tableView reloadData];
    }
    
    - (BOOL)searchBarShouldBeginEditing:(UISearchBar *)searchBar
    {
        UIView *view = self.superview;
        while (view.superview) {
            view = view.superview;
        }
        
        CGFloat Y = KMarginYWhenMoving - [self.superview convertRect:self.frame toView:self.view].origin.y;
        [UIView animateWithDuration:0.22f animations:^{
            view.frame = CGRectMake(0, Y, KMainW, KMainH);
            self.view.frame = CGRectMake(0, Y, KMainW, KMainH);
        }];
        
        return YES;
    }
    
    - (void)searchBarTextDidEndEditing:(UISearchBar *)searchBar
    {
        UIView *view = self.superview;
        while (view.superview) {
            view = view.superview;
        }
        
        [UIView animateWithDuration:0.22f animations:^{
            view.frame = CGRectMake(0, 0, KMainW, KMainH);
            self.view.frame = CGRectMake(0, 0, KMainW, KMainH);
        }completion:^(BOOL finished) {
            [self removeCover];
        }];
    }
    
    #pragma mark - tableViewDelegate
    - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
    {
        return _searchArray.count;
    }
    
    - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
    {
        UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:KOptionButtonCell];
        if (!cell) {
            cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:KOptionButtonCell];
        }
        cell.textLabel.text = _searchArray[indexPath.row];
        cell.backgroundColor = [UIColor whiteColor];
        cell.textLabel.font = KFont;
        
        return cell;
    }
    
    - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
    {
        _row = indexPath.row;
        [_button setSelected:YES];
        self.title = _searchArray[_row];
        [self.button setTitle:self.title forState:UIControlStateNormal];
        [self dismissOptionAlert];
        
        if (_delegate && [_delegate respondsToSelector:@selector(didSelectOptionInHWOptionButton:)]) {
            [_delegate didSelectOptionInHWOptionButton:self];
        }
    }
    
    @end

    写博客是希望大家共同交流成长,博主水平有限难免有偏颇不足之处,欢迎批评指正。



    展开全文
  • JS模拟下拉选项框

    2016-11-16 11:00:47
    js模拟select下拉菜单控件的代码(多种样式),需要的朋友可以参考一下
  • Android中Spinner下拉选项框

    Spinner下拉菜单

    1. 在布局文件中,添加Spinner
    2. 在java代码文件中,添加下拉框选项

      public String sclass = ""; //存放选择的内容
      //初始化Spinner菜单
      public void initView() {
          //班级选项框
          Spinner sclass_spinner = (Spinner) findViewById(R.id.spinner_sclass);
          //数据
          final ArrayList<String> sclass_data = new ArrayList<String>();
          sclass_data.add("15空间");
          sclass_data.add("15测绘");
          sclass_data.add("15计算机");
          //适配器
          ArrayAdapter<String> sclass_adapter = new ArrayAdapter<String>(this, android.R.layout.simple_spinner_item, sclass_data);
          //设置样式
          sclass_adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
          //加载适配器
          sclass_spinner.setAdapter(sclass_adapter);
          //选择item选择点击监听事件
          sclass_spinner.setOnItemSelectedListener(new Spinner.OnItemSelectedListener() {
              //选择item的选择点击监听事件
              @Override
              public void onItemSelected(AdapterView<?> adapterView, View view, int i, long l) {
                  sclass = sclass_data.get(i);
              }
              public void onNothingSelected(AdapterView<?> arg0) {
                  sclass = "15空间";
              }
          });
      }
      
    3. 在Activity创建时,调用initView()函数进行对Spinner初始化

      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_main2);
          //对Spinner初始化
          initView();
      }
      
    展开全文
  • 微信小程序下拉选项框

    万次阅读 2019-02-18 11:55:06
    效果图 test.js /** * 页面的初始数据 */ data: { shows: false, //控制下拉列表的显示隐藏,false隐藏、true显示 selectDatas: ['消费账户', '平台返利账户', '微信钱包'], //下拉... // 点击下拉显示 s...

    效果图
    在这里插入图片描述
    在这里插入图片描述
    test.js

    /**
       * 页面的初始数据
       */
      data: {
        shows: false, //控制下拉列表的显示隐藏,false隐藏、true显示
        selectDatas: ['消费账户', '平台返利账户', '微信钱包'], //下拉列表的数据
        indexs: 0, //选择的下拉列 表下标,
      },
    
      // 点击下拉显示框
      selectTaps() {
        this.setData({
          shows: !this.data.shows,
        });
      },
      // 点击下拉列表
      optionTaps(e) {
        let Indexs = e.currentTarget.dataset.index; //获取点击的下拉列表的下标
        console.log(Indexs)
        this.setData({
          indexs: Indexs,
          shows: !this.data.shows
        });
    
      },
    
    

    test.wxml

    <view class='fenlei'>
      <text>地址</text>
      <!-- 下拉框 -->
        <view class='select_box'>
          <view class='select' catchtap='selectTaps'>
            <text class='select_text'>{{selectDatas[indexs]}}</text>
            <!-- <image class='words_img' src='../../images/sanjiao.png'></image> -->
            <image class='select_img {{shows&&"select_img_rotate"}}' src='../../images/sanjiao.png'></image>
          </view>
          <view class='option_box' style='height:{{shows?(selectDatas.length>5?300:selectDatas.length*60):0}}rpx;'>
            <text class='option' style='{{indexs==selectDatas.length-1&&"border:0;"}}' wx:for='{{selectDatas}}' wx:key='this' data-index='{{index}}' catchtap='optionTaps'>{{item}}</text>
          </view>
        </view>
    </view>
    

    test.wxss

    /* fenlei */
    .fenlei{
      margin: 0 25rpx;
      height: 90rpx;
      line-height: 90rpx;
      border-bottom: 1rpx solid #e6e6e6;
      display: flex;
      align-items: center;
    }
    .fenlei text{
      font-size: 30rpx;
      color: #999999;
      margin-left: 15rpx;
    }
    /* 下拉框 */
    .select_box {
      background: #fff;
      width: 620rpx;
      /* margin: 0 auto; */
      height: 90rpx;
      line-height: 90rpx;
      text-align: left;
      position: relative;
    }
    
    .select {
      box-sizing: border-box;
      width: 100%;
      height: 86rpx;
      /* border: 1px solid #efefef; */
      border-radius: 8rpx;
      display: flex;
      align-items: center;
      padding: 0 20rpx;
    }
    
    .select_text {
      font-size: 28rpx;
      flex: 1;
      color: rgb(102, 102, 102);
      line-height: 86rpx;
      height: 86rpx;
    }
    
    .select_img {
      width: 40rpx;
      height: 40rpx;
      display: block;
      transition: transform 0.3s;
    }
    
    .select_img_rotate {
      transform: rotate(180deg);
    }
    
    .option_box {
      position: absolute;
      top: 86rpx;
      width: 100%;
      /* border: 1px solid #efefef; */
      box-sizing: border-box;
      height: 0;
      overflow-y: auto;
      border-top: 0;
      background: #fff;
      transition: height 0.3s;
      z-index: 100;
    }
    
    .option {
      display: block;
      line-height: 40rpx;
      font-size: 28rpx;
      border-bottom: 1px solid #efefef;
      padding: 10rpx;
      color: rgb(102, 102, 102);
    }
    
    展开全文
  • axure下拉列表单选First, let’s clarify what exactly is a dropdown menu, and what is a combo box, ... 首先,让我们弄清楚什么是下拉菜单,什么是组合,不是吗? 好吧……不,不是真的,让我解释一下。...
  • layui 多选 单选 下拉选项框都不显示问题 这是因为layui.css 里面有样式是.layui-form input[type=checkbox],.layui-form input[type=radio],.layui-form select{display:none} 初始值是设置成隐藏形式了。 ...
  • C# ComboBox 下拉选项框

    万次阅读 多人点赞 2019-01-15 14:08:51
    (组合样式属性):①DropDown(默认)下拉框可编辑。②Simple:简单组合。③DropDownList:下拉框不可编辑。具体样式如下所示:  (2) DataSource (数据源属性):设置cmb的数据源。以下为代码添加cmb...
  • iOS 导航栏下拉菜单框

    千次阅读 2016-08-30 14:29:18
    应为我是用来做导航栏右侧按钮的下拉菜单按钮,多以就这么叫了。 先看一下效果图: 既然是第三方,首先是要导入库pod 'YCXMenu', '~> 0.0.3'关联头文件#import "YCXMenuItem.h" #import "YCXMenu.h"设置一下导航栏...
  • 微信小程序之自定义select下拉选项框组件
  • 微信小程序中没有select下拉选项框,所以只有自定义。自定义的话,可以选择模板的方式,也可以选择组件的方式来创建。 这次我选择了组件,这样只需引入组件和添加数据,其它的不用管,就能实现多个地方重复使用了。 ...
  • HTMLSelectElement代表一个列表下拉菜单...length:返回列表下拉菜单选项个数。该属性的值可通过增加或删除列表选项来改变。只读属性 options:返回列表下拉菜单里所有选项组成的数组。只读属性 s...
  • css3菜单导航,下拉搜索 来源于网络,学习的小小知识
  • xp风格的下拉选择xp风格的下拉选择xp风格的下拉选择xp风格的下拉选择
  • 搜狗带下拉菜单的搜索
  • jQuery下拉菜单选中搜索插件代码jQuery下拉菜单选中搜索插件代码
  • 为列表下拉菜单添加子节点,也就是为列表下拉菜单添加选项。添加选项有两种方法: 调用HTMLSelectElement的add()方法添加选项 直接为&lt;select……&gt;的指定选项复制 HTMLSelectElement包含如下...
  • 删除列表下拉菜单选项有两种方法: 利用HTMLSelectElement对象的remove()方法删除选项。 直接将指定选项赋值为null即可。 对HTMLSelectElement对象而言,它提供了如下方法用于删除选项。 remove(long index...
  • AS3+xml下拉菜单_下拉弹出框菜单 贵是贵了点,但值得下
  • 一款点击input文本框弹出下拉菜单,选中菜单,支持多选条件,进行搜索的jQuery搜索框下拉菜单选择插件,功能很强大的下拉框搜索代码。
  • 主要为大家详细介绍了Android下拉列表选项框,及指示箭头动画的制作代码,具有一定的参考价值,感兴趣的小伙伴们可以参考一下

空空如也

空空如也

1 2 3 4 5 ... 20
收藏数 139,316
精华内容 55,726
关键字:

下拉选项框截图