小编MrX*_*MrX的帖子

二进制运算符不能应用于int和int类型的操作数?斯威夫特3

我是快速的新手,我试了几个小时这个问题.在我的代码下面:

/* [1] error in this line */if filteredCustomReqList != nil {
        for i in 0..<filteredCustomReqList?.count {
            tempObj = filteredCustomReqList[i] as! [AnyHashable: Any]
            bezeichString = tempObj?["bezeich"] as! String


            specialRequestLabel.text = ("\(filteredString), \(bezeichString!)")
            print (bezeichString!)
        }
}
Run Code Online (Sandbox Code Playgroud)

错误说:

binary operator cannot be applied to operands of type int and int?
Run Code Online (Sandbox Code Playgroud)

其中:

var filteredCustomReqList: [Any]? /* = [Any]() */
Run Code Online (Sandbox Code Playgroud)

如果我使用var filteredCustomReqList: [Any] = [Any]()错误消失但我的if条件总是如此.如何解决这个问题?我已经读过这个,但它与我的情况(它intCGFloat)不一样.

任何答案和消化对我都有帮助.提前致谢

swift

14
推荐指数
3
解决办法
3万
查看次数

Activity.java中的多个选定项目RecyclerView

我有一个RecyclerView从本地数据JSONCardView.我需要在单击一个或多个项目时更改所选项目(更改背景项目选择或突出显示)(如在线应用程序中编辑)但不使用Button或longpress.但我不想使用StateListDrawable或(使用XML),因为我有一些JSON需要稍后处理的数据.

我需要一个状态在我的Activity中像一个布尔值或者某些东西来保存我点击的每个项目,但我没有任何解决方案.我已阅读并尝试了一些教程,但它不起作用.现在低于我的活动:

adapter.setOnRecyclerViewClickedListener(new Adapter.OnRecyclerViewItemClickedListener() {
        @Override
        public void OnRecyclerViewItemClicked(int position) {
            boolean selectedItem = false;

            adapter.setOnRecyclerViewClickedListener(new Adapter.OnRecyclerViewItemClickedListener() {

        @Override
        public void OnRecyclerViewItemClicked(int position)  {

    /* ------ boolean variabel for adapter but still not work ----- */
            JSONObject filteredtableList= null;

            try {
                filteredtableList= new JSONObject("response").getJSONObject("tTisch");
            }
            catch (JSONException e) {
                e.printStackTrace();
            }

                if (recyclerView == null) {
                    try {
                        filteredtableList.has("true");
                        filteredtableList.put(status, true);
                    } catch (JSONException e) {
                        e.printStackTrace();
                    } …
Run Code Online (Sandbox Code Playgroud)

java android json android-recyclerview

8
推荐指数
1
解决办法
1893
查看次数

斯威夫特:在"特定日期"前30天获取

我有关于显示具体日期的问题.在这种情况下,我的API中的随机日期(2015年6月16日)始终发生变化.我把它变成toDate了日期类型的变量名.我需要获得前30天toDate我的fromDate变量.我看了这个,但它还没有用.提前致谢.

*注意:我在这个控制器中没有任何DatePicker

date datepicker swift

5
推荐指数
2
解决办法
4068
查看次数

某些“ UIButton”中的单个选择

假设我有10个UIButton如下

在此处输入图片说明

我想实现单选,但我不知道该怎么做。条件如下:

首先,ALL按钮将处于选定位置(突出显示等)。当我单击另一个按钮(如VCU按钮)时,该VCU按钮将突出显示并且该ALL按钮将处于正常状态(取消突出显示)。

程式码片段:

@IBAction func buttonDisplayAction(_ sender: UIButton) {
    if sender == self.buttonAll {
        self.currNr = -1
        self.filteredDataRoomStatus = self.dataRoomStatus
    } else if sender == self.buttonVCU {
        self.currNr = 1
        self.isButtonSelected = true
        self.filteredDataRoomStatus = filterArray(dataRoomStatus, keywords: "zistatus", searchStr: "\(self.currNr)", equalFlag: true)
    } else if sender == self.buttonOC {
        self.currNr = 5
        self.isButtonSelected = true
        self.filteredDataRoomStatus = filterArray(dataRoomStatus, keywords: "zistatus", searchStr: "\(self.currNr)", equalFlag: true)
    } else if sender == …
Run Code Online (Sandbox Code Playgroud)

uibutton ios swift

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

获取数组中的所有值,除了"x"值Swift 3

我是IOS编程的新手.我有一个问题,如何获取除x值以外的数组中的所有值.假设我有如下数组:

let array : [Any] = [1,2,3,4,5,6,7,8,9,0,11,22,33,44,55,66,77,200]
Run Code Online (Sandbox Code Playgroud)

如何打印除1和2之外的所有值.

我已经读过这个,它的使用filter和我在游乐场尝试但我仍然没有正确的价值.任何答案对我都有帮助.提前致谢 .

swift

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

下载的 PHP 文件改为在 CPanel Hosting 中打开

我使用 Ubuntu 16.x,现在我在 macOS Sierra 中尝试,但我仍然遇到这个问题。我已阅读有关此问题的所有问题,但大多数情况都发生在本地服务器中。

我已经在我的 Ubuntu 中下载了 Apache2 和 PHP 5,但它没有解决我的问题。我没有任何想法来解决这个问题。我在 CPanel 和本地(lampp)中有一个托管在我的 Ubuntu 中。在本地服务器中,.php 可以执行,但是当我放入我的主机时,它会被下载而不是执行。我的 CPanel 中是否有特定设置?

php cpanel

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

标签 统计

swift ×4

android ×1

android-recyclerview ×1

cpanel ×1

date ×1

datepicker ×1

ios ×1

java ×1

json ×1

php ×1

uibutton ×1