********HWDiscoverViewController.m(发现)

  1. - (void)viewDidLoad
  2. {
  3. [super viewDidLoad];
  4.  
  5. // 创建搜索框对象
  6. HWSearchBar *searchBar = [HWSearchBar searchBar];
  7. searchBar.width = ;
  8. searchBar.height = ;
  9. self.navigationItem.titleView = searchBar; //设置titleView 是搜索框
  1. }

HWSearchBar.m

  1. #import "HWSearchBar.h"
  2.  
  3. @implementation HWSearchBar
  4.  
  5. - (id)initWithFrame:(CGRect)frame
  6. {
  7. self = [super initWithFrame:frame];
  8. if (self) {
  9. self.font = [UIFont systemFontOfSize:];
  10. self.placeholder = @"请输入搜索条件"; //hit的提示信息
  11. self.background = [UIImage imageNamed:@"searchbar_textfield_background"];
  12.  
  13. // 通过init来创建初始化绝大部分控件,控件都是没有尺寸
  14. UIImageView *searchIcon = [[UIImageView alloc] init];
  15. searchIcon.image = [UIImage imageNamed:@"searchbar_textfield_search_icon"];
  16. searchIcon.width = ;
  17. searchIcon.height = ;
  18. searchIcon.contentMode = UIViewContentModeCenter; //居中
  19. self.leftView = searchIcon;
  20. self.leftViewMode = UITextFieldViewModeAlways;
  21. }
  22. return self;
  23. }
  24.  
  25. + (instancetype)searchBar
  26. {
  27. return [[self alloc] init];
  28. }
  29.  
  30. @end

HWSearchBar.h

  1. #import <UIKit/UIKit.h>
  2.  
  3. @interface HWSearchBar : UITextField
  4. + (instancetype)searchBar;
  5. @end

**************HWHomeViewController.m(弹出下拉菜单)主页面

  1. #import "HWHomeViewController.h"
  2. #import "HWDropdownMenu.h"
  3. #import "HWTitleMenuViewController.h"
  4.  
  5. @interface HWHomeViewController () <HWDropdownMenuDelegate>
  6.  
  7. @end
  8.  
  9. @implementation HWHomeViewController
  10.  
  11. - (void)viewDidLoad
  12. {
  13. [super viewDidLoad];
  14.  
  15. /* 设置导航栏上面的内容 */
  16. self.navigationItem.leftBarButtonItem = [UIBarButtonItem itemWithTarget:self action:@selector(friendSearch) image:@"navigationbar_friendsearch" highImage:@"navigationbar_friendsearch_highlighted"];
  17.  
  18. self.navigationItem.rightBarButtonItem = [UIBarButtonItem itemWithTarget:self action:@selector(pop) image:@"navigationbar_pop" highImage:@"navigationbar_pop_highlighted"];
  19.  
  20. /* 中间的标题按钮 */
  21. // UIButton *titleButton = [UIButton buttonWithType:UIButtonTypeCustom];
  22. UIButton *titleButton = [[UIButton alloc] init];
  23. titleButton.width = ;
  24. titleButton.height = ;
  25. // titleButton.backgroundColor = HWRandomColor;
  26.  
  27. // 设置图片和文字
  28. [titleButton setTitle:@"首页" forState:UIControlStateNormal];
  29. [titleButton setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
  30. titleButton.titleLabel.font = [UIFont boldSystemFontOfSize:];
  31. [titleButton setImage:[UIImage imageNamed:@"navigationbar_arrow_down"] forState:UIControlStateNormal];
  32. [titleButton setImage:[UIImage imageNamed:@"navigationbar_arrow_up"] forState:UIControlStateSelected];
  33. // titleButton.imageView.backgroundColor = [UIColor redColor];
  34. // titleButton.titleLabel.backgroundColor = [UIColor blueColor];
  35. titleButton.imageEdgeInsets = UIEdgeInsetsMake(, , , ); // 距离左边
  36. titleButton.titleEdgeInsets = UIEdgeInsetsMake(, , , ); // 距离右边
  37.  
  38. // 监听标题点击
  39. [titleButton addTarget:self action:@selector(titleClick:) forControlEvents:UIControlEventTouchUpInside];
  40.  
  41. self.navigationItem.titleView = titleButton;
  42. // 如果图片的某个方向上不规则,比如有突起,那么这个方向就不能拉伸
  43. }
  44.  
  45. /**
  46. * 标题点击
  47. */
  48. - (void)titleClick:(UIButton *)titleButton
  49. {
  50. // 1.创建下拉菜单
  51. HWDropdownMenu *menu = [HWDropdownMenu menu];
  52. menu.delegate = self;
  53.  
  54. // 2.设置内容
  55. HWTitleMenuViewController *vc = [[HWTitleMenuViewController alloc] init];
  56. vc.view.height = ;
  57. vc.view.width = ;
  58. menu.contentController = vc;
  59.  
  60. // 3.显示
  61. [menu showFrom:titleButton];
  62. }
  63.  
  64. - (void)friendSearch
  65. {
  66. NSLog(@"friendSearch");
  67. }
  68.  
  69. - (void)pop
  70. {
  71. NSLog(@"pop");
  72. }
  73.  
  74. #pragma mark - HWDropdownMenuDelegate
  75. /**
  76. * 下拉菜单被销毁了
  77. */
  78. - (void)dropdownMenuDidDismiss:(HWDropdownMenu *)menu
  79. {
  80. UIButton *titleButton = (UIButton *)self.navigationItem.titleView;
  81. titleButton.selected = NO;
  82. // 让箭头向下
  83. // [titleButton setImage:[UIImage imageNamed:@"navigationbar_arrow_down"] forState:UIControlStateNormal];
  84. }
  85.  
  86. /**
  87. * 下拉菜单显示了
  88. */
  89. - (void)dropdownMenuDidShow:(HWDropdownMenu *)menu
  90. {
  91. UIButton *titleButton = (UIButton *)self.navigationItem.titleView;
  92. titleButton.selected = YES;
  93. // 让箭头向上
  94. // [titleButton setImage:[UIImage imageNamed:@"navigationbar_arrow_up"] forState:UIControlStateNormal];
  95. }
  96.  
  97. #pragma mark - Table view data source
  98.  
  99. - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
  100. {
  101. #warning Potentially incomplete method implementation.
  102. // Return the number of sections.
  103. return ;
  104. }
  105.  
  106. - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
  107. {
  108. #warning Incomplete method implementation.
  109. // Return the number of rows in the section.
  110. return ;
  111. }
  112.  
  113. @end

********************HWDropdownMenu.m(菜单的view)

  1. #import "HWDropdownMenu.h"
  2. @interface HWDropdownMenu()
  3. /**
  4. * 将来用来显示具体内容的容器
  5. */
  6. @property (nonatomic, weak) UIImageView *containerView;
  7. @end
  8.  
  9. @implementation HWDropdownMenu
  10.  
  11. - (UIImageView *)containerView
  12. {
  13. if (!_containerView) {
  14. // 添加一个灰色图片控件
  15. UIImageView *containerView = [[UIImageView alloc] init];
  16. containerView.image = [UIImage imageNamed:@"popover_background"]; //黑色背景图片
  17. containerView.userInteractionEnabled = YES; // 开启交互
  18. [self addSubview:containerView];
  19. self.containerView = containerView;
  20. }
  21. return _containerView;
  22. }
  23.  
  24. - (id)initWithFrame:(CGRect)frame
  25. {
  26. self = [super initWithFrame:frame];
  27. if (self) {
  28. // 清除颜色
  29. self.backgroundColor = [UIColor clearColor];
  30. }
  31. return self;
  32. }
  33.  
  34. + (instancetype)menu
  35. {
  36. return [[self alloc] init];
  37. }
  38.  
  39. - (void)setContent:(UIView *)content
  40. {
  41. _content = content;
  42.  
  43. // 调整内容的位置
  44. content.x = ;
  45. content.y = ;
  46.  
  47. // 调整内容的宽度
  48. // content.width = self.containerView.width - 2 * content.x;
  49.  
  50. // 设置灰色的高度
  51. self.containerView.height = CGRectGetMaxY(content.frame) + ;
  52. // 设置灰色的宽度
  53. self.containerView.width = CGRectGetMaxX(content.frame) + ;
  54.  
  55. // 添加内容到灰色图片中
  56. [self.containerView addSubview:content];
  57. }
  58.  
  59. - (void)setContentController:(UIViewController *)contentController
  60. {
  61. _contentController = contentController;
  62.  
  63. self.content = contentController.view;
  64. }
  65.  
  66. /**
  67. * 显示
  68. */
  69. - (void)showFrom:(UIView *)from
  70. {
  71. // 1.获得最上面的窗口
  72. UIWindow *window = [[UIApplication sharedApplication].windows lastObject];
  73.  
  74. // 2.添加自己到窗口上
  75. [window addSubview:self];
  76.  
  77. // 3.设置尺寸
  78. self.frame = window.bounds;
  79.  
  80. // 4.调整灰色图片的位置
  81. // 默认情况下,frame是以父控件左上角为坐标原点
  82. // 转换坐标系
  83. CGRect newFrame = [from convertRect:from.bounds toView:window];
  84. // CGRect newFrame = [from.superview convertRect:from.frame toView:window];
  85. self.containerView.centerX = CGRectGetMidX(newFrame);
  86. self.containerView.y = CGRectGetMaxY(newFrame);
  87.  
  88. // 通知外界,自己显示了
  89. if ([self.delegate respondsToSelector:@selector(dropdownMenuDidShow:)]) {
  90. [self.delegate dropdownMenuDidShow:self];
  91. }
  92. }
  93.  
  94. /**
  95. * 销毁
  96. */
  97. - (void)dismiss
  98. {
  99. [self removeFromSuperview];
  100.  
  101. // 通知外界,自己被销毁了
  102. if ([self.delegate respondsToSelector:@selector(dropdownMenuDidDismiss:)]) {
  103. [self.delegate dropdownMenuDidDismiss:self];
  104. }
  105. }
  106.  
  107. - (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
  108. {
  109. [self dismiss];
  110. }
  111. @end

HWDropdownMenu.h

  1. #import <UIKit/UIKit.h>
  2.  
  3. @class HWDropdownMenu;
  4.  
  5. @protocol HWDropdownMenuDelegate <NSObject>
  6. @optional
  7. - (void)dropdownMenuDidDismiss:(HWDropdownMenu *)menu;
  8. - (void)dropdownMenuDidShow:(HWDropdownMenu *)menu;
  9. @end
  10.  
  11. @interface HWDropdownMenu : UIView
  12. @property (nonatomic, weak) id<HWDropdownMenuDelegate> delegate; //代理
  13.  
  14. + (instancetype)menu;
  15.  
  16. /**
  17. * 显示
  18. */
  19. - (void)showFrom:(UIView *)from;
  20. /**
  21. * 销毁
  22. */
  23. - (void)dismiss;
  24.  
  25. /**
  26. * 内容
  27. */
  28. @property (nonatomic, strong) UIView *content;
  29. /**
  30. * 内容控制器
  31. */
  32. @property (nonatomic, strong) UIViewController *contentController;
  33. @end

*********HWTitleMenuViewController //弹出窗体里面的view

  1. #import "HWTitleMenuViewController.h"
  2.  
  3. @interface HWTitleMenuViewController ()
  4.  
  5. @end
  6.  
  7. @implementation HWTitleMenuViewController
  8.  
  9. - (id)initWithStyle:(UITableViewStyle)style
  10. {
  11. self = [super initWithStyle:style];
  12. if (self) {
  13. // Custom initialization
  14. }
  15. return self;
  16. }
  17.  
  18. - (void)viewDidLoad
  19. {
  20. [super viewDidLoad];
  21.  
  22. // Uncomment the following line to preserve selection between presentations.
  23. // self.clearsSelectionOnViewWillAppear = NO;
  24.  
  25. // Uncomment the following line to display an Edit button in the navigation bar for this view controller.
  26. // self.navigationItem.rightBarButtonItem = self.editButtonItem;
  27. }
  28.  
  29. - (void)didReceiveMemoryWarning
  30. {
  31. [super didReceiveMemoryWarning];
  32. // Dispose of any resources that can be recreated.
  33. }
  34.  
  35. #pragma mark - Table view data source
  36. - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
  37. {
  38. return ;
  39. }
  40.  
  41. - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
  42. {
  43. static NSString *ID = @"cell";
  44. UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:ID];
  45. if (!cell) {
  46. cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:ID];
  47. }
  48.  
  49. if (indexPath.row == ) {
  50. cell.textLabel.text = @"好友";
  51. } else if (indexPath.row == ) {
  52. cell.textLabel.text = @"密友";
  53. } else if (indexPath.row == ) {
  54. cell.textLabel.text = @"全部";
  55. }
  56.  
  57. return cell;
  58. }
  59. @end

**********HWTabBarViewController.m

  1. #import "HWTabBarViewController.h"
  2. #import "HWHomeViewController.h"
  3. #import "HWMessageCenterViewController.h"
  4. #import "HWDiscoverViewController.h"
  5. #import "HWProfileViewController.h"
  6. #import "HWNavigationController.h"
  7. #import "HWTabBar.h"
  8.  
  9. @interface HWTabBarViewController () <HWTabBarDelegate>
  10.  
  11. @end
  12.  
  13. @implementation HWTabBarViewController
  14.  
  15. - (void)viewDidLoad
  16. {
  17. [super viewDidLoad];
  18.  
  19. // 1.初始化子控制器
  20. HWHomeViewController *home = [[HWHomeViewController alloc] init];
  21. [self addChildVc:home title:@"首页" image:@"tabbar_home" selectedImage:@"tabbar_home_selected"];
  22.  
  23. HWMessageCenterViewController *messageCenter = [[HWMessageCenterViewController alloc] init];
  24. [self addChildVc:messageCenter title:@"消息" image:@"tabbar_message_center" selectedImage:@"tabbar_message_center_selected"];
  25.  
  26. HWDiscoverViewController *discover = [[HWDiscoverViewController alloc] init];
  27. [self addChildVc:discover title:@"发现" image:@"tabbar_discover" selectedImage:@"tabbar_discover_selected"];
  28.  
  29. HWProfileViewController *profile = [[HWProfileViewController alloc] init];
  30. [self addChildVc:profile title:@"我" image:@"tabbar_profile" selectedImage:@"tabbar_profile_selected"];
  31.  
  32. // 2.更换系统自带的tabbar
  33. // self.tabBar = [[HWTabBar alloc] init];
  34. HWTabBar *tabBar = [[HWTabBar alloc] init];
  35. tabBar.delegate = self; //代理
  36. [self setValue:tabBar forKeyPath:@"tabBar"];
  37. // self.tabBar = tabBar;
  38.  
  39. // Person *p = [[Person allooc] init];
  40. // p.name = @"jack";
  41. // [p setValue:@"jack" forKeyPath:@"name"];
  42. }
  43.  
  44. //- (void)viewDidAppear:(BOOL)animated
  45. //{
  46. // [super viewDidAppear:animated];
  47. //
  48. // int count = self.tabBar.subviews.count;
  49. // for (int i = 0; i<count; i++) {
  50. // UIView *child = self.tabBar.subviews[i];
  51. // Class class = NSClassFromString(@"UITabBarButton");
  52. // if ([child isKindOfClass:class]) {
  53. // child.width = self.tabBar.width / count;
  54. // }
  55. // }
  56. //}
  57.  
  58. /**
  59. * 添加一个子控制器
  60. *
  61. * @param childVc 子控制器
  62. * @param title 标题
  63. * @param image 图片
  64. * @param selectedImage 选中的图片
  65. */
  66. - (void)addChildVc:(UIViewController *)childVc title:(NSString *)title image:(NSString *)image selectedImage:(NSString *)selectedImage
  67. {
  68. // 设置子控制器的文字
  69. childVc.title = title; // 同时设置tabbar和navigationBar的文字 //两个一起设置
  70. // childVc.tabBarItem.title = title; // 设置tabbar的文字
  71. // childVc.navigationItem.title = title; // 设置navigationBar的文字
  72.  
  73. // 设置子控制器的图片
  74. childVc.tabBarItem.image = [UIImage imageNamed:image];
  75. childVc.tabBarItem.selectedImage = [[UIImage imageNamed:selectedImage]imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
  76.  
  77. // 设置文字的样式
  78. NSMutableDictionary *textAttrs = [NSMutableDictionary dictionary];
  79. textAttrs[NSForegroundColorAttributeName] = HWColor(, , );
  80. NSMutableDictionary *selectTextAttrs = [NSMutableDictionary dictionary];
  81. selectTextAttrs[NSForegroundColorAttributeName] = [UIColor orangeColor];
  82. [childVc.tabBarItem setTitleTextAttributes:textAttrs forState:UIControlStateNormal]; //默认的文字颜色
  83. [childVc.tabBarItem setTitleTextAttributes:selectTextAttrs forState:UIControlStateSelected];
  84. // childVc.view.backgroundColor = HWRandomColor;
  85.  
  86. // 先给外面传进来的小控制器 包装 一个导航控制器
  87. HWNavigationController *nav = [[HWNavigationController alloc] initWithRootViewController:childVc];
  88. // 添加为子控制器
  89. [self addChildViewController:nav];
  90. }
  91.  
  92. #pragma mark - HWTabBarDelegate代理方法
  93. - (void)tabBarDidClickPlusButton:(HWTabBar *)tabBar
  94. {
  95. UIViewController *vc = [[UIViewController alloc] init];
  96. vc.view.backgroundColor = [UIColor redColor];
  97. [self presentViewController:vc animated:YES completion:nil];
  98. }
  99.  
  100. @end

****************HWTabBar.h(自定义TabBar)

  1. #import "HWTabBar.h"
  2.  
  3. @interface HWTabBar()
  4. @property (nonatomic, weak) UIButton *plusBtn;
  5. @end
  6.  
  7. @implementation HWTabBar
  8.  
  9. - (id)initWithFrame:(CGRect)frame
  10. {
  11. self = [super initWithFrame:frame];
  12. if (self) {
  13. // 添加一个按钮到tabbar中
  14. UIButton *plusBtn = [[UIButton alloc] init];
  15. [plusBtn setBackgroundImage:[UIImage imageNamed:@"tabbar_compose_button"] forState:UIControlStateNormal];
  16. [plusBtn setBackgroundImage:[UIImage imageNamed:@"tabbar_compose_button_highlighted"] forState:UIControlStateHighlighted];
  17. [plusBtn setImage:[UIImage imageNamed:@"tabbar_compose_icon_add"] forState:UIControlStateNormal];
  18. [plusBtn setImage:[UIImage imageNamed:@"tabbar_compose_icon_add_highlighted"] forState:UIControlStateHighlighted];
  19. plusBtn.size = plusBtn.currentBackgroundImage.size;
  20. [plusBtn addTarget:self action:@selector(plusClick) forControlEvents:UIControlEventTouchUpInside];
  21. [self addSubview:plusBtn];
  22. self.plusBtn = plusBtn;
  23. }
  24. return self;
  25. }
  26.  
  27. /**
  28. * 加号按钮点击
  29. */
  30. - (void)plusClick //通知代理
  31. {
  32. // 通知代理
  33. if ([self.delegate respondsToSelector:@selector(tabBarDidClickPlusButton:)]) {
  34. [self.delegate tabBarDidClickPlusButton:self];
  35. }
  36. }
  37.  
  38. - (void)layoutSubviews
  39. {
  40. #warning [super layoutSubviews] 一定要调用
  41. [super layoutSubviews];
  42.  
  43. // 1.设置加号按钮的位置
  44. self.plusBtn.centerX = self.width * 0.5;
  45. self.plusBtn.centerY = self.height * 0.5;
  46.  
  47. // 2.设置其他tabbarButton的位置和尺寸
  48. CGFloat tabbarButtonW = self.width / ;
  49. CGFloat tabbarButtonIndex = ;
  50. for (UIView *child in self.subviews) {
  51. Class class = NSClassFromString(@"UITabBarButton");
  52. if ([child isKindOfClass:class]) { //如果是UITabBarButton
  53. // 设置宽度
  54. child.width = tabbarButtonW;
  55. // 设置x
  56. child.x = tabbarButtonIndex * tabbarButtonW;
  57.  
  58. // 增加索引
  59. tabbarButtonIndex++;
  60. if (tabbarButtonIndex == ) {
  61. tabbarButtonIndex++;
  62. }
  63. }
  64. }
  65.  
  66. // int count = self.subviews.count;
  67. // for (int i = 0; i<count; i++) {
  68. // UIView *child = self.subviews[i];
  69. // Class class = NSClassFromString(@"UITabBarButton");
  70. // if ([child isKindOfClass:class]) {
  71. // // 设置宽度
  72. // child.width = tabbarButtonW;
  73. // // 设置x
  74. // child.x = tabbarButtonIndex * tabbarButtonW;
  75. //
  76. // // 增加索引
  77. // tabbarButtonIndex++;
  78. // if (tabbarButtonIndex == 2) {
  79. // tabbarButtonIndex++;
  80. // }
  81. // }
  82. // }
  83. }
  84.  
  85. @end

****************HWTabBar.h(自定义TabBar)

  1. #import <UIKit/UIKit.h>
  2.  
  3. @class HWTabBar;
  4.  
  5. #warning 因为HWTabBar继承自UITabBar,所以称为HWTabBar的代理,也必须实现UITabBar的代理协议
  6. @protocol HWTabBarDelegate <UITabBarDelegate>
  7. @optional
  8. - (void)tabBarDidClickPlusButton:(HWTabBar *)tabBar;
  9. @end
  10.  
  11. @interface HWTabBar : UITabBar
  12. @property (nonatomic, weak) id<HWTabBarDelegate> delegate;
  13. @end

IOS第二天-新浪微博 - 添加搜索框,弹出下拉菜单 ,代理的使用 ,HWTabBar.h(自定义TabBar)的更多相关文章

  1. 【android开发】使用PopupWindow实现页面点击顶部弹出下拉菜单

    没有太多花样,也没有很复杂的技术,就是简单的PopupWindow的使用,可以实现点击弹出一个自定义的view,view里可以随便设计,常用的可以放一个listview. demo中我只是一个点击展示 ...

  2. 带搜索框的jQuery下拉框插件

    由于下拉框的条数有几十个,于是打算找一个可以搜索查找功能的下拉框,刚开始在网上看了几个,都是有浏览器兼容性问题,后来看到这个“带搜索框的jQuery下拉框美化插件 searchable”,看演示代码简 ...

  3. bootstrap日期控件在火狐下的模态框中选择时间下拉菜单无效的解决办法

    今天收到程序组提交的一个兼容BUG,在火狐中使用模态框加载日期控件时选择时间下拉菜单没有效果(不能点击),而在谷歌中却是好的, 排错思路:1,在当前页面主层放置一个时间控件,测试通过 2,在ajax加 ...

  4. selenium webdriver从安装到使用(python语言),显示等待和隐性等待用法,切换窗口或者frame,弹框处理,下拉菜单处理,模拟鼠标键盘操作等

    selenium的用法 selenium2.0主要包含selenium IDE 和selenium webDriver,IDE有点类似QTP和LoadRunner的录制功能,就是firefox浏览器的 ...

  5. 带搜索框的select下拉框

    利用select2制作带有搜索功能的select下拉框 1.引入线上css和js <link href="https://cdnjs.cloudflare.com/ajax/libs/ ...

  6. 有序无序Ul->Li Ol->Li菜单,默认点击当前弹出下拉,再次点击收起下拉菜单(变形2 ---修饰)

    从上面可以看出,两个问题,第一:下拉出现的太快太突然,第二:再点击下一个下拉菜单的时候,上一个不会闭合,针对这两个问题,接下来会一 一解决. 解决下拉太快: js中有个jquery效果,有一个效果是j ...

  7. easyui combobox点击输入框弹出下拉框

    由于easyui combobox需要点击下拉箭头才能下拉,不能像select标签那样点击输入框就下拉,所以觉得不太方便,查看了一下,combobox弹出框是一个div,原本想在他的输入框的点击事件中 ...

  8. JQuery autocomplete获得焦点触发弹出下拉框

    需求:autocomplete控件,当点击获得焦点的时候也要弹出下拉列表(autocomplete默认是输入之后才会跟随出下拉列表),下面直接贴代码. js代码: $("#customerN ...

  9. 用mobiscroll.js的treelist实现弹出下拉效果

    首先跟上次说的一样, 第一步:引入js.css样式 1)mobiscroll-2.13.2.full.min.css 2)jquery.min.js 3)mobiscroll-2.13.2.full. ...

随机推荐

  1. js如何求一组数中的极值

    这是一个很简单的问题,现在我们从循环开始,例如一组数[5,2,1,3,4];求其中的最大值,那么首先我们要定义一个max的中间变量,遍历数组,当遇到比max值大则赋值给max,直到循环结束,就能获取这 ...

  2. C#做上位机软件——绘图并传输给下位机

    拿到任务之后首先分成了几个部分: 1.绘图.学习了GDI+ 2.图片保存. 3.将图片转换成byte[].由于使用Socket通信,只能传输byte[]数据,所以这一步是向下位机传输的关键. 相应地, ...

  3. ubuntu pycharm 无法 lock from launcher 问题解决

    ubuntu pycharm 无法 lock from launcher 问题解决 最近在自己电脑上安装了python的IDE pycharm, 发现在dash也无法搜索到pycharm的启动图标.( ...

  4. C++ Tips and Tricks

    整理了下在C++工程代码中遇到的技巧与建议. 0x00 巧用宏定义. 经常看见程序员用 enum 值,打印调试信息的时候又想打印数字对应的字符意思.见过有人写这样的代码 if(today == MON ...

  5. ASP.NET Boilerplate终于发布v1.0了

    (此文章同时发表在本人微信公众号"dotNET每日精华文章",欢迎右边二维码来关注.) 题记:ABP经过2年多的开发,终于发布第一个主要版本了,谨此提醒ABP的使用者. ASP.N ...

  6. 私有无线传感网 PWSN HLINK

    私有无线传感网,我把其叫做 Personal Wireless Sensor Network.此种网络最另众人所知的就是ZIGBEE了.由于在用户不同的使用场景中,对传感网络有许多不同的要求,例如:通 ...

  7. ip二进制计算,与运算算网段

    每8位二进制,各位从左到右对应的权值分别是 128,64,32,16, 8,4,2,1 .(即2的n-1次方,n是从右到左当前位的位数)  所以随便拿一个256以内的数给你化为二进制,都可以分解为权值 ...

  8. 使用TextUtils.isEmpty简单化代码

    如果让你判断一个文本框是否为空(null)或者没有任何值(length=0),你会怎么怎样去写代码,很多初学者可能会这样写: if(text==null || text.length==0) {... ...

  9. 微信小程序火车票查询 直取12306数据

    最终效果图: 样式丑哭了,我毕竟不是前端,宗旨就是练练手,体验微信小程序的开发,以最直接的方式获取12306数据查询火车票. 目录结构: search1是出发站列表,search2是目的站列表,命名没 ...

  10. liunux 修改hostname

    最近鼓捣Oracle,记录些技巧 修改hostname # vim /ect/hosts # vim /etc/sysconfig/network 修改hostname # service netwo ...