• iOS 为键盘添加隐藏按钮


    // 为键盘添加隐藏按钮
        UIToolbar * backView = [[UIToolbar alloc]initWithFrame:CGRectMake(0, 0, 320, 30)];
        [backView setBarStyle:UIBarStyleDefault];
        
        UIBarButtonItem * btnSpace = [[UIBarButtonItem alloc]initWithBarButtonSystemItem:UIBarButtonSystemItemFlexibleSpace target:self action:nil];
        
        UIButton *btn = [UIButton buttonWithType:UIButtonTypeSystem];
        [btn setTitle:@"隐藏键盘" forState:UIControlStateNormal];
        btn.frame = CGRectMake(2, 5, 70, 25);
        [btn addTarget:self action:@selector(cancelInput:) forControlEvents:UIControlEventTouchUpInside];
        UIBarButtonItem *doneBtn = [[UIBarButtonItem alloc]initWithCustomView:btn];
        NSArray * buttonsArray = @[btnSpace,doneBtn];
        [backView setItems:buttonsArray];
        [self.searchBar setInputAccessoryView:backView];
  • 相关阅读:
    easyui 例子2
    easyui 1
    SqlHelper.cs
    ajax 视频点赞功能
    路线
    .net面试题
    cookie 和session asp.net
    前端面试2
    前端面试1
    bootstrap 初始学习篇
  • 原文地址:https://www.cnblogs.com/ficow/p/5675177.html
Copyright © 2020-2023  润新知