小编Leg*_*ut 的帖子

无法分配给属性:'inputAccessoryView'是一个get-only属性

在我的swift应用程序中,我试图隐藏inputAccessoryView,该视图显示用户点击webview中的文本字段.

以下是尝试执行此操作的代码:

  func keyboardWillShow(notification: NSNotification) {      
        if let keyboardSize = (notification.userInfo?[UIKeyboardFrameBeginUserInfoKey] as? NSValue)?.CGRectValue() {        
            var keyboardView = UIApplication.sharedApplication().windows.last!.subviews.first!
            keyboardView.inputAccessoryView = nil           
        } 
    }
Run Code Online (Sandbox Code Playgroud)

但是我收到了这个错误:

Cannot assign to property: ‘inputAccessoryView’ is a get-only property
Run Code Online (Sandbox Code Playgroud)

有一个更好的方法吗?有关如何使其工作的任何想法?

uiwebview ios inputaccessoryview swift

5
推荐指数
1
解决办法
2653
查看次数

SELECT DISTINCT ON表达式必须与初始ORDER BY表达式匹配

我试图在Rails中运行查询,在该查询中我基于唯一的列(在本例中为“ account_id”)获得记录

这完美地工作:

@comments = @store.comments.where(account_id: @selected_array).where(flagged: true).select('distinct on (account_id) *').paginate(:page => params[:page], :per_page => 30)
Run Code Online (Sandbox Code Playgroud)

除了下订单。当我尝试按创建日期排序时:

@comments = @store.comments.where(account_id: @selected_array).where(flagged: true).select('distinct on (account_id) *').order("created_at DESC").paginate(:page => params[:page], :per_page => 30)
Run Code Online (Sandbox Code Playgroud)

我得到错误:

PG::InvalidColumnReference: ERROR:  SELECT DISTINCT ON expressions must match initial ORDER BY expressions
Run Code Online (Sandbox Code Playgroud)

在按创建日期订购时,如何使独特的零件仍可以工作?

mysql postgresql activerecord ruby-on-rails

0
推荐指数
1
解决办法
3107
查看次数

找不到生成器 'delayed_job:active_record

我正在尝试在 Rails 应用程序中安装这个 gem:https : //github.com/collectiveidea/delayed_job

按照指示,我将其添加到我的 gem 文件中,然后运行 ​​bundle install:

gem 'delayed_job_active_record'
Run Code Online (Sandbox Code Playgroud)

然后,在运行命令时

rails g delayed_job:active_record
Run Code Online (Sandbox Code Playgroud)

我得到

Running via Spring preloader in process 4971
Expected string default value for '--jbuilder'; got true (boolean)
Expected boolean default value for '--markerb'; got :erb (string)
[WARNING] Please install gem 'therubyracer' to use Less.
Expected string default value for '--rc'; got false (boolean)
Expected string default value for '--helper'; got true (boolean)
Expected string default value for '--assets'; got true (boolean)
Expected …
Run Code Online (Sandbox Code Playgroud)

ruby activerecord ruby-on-rails delayed-job

0
推荐指数
1
解决办法
549
查看次数