textViewDidChange: crashes in iOS 7
What's happening is that you're typing what is referred to as multistage text input, i.e. the input has to be confirmed from the user before it's actually committed into the underlying text. You get the crash because the text is only kind-of inputted, and until the text has been committed, it could easily change to something else.
To detect this situation, you're looking for the markedTextRange property of the UITextView, which indicates if you're in this complex input mode.
If the property is non-nil, then you're in this special input mode, so you should guard your modification code with something like:
if (self.tv.markedTextRange == nil && self.tv.text.length > maxLength) {
// Perform change
}
Near as I can tell the crash is triggered by the special multistage text input mode, so you should avoid changing the text while this mode is active.
textViewDidChange: crashes in iOS 7的更多相关文章
- iOS开发笔记12:iOS7上UITextField限制字数输入导致崩溃问题
在一些场景中,需要限制用户的输入字数,例如在textField里进行控制(textView也类似,崩溃原因也相同),如图所示 系统会监听文本输入,需要注意的第一点是输入法处于联想输入还未确定提交的时候 ...
- 移动平台unity3d优化
目录(?)[-] Focus on GPUs 着眼于GPU Good practice 优秀的实践 Sharer optimizations 着色器优化 Focus on CPUs 着眼于CPUs G ...
- iOS - UITextView在调用textViewDidChange方法,九宫格相关中文输入的问题
问题一 iOS textView在调用 UITextViewDelegate 的 textViewDidChange方法,九宫格相关中文输入的问题 有时候,需要在textViewDidChange处理 ...
- iOS 报错:(子线程中更新UI)This application is modifying the autolayout engine from a background thread after the engine was accessed from the main thread. This can lead to engine corruption and weird crashes.
今天在写程序的时候,使用Xcode 运行工程时报出下面的错误错信息,我还以为是什么呢,好久没遇到过这样的错误了. **ProjectName[1512:778965] This application ...
- iOS textView在调用textViewDidChange方法,中文输入的问题
有时候,需要在textViewDidChange处理时,在中文输入的情况下,例如输入“中”,对应的拼音“zhong”, 在textViewDidChange的方法里会把拼音也算进去:导致输入中文时也输 ...
- iOS开发之Alamofire源码解析前奏--NSURLSession全家桶
今天博客的主题不是Alamofire, 而是iOS网络编程中经常使用的NSURLSession.如果你想看权威的NSURLSession的东西,那么就得去苹果官方的开发中心去看了,虽然是英文的,但是结 ...
- iOS编码规范
The official raywenderlich.com Objective-C style guide. This style guide outlines the coding con ...
- IOS错误Could not produce class with ID
运行环境 Unity 5.3.5f1 (IL2CPP)编译IOS版本 XCode Version 7.2.1 (7C1002) Mac OS X 10.11.3 (15D21) (Mac mini) ...
- iOS开发之微信聊天工具栏的封装
之前山寨了一个新浪微博(iOS开发之山寨版新浪微博小结),这几天就山寨个微信吧.之前已经把微信的视图结构简单的拖了一下(IOS开发之微信山寨版),今天就开始给微信加上具体的实现功能,那么就先从微信的聊 ...
随机推荐
- textfield设置左边距
CGRect frame = f;//f表示你的textField的frame frame.size.width = ;//设置左边距的大小 UIView *leftview = [[UIView a ...
- (2015秋) 作业6:(电梯系统之结对编程 I 总分=2*50 分)
电梯系统 0. 背景 南通大学钟秀校区“主教学楼” 用 2 部电梯(连地下室共9层):每到下课.上课前都特别拥挤,大家希望改进已有的电梯调度算法,满足学生和老师快速乘坐电梯的需要.因此,需要重新设计一 ...
- Jade之属性
属性 所有的html(5)标签在jade中均支持如下写法.jade中省去了html<>和标签的关闭等写法,并将属性写在括号之中.若存在多个属性,可以将其分为多行. jade: a(href ...
- ArcGIS Engine代码共享-工作空间(workspace)对象操作
代码: public class WorkspaceHelper { public static string GISConnectionString; public static IWorkspac ...
- Python爬虫(一) 信息系统集成及服务资质网
警告:不要恶意的访问网站,仅供学习使用! 本教程实例只抓取信息系统集成及服务资质网的企业资质查询. 1. 抓包 打开谷歌浏览器的开发者工具并访问该网站,过滤请求后找到请求数据的包. 1.1 找到相应封 ...
- React Native填坑之旅--Button篇
从React过来,发现React Native(以下简称RN)居然没有Button.隔壁的iOS是有UIButton的,隔壁的隔壁的Android里也是有的.没有Button,就没有点击效果啊.这还真 ...
- 『TCP/IP详解——卷一:协议』读书笔记——08
2013-08-21 13:56:23 3.3 IP路由选择 1. IP路由选择有两种情况.(1)如果目的主机与源主机直接相连(如点对点链路)或都在一个共享网络上(以太网或令牌环网),那么IP数据报就 ...
- 第38讲:List伴生对象操作方法代码实战
今天来看一下List伴生对像的操作方法 让我们来看下代码 println(List.apply(1,2,3))//等同于List(1,2,3) println(List.range(1, 4 ...
- javaweb-url /
/一直搞得不清不楚 有时候不用加有时加了也行,有时必须加 转发自XXX论坛 推荐使用 <% String path = request.getContextPath(); String base ...
- Connect教程系列--响应式布局(一)
微软终于跨平台了,最近在第九频道(Event-Visual Studio)下面出来一系列关于vs2015的视频,介绍vs2015以及.NET5.0的新特性等,现针对其讲解的.NET和ASP.NET,进 ...