我有一个显示不可编辑文本的UITextView.我希望文本能够自动解析用户的链接,电话号码等,以及可点击的文本.
我不希望用户能够突出显示文本,因为我想要覆盖那些长按和双击交互以执行不同的操作.
为了在iOS7中解析链接,需要为UITextView打开Selectable开关,但Selectable也可以启用突出显示,这是我不想要的.
我尝试覆盖LongPress手势以防止突出显示,但这似乎也禁用了链接上的普通水龙头......
for (UIGestureRecognizer *recognizer in cell.messageTextView.gestureRecognizers) {
if ([recognizer isKindOfClass:[UILongPressGestureRecognizer class]]){
recognizer.enabled = NO;
}
if ([recognizer isKindOfClass:[UITapGestureRecognizer class]]){
recognizer.enabled = YES;
}
}
Run Code Online (Sandbox Code Playgroud)
有很多类似的线程,但似乎没有解决这个特定的链接启用问题,文本不突出显示.
当我运行Heroku Bamboo时,这从来都不是问题.现在,在Cedar上,每当我尝试从服务器上的rake任务中访问我的模型时,我都会收到错误.这种情况发生rake db:seed在标准的rake任务中,以及我自己定制的任务中明确包含:environment.我甚至多余地这样做:
namespace :db do
desc "Update db"
task :new_seed => :environment do
require './Scraped_Data/Games/code/column-headers.rb'
require 'csv'
require 'net/http'
require './config/environment.rb'
# code here...
end
end
Run Code Online (Sandbox Code Playgroud)
我在其他地方找不到任何关于这个问题的提及,所有这些任务都在开发中完美运行.感谢您的任何见解,这里是完整的错误消息,一旦他们在Heroku上遇到我的模型,就会吐出rake任务:
rake aborted!
uninitialized constant Object::Movie
/app/vendor/bundle/ruby/1.9.1/gems/rake-0.9.2.2/lib/rake/ext/module.rb:36:in `const_missing'
/app/lib/tasks/new_seed.rake:187:in `block in load_scraped_data'
/app/vendor/bundle/ruby/1.9.1/gems/rest-open-uri-1.0.0/lib/rest-open-uri.rb:37:in `open'
/app/vendor/bundle/ruby/1.9.1/gems/rest-open-uri-1.0.0/lib/rest-open-uri.rb:37:in `open'
/app/lib/tasks/new_seed.rake:148:in `load_scraped_data'
/app/lib/tasks/new_seed.rake:550:in `block (2 levels) in <top (required)>'
/app/vendor/bundle/ruby/1.9.1/gems/rake-0.9.2.2/lib/rake/task.rb:205:in `call'
/app/vendor/bundle/ruby/1.9.1/gems/rake-0.9.2.2/lib/rake/task.rb:205:in `block in execute'
/app/vendor/bundle/ruby/1.9.1/gems/rake-0.9.2.2/lib/rake/task.rb:200:in `each'
/app/vendor/bundle/ruby/1.9.1/gems/rake-0.9.2.2/lib/rake/task.rb:200:in `execute'
/app/vendor/bundle/ruby/1.9.1/gems/rake-0.9.2.2/lib/rake/task.rb:158:in `block in invoke_with_call_chain'
/usr/local/lib/ruby/1.9.1/monitor.rb:201:in `mon_synchronize'
/app/vendor/bundle/ruby/1.9.1/gems/rake-0.9.2.2/lib/rake/task.rb:151:in `invoke_with_call_chain'
/app/vendor/bundle/ruby/1.9.1/gems/rake-0.9.2.2/lib/rake/task.rb:144:in `invoke'
/app/vendor/bundle/ruby/1.9.1/gems/rake-0.9.2.2/lib/rake/application.rb:116:in `invoke_task'
/app/vendor/bundle/ruby/1.9.1/gems/rake-0.9.2.2/lib/rake/application.rb:94:in `block (2 levels) …Run Code Online (Sandbox Code Playgroud)