iOS开发经验——点击屏幕空白处退出键盘
2024-10-19 16:42:56
一种比较简单的点击屏幕空白处退出键盘的方法:
在ViewController中加入如下代码:
1: -(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event{
2:
3: [self.view endEditing:YES];
4:
5: }
.csharpcode, .csharpcode pre
{
font-size: small;
color: black;
font-family: consolas, "Courier New", courier, monospace;
background-color: #ffffff;
/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt
{
background-color: #f4f4f4;
width: 100%;
margin: 0em;
}
.csharpcode .lnum { color: #606060; }
即可
最新文章
- java自定义类加载器
- iOS后台定位时授权提示一闪而过的解决办法
- VBS编辑字段
- 【读书笔记】iOS-内存管理
- [译]SQL Server 之 查询优化器
- zoj The 12th Zhejiang Provincial Collegiate Programming Contest Demacia of the Ancients
- 回调函数的实现 &; 结构体的继承
- Multithreading annd Grand Central Dispatch on ios for Beginners Tutorial-多线程和GCD的入门教程
- VC printf输出彩色字体
- Wpf TextChanged事件导致死循环,事件触发循环问题
- Swift—属性观察者-备
- POJ 3104 Drying(二分答案)
- Android Studio的使用(二)--Debug调试
- [NOIp 2016]愤怒的小鸟
- SpringMVC接收json数组对象
- Python框架学习之Flask中的常用扩展包
- HTML CSS JavaScript 工作笔记
- C#检查服务状态和启动关闭服务
- Spring注解 @Configuration
- 如何学php少走弯路