iOS开发之自定义键盘附件关闭虚拟键盘

69、iOS文本输入控件的使用与定制 本文详细介绍了iOS开发中文本输入控件UITextField和UITextView的使用与定制。内容涵盖了文本字段的基本设置、菜单自定义、拖放功能实现、键盘配置、附件视图与输入视图替换、无文本字段的输入视图展示、快捷栏设置、键盘语言偏好、文本视图特性及其委托机制、链接与文本附件处理等多个主题。通过代码示例和详细说明,帮助开发者深入理解并灵活应用iOS文本输入控件的相关功能,以提升应用的用户体验。 阅读详情

//

//  ViewController.m

//  1113自定义键盘附件关闭虚拟键盘

//

//  Created by weibiao on 15/11/13.

//  Copyright © 2015年 weibiao. All rights reserved.

//


#import "ViewController.h"


@interface ViewController ()

@property (weak, nonatomic) IBOutlet UITextView *textView;


@end


@implementation ViewController


- (void)viewDidLoad {

    [super viewDidLoad];

   

    // 设置UIToolBar工具条

    UIToolbar *toolBar = [[UIToolbar alloc] initWithFrame:CGRectMake(0, 0, 320, 30)];

    // 设置工具条的样式

    [toolBar setBarStyle:UIBarStyleDefault];

    // create first button for toolBar

    UIBarButtonItem *myBtn = [[UIBarButtonItem alloc] initWithTitle:@"无动作" style:UIBarButtonItemStylePlain target:self action:nil];

    // create second button for toolbar

    UIBarButtonItem *spaceBtn = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemFlexibleSpace target:self action:nil];

    // create three button for toolbar

    UIBarButtonItem *doneBtn = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemDone target:self action:@selector(editFinish)];

    // add the btn for toolbar

    NSArray *btnArrays = [NSArray arrayWithObjects:myBtn,spaceBtn,doneBtn, nil];

    [toolBar setItems:btnArrays];

    // 为textView关联的虚拟键盘设置 附件

    [self.textView setInputAccessoryView:toolBar];

}


- (void)editFinish {

    [self.textView resignFirstResponder];

}


@end



ios自定义键盘附件关闭键盘 ios自定义键盘附件关闭键盘,objective-c语言 立即下载

相关推荐

SAP移动类型

SAP移动类型移动类型定义 移动类型定义

qq_20593197的博客 6223

iOS,键盘附件

2019独角兽企业重金招聘Python工程师标准>>> ...

weixin_34162401的博客 127

01 ArcGIS空间分析--水文分析--利用水文分析方法提取山谷山脊线

ArcGIS空间分析的一个特别好的分析教程是汤国安老师的空间分析的内容。 实例与练习 练习1. 利用水文分析方法提取山脊、山谷线 1. 背景:山脊线、山谷线是地形特征线,它们对地形、地貌具有一定的控制作用。它们与山顶点、谷底点以及鞍部点等一起构成了地形及其起伏变化的骨架结构。因此在数字地形分析中,山脊线和山谷线以及

Meditation 1万+

jQueryWEUI解决input框调起的软键盘和选择器重叠的问题

$("#address").click(function(){//点击picker选择器 document.activeElement.blur();//input框失去聚焦 })

明知山 1499

UCOS-III 系统移植

UCOSIII系统移植到GD32F303详细过程 工程代码:https://github.com/jslaobing/techIot_ucosiii_porting

TechIoT - 探索物联网与嵌入式系统 2092

南京工业大学高性能计算平台基础使用指南

高性能计算平台基础使用指南前言什么高性能计算南京工业大学高性能计算平台如何登录如何进行文件传输进行任务提交(本文以提交MATLAB任务为例)环境变量的配置(推荐)使用Environment Modules进行环境变量管理Modules 指令自定义MODULEFILE常见软件任务脚本 前言 第一次接触使用学校的高性能平台是在今年上半年进行毕业设计的时候,当时有大量的数据需要在Matab中进行模型运算,便向学校申请了账号,使用了HPC平台。计算速度确实比个人电脑快了太多太多。 近期,有很多初次想使用高性能计算

weixin_45710019的博客 6889

iOS给键盘添加控制栏

iOS中键盘的使用很频繁,有时给键盘上添加一个控制栏可以方便快捷的在不同输入框内进行切换或隐藏 这里简单说下具体实现方式 初始化一个UIToolBar并添加到界面,随着键盘的高度的更改而动态更改,从而进行展示 下面来看代码实现 头文件部分 #import #import @interface UIKeyboardTool : NSObject ///用于界面展示的toolbar @

稀里糊涂司令官的专栏 2093

开发者的避坑指南:在Apple Silicon Mac上构建RocketMQ Python客户端的完整心路历程

本文详细记录了在Apple Silicon Mac上构建RocketMQ Python客户端的完整过程,重点解决了架构兼容性问题。通过源码编译rocketmq-client-cpp库,修复构建脚本和CMake配置,最终成功在M2芯片MacBook Pro上部署RocketMQ Python客户端,为开发者提供了实用的避坑指南。

Pepper的专栏 698

UITextView和UITextField退出键盘的方式

textField退出键盘的方式 1、(点击Return关闭键盘)textField中用xib。我们右键点击有个方法Did end on exit 脱线到控制器。然后生成IBAction方法,就是我们点击键盘的右下角的return 所触发的事件。这里我们可以 - (IBAction)finish:(id)sender { [sender resignFirstResponder]; }

黑码哥的技术博客 2107

详解机器人标定

这里是机器人在取料之前,先把自己的角度补正到与 物料当前角度一致,到(X’,Y’)位置处,然后移动 CDx,Cdy,与物料位置也重合,然后去取料。可以使用实物标定,机器人抓住工件摆放9个位置,得到9个机械坐标,相机也得到9个像素坐标,(机器人每次需要回到固定位置拍照),然后标定。(X0,Y0)为旋转中心, (X1,Y1)及(X2,Y2)为工件在视野中旋转角度a的前后坐标,(Xt,Yt)为两点连线的延长。(rx0, ry0)为旋转中心,( x, y)为被旋转的点,(x0,y0)旋转后的点。

weixin_56819992的博客 7640

【N32L40X】学习笔记08-定时器的基本定时功能-超时功能

【代码】【N32L40X】学习笔记08-定时器的基本定时功能-超时功能。

Car12 829

【iOS 开发】基本 UI 控件详解 (UIButton | UITextField | UITextView | UISwitch)

.一. UI 控件简介1. UI 控件分类UI 控件分类 : 活动控件, 被动控件, 静态控件;-- 活动控件 : -- 静态控件 : -- 被动控件 : .....一. UI 控件简介1. 程序入口(1) 程序入口代码.一. UI 控件简介1. 程序入口(1) 程序入口代码

让 学习 成为一种 习惯 ( 韩曙亮 の 技术博客 ) 7392

Agent驱动电商运营:从选品到售后的全链路革新

在当今竞争激烈的电商市场中,传统的电商运营模式面临着诸多挑战。从选品到售后,每个环节都需要大量的人力投入和专业知识。选品需要深入了解市场趋势和消费者需求,营销需要精准定位目标用户,客服需要24小时响应用户咨询。这些工作不仅耗时耗力,而且容易受到人为因素的影响,导致效率低下和成本高企。AI Agent是一种能够感知环境、做出决策并采取行动的智能系统。感知能力:能够获取和处理环境信息。决策能力:能够根据感知到的信息做出决策。行动能力:能够执行决策,对环境产生影响。学习能力。

AI 领航者的博客 359

iOS UI控件(2) UITextView

1.多行文本控件(UITextView) 多行文本控件(UITextView)继承了UIScrollView:UIView,默认带有滚动条。 1.1 UIScrollView支持的属性 UIScrollView代表一个可滚动的控件,该控件允许用户拖动手指来滚动该控件中的内容。UIScrollView默认已经实现并处理放大或缩小手势。 三个控制显示区域的属性: contentSize CGSize...

weixin_30872157的博客 134

深度学习工具包 DeepLearningToolbox

深度学习工具包Deprecation notice.-----This toolbox is outdated and no longer maintained.There are much better tools available for deep learning than this toolbox, e.g. [Theano](http://deeplearning.net/software/theano/), [torch](http://torch.ch/) or [tensorflow](http://www.tensorflow.org/)I would suggest you use one of the tools mentioned above rather than use this toolbox.Best, Rasmus.DeepLearnToolbox================A Matlab toolbox for Deep Learning.Deep Learning is a new subfield of machine learning that focuses on learning deep hierarchical models of data.It is inspired by the human brain's apparent deep (layered, hierarchical) architecture.A good overview of the theory of Deep Learning theory is[Learning Deep Architectures for AI](http://www.iro.umontreal.ca/~bengioy/papers/ftml_book.pdf)For a more informal introduction, see the following videos by Geoffrey Hinton and Andrew Ng.* [The Next Generation of Neural Networks](http://www.youtube.com/watch?v=AyzOUbkUf3M) (Hinton, 2007)* [Recent Developments in Deep Learning](http://www.youtube.com/watch?v=VdIURAu1-aU) (Hinton, 2010)* [Unsupervised Feature Learning and Deep Learning](http://www.youtube.com/watch?v=ZmNOAtZIgIk) (Ng, 2011)If you use this toolbox in your research please cite [Prediction as a candidate for learning deep hierarchical models of data](http://www2.imm.dtu.dk/pubdb/views/publication_details.php?id=6284)```@MASTERSTHESIS\{IMM2012-06284, author = "R. B. Palm", title = "Prediction as a candidate for learning deep hierarchical models of data", year = "2012",}```Contact: rasmusbergpalm at gmail dot comDirectories included in the toolbox-----------------------------------`NN/` - A library for Feedforward Backpropagation Neural Networks`CNN/` - A library for Convolutional Neural Networks`DBN/` - A library for Deep Belief Networks`SAE/` - A library for Stacked Auto-Encoders`CAE/` - A library for Convolutional Auto-Encoders`util/` - Utility functions used by the libraries`data/` - Data used by the examples`tests/` - unit tests to verify toolbox is workingFor references on each library check REFS.mdSetup-----1. Download.2. addpath(genpath('DeepLearnToolbox'));Example: Deep Belief Network---------------------```matlabfunction test_example_DBNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit RBM and visualize its weightsrand('state',0)dbn.sizes = [100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);figure; visualize(dbn.rbm{1}.W'); % Visualize the RBM weights%% ex2 train a 100-100 hidden unit DBN and use its weights to initialize a NNrand('state',0)%train dbndbn.sizes = [100 100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);%unfold dbn to nnnn = dbnunfoldtonn(dbn, 10);nn.activation_function = 'sigm';%train nnopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.10, 'Too big error');```Example: Stacked Auto-Encoders---------------------```matlabfunction test_example_SAEload mnist_uint8;train_x = double(train_x)/255;test_x = double(test_x)/255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit SDAE and use it to initialize a FFNN% Setup and train a stacked denoising autoencoder (SDAE)rand('state',0)sae = saesetup([784 100]);sae.ae{1}.activation_function = 'sigm';sae.ae{1}.learningRate = 1;sae.ae{1}.inputZeroMaskedFraction = 0.5;opts.numepochs = 1;opts.batchsize = 100;sae = saetrain(sae, train_x, opts);visualize(sae.ae{1}.W{1}(:,2:end)')% Use the SDAE to initialize a FFNNnn = nnsetup([784 100 10]);nn.activation_function = 'sigm';nn.learningRate = 1;nn.W{1} = sae.ae{1}.W{1};% Train the FFNNopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.16, 'Too big error');```Example: Convolutional Neural Nets---------------------```matlabfunction test_example_CNNload mnist_uint8;train_x = double(reshape(train_x',28,28,60000))/255;test_x = double(reshape(test_x',28,28,10000))/255;train_y = double(train_y');test_y = double(test_y');%% ex1 Train a 6c-2s-12c-2s Convolutional neural network %will run 1 epoch in about 200 second and get around 11% error. %With 100 epochs you'll get around 1.2% errorrand('state',0)cnn.layers = { struct('type', 'i') %input layer struct('type', 'c', 'outputmaps', 6, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %sub sampling layer struct('type', 'c', 'outputmaps', 12, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %subsampling layer};cnn = cnnsetup(cnn, train_x, train_y);opts.alpha = 1;opts.batchsize = 50;opts.numepochs = 1;cnn = cnntrain(cnn, train_x, train_y, opts);[er, bad] = cnntest(cnn, test_x, test_y);%plot mean squared errorfigure; plot(cnn.rL);assert(er<0.12, 'Too big error');```Example: Neural Networks---------------------```matlabfunction test_example_NNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);% normalize[train_x, mu, sigma] = zscore(train_x);test_x = normalize(test_x, mu, sigma);%% ex1 vanilla neural netrand('state',0)nn = nnsetup([784 100 10]);opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samples[nn, L] = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.08, 'Too big error');%% ex2 neural net with L2 weight decayrand('state',0)nn = nnsetup([784 100 10]);nn.weightPenaltyL2 = 1e-4; % L2 weight decayopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex3 neural net with dropoutrand('state',0)nn = nnsetup([784 100 10]);nn.dropoutFraction = 0.5; % Dropout fraction opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex4 neural net with sigmoid activation functionrand('state',0)nn = nnsetup([784 100 10]);nn.activation_function = 'sigm'; % Sigmoid activation functionnn.learningRate = 1; % Sigm require a lower learning rateopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex5 plotting functionalityrand('state',0)nn = nnsetup([784 20 10]);opts.numepochs = 5; % Number of full sweeps through datann.output = 'softmax'; % use softmax outputopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex6 neural net with sigmoid activation and plotting of validation and training error% split training data into training and validation datavx = train_x(1:10000,:);tx = train_x(10001:end,:);vy = train_y(1:10000,:);ty = train_y(10001:end,:);rand('state',0)nn = nnsetup([784 20 10]); nn.output = 'softmax'; % use softmax outputopts.numepochs = 5; % Number of full sweeps through dataopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, tx, ty, opts, vx, vy); % nntrain takes validation set as last two arguments (optionally)[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');```[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/rasmusbergpalm/deeplearntoolbox/trend.png)](https://bitdeli.com/free "Bitdeli Badge")

VB摄像头监控

该VB模块可对摄像头捕获的画面进行录像等,可在创建的窗口进行控制

iOS之UITextView的使用——通过虚拟键盘的工具条关闭虚拟键盘

1、.h #import @interface FKViewController : UIViewController @property (strong, nonatomic) IBOutlet UITextView *textView; @end 2、.m #import "FKViewController.h" @interface FKViewController ()

yuxikuo_1的专栏 924

RU DOS版、EFI版32bit/64bit BIOS常用工具

DOS版、EFI版的RU工具,可用来查看IO、MEM、PCI、SMBIOS等资源。亲测在EFI SHELL下可用。

IOS swift 3.0 关于自定义键盘附件关闭虚拟键盘

代码以及注释如下 // // ViewController.swift // 通过自定义键盘附件关闭虚拟键盘 // // Created by ho on 16/10/27. // Copyright © 2016年 ho. All rights reserved. //import UIKitclass ViewController: UIViewController { var

winking1040的博客 741

迈瑞BS系列全自动生化分析仪LIS协议接口手册(内含HL7和ASTM)

迈瑞BS系列全自动生化分析仪LIS协议接口手册,内含HL7和ASTM)

iOS 基础小结之常用控件 一

有一些控件很常用,有些使用控件时的小问题几乎是每个人都会遇到的

闪亮的的Bug写手 779

树莓派到手第一步:上电启动、安装中文字体、虚拟键盘、开启SSH等

1、拆开包装并接线: 树莓派到手后,拆开包装,插入SD卡套里的TF卡,默认到货后会卡内已经烧写有最新的RaspberryPi系统镜像,可以直接开启启动。(当然用其他镜像,将镜像直接用Win32DiskImager烧写进卡内开机即可。) 树莓派安装系统可以参考:https://jingyan.baidu.com/article/b7001fe1b46bd50e7282ddc5.html ...

HowieXue 薛永浩的博客 2万+

OC学习笔记之010IOS应用开发入门--控件1按钮、文本、开关、分段、图像

1.UICtontrol基类方法 定制UICongtrol外观 2.按钮控件–设置按钮不同的状态的title 设置UIButton外观 #import "ViewController.h" @interface ViewController () //创建一个按钮控件 @property (weak, nonatomic) IBOutlet UIButton *myBtn; @property (weak, nonatomic) IBOutlet UIButton *myBtnEnable; @pr

weixin_43745804的博客 552

树莓派基本配置

树莓派基本配置 1、拆开包装并接线: 树莓派到手后,拆开包装,插入SD卡套里的TF卡,默认到货后会卡内已经烧写有最新的RaspberryPi系统镜像,可以直接开启启动。(当然用其他镜像,将镜像直接用Win32DiskImager烧写进卡内开机即可。) 树莓派安装系统可以参考:https://jingyan....

weixin_43444901的博客 735

UISearchBar作为inputAccessoryView时的响应链

UISearchBar对象做为一个普通的视图对象添加到视图控制器的self.view中,定义、初始化、设置delegate,然后becomeFirstResponder,最后resignFirstResponder。 但是,这里的应用环境是将searchBar作为一个uiresponder子类的对象gridview的inputAccessoryView。 这样他的响应链条就复杂了。 我开始在searchBarTextDidBeginEditing方法中将searchBar的cancelButton展现出

miki西游 2133

每日资源分享

iOS10快速开发:18天零基础开发一个商业应用 EKECMS网站管理系统(电脑端+手机端) v3.0.0

demo软件园的博客 289

UIControl类控件(二)

博客地址 : http://blog.csdn.net/shulianghan/article/details/50051499 ; 一. UI 控件简介 1. UI 控件分类 UI 控件分类 : 活动控件, 被动控件, 静态控件; -- 活动

移动开发专栏 1951

软件测试面试核心问题与缺陷管理实战指南

软件测试是确保产品质量的关键环节,其核心在于缺陷管理与测试设计方法。缺陷管理需要合理划分严重性与优先级,结合技术影响和业务需求进行综合考量。测试设计方法如等价类划分和边界值分析,能有效发现潜在问题。在实际应用中,自动化测试框架如PageObject模式和性能测试工具如LoadRunner,能显著提升测试效率。本文通过电商支付接口缺陷等案例,详解缺陷管理全流程和测试设计进阶技巧,帮助测试工程师掌握核心面试知识点和实战经验。

weixin_34013044的博客 955

iOS之友盟分享

http://dev.umeng.com/social/ios/share/quick-integration 注意:苹果审核政策需求,建议对未安装的客户端平台进行隐藏,在设置QQ。微信Appid之后调用方法: [UMSocialConfig hiddenNotInstallPlatforms:@[UMShareToQQ, UMShareToQzone, UMShareToWecha

qq_28884869的博客 3160

iOS之百度云推送二

在iOS开发中我们开发中往往离不开远程推送,因为他能够有提醒客户自己的存在,且能够通过消息提醒来获取用户的回头率。 百度推送: 1.框架设计:     Apple 的推送服务器 APNS (Apple Push Notification Service) 发送需要推送的消息,APNS 在收到消息后,会将消息发到设备上。以上整个过程较为复杂,而且功能比较单一,在集成

qq_28884869的博客 2220
上一篇: OSX10.11 Xcode7安装模拟器需要授权的问题
下一篇: iOS开发之UITextView自定义选择内容后的分享菜单
Weeao
博客等级 码龄11年 2粉丝 118原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值