Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/objective-c/23.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/103.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/visual-studio-2010/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Objective-C中的搜索框_Objective C_Ios_Uisearchbar - Fatal编程技术网

Objective-C中的搜索框

Objective-C中的搜索框,objective-c,ios,uisearchbar,Objective C,Ios,Uisearchbar,我正在为Objective-C中的搜索框编写程序 我在数组中存储了所有公司的名称 当我在搜索栏中写“我”时,所有以“我”开头的公司都应该 在新数组中显示如何在新数组中动态获取此公司列表 我有一个java程序,我想把它转换成Objective-C ed.addTextChangedListener(new TextWatcher() { public void afterTextChanged(Editable s) {} public void beforeTextChang

我正在为Objective-C中的搜索框编写程序

我在数组中存储了所有公司的名称

当我在搜索栏中写“我”时,所有以“我”开头的公司都应该 在新数组中显示如何在新数组中动态获取此公司列表

我有一个java程序,我想把它转换成Objective-C

ed.addTextChangedListener(new TextWatcher() {

    public void afterTextChanged(Editable s) {}

    public void beforeTextChanged(CharSequence s, int start, int count, int after) {}

    public void onTextChanged(CharSequence s, int start, int before, int count) {

        textlength = ed.getText().length();

        arr_sort.clear();

        for (int i = 0; i < symbolarr.length; i++) {

            if (textlength <= symbolarr[i].length()) {

                if (ed.getText().toString().equalsIgnoreCase((String)symbolarr[i].subSequence(0,textlength))) 
                {
                     arr_sort.add(symbolarr[i]);    
                }
             }
        }

        lv.setAdapter(new ArrayAdapter<String>(DataAttach.this,

        android.R.layout.simple_list_item_1, arr_sort));
   }
});
ed.addTextChangedListener(新的TextWatcher(){
公共无效后文本更改(可编辑的s){}
public void beforeTextChanged(字符序列s、int start、int count、int after){}
public void onTextChanged(字符序列、int start、int before、int count){
textlength=ed.getText().length();
arr_sort.clear();
对于(int i=0;i如果(textlength)看起来不像Objective-C.@JoePasq,他在问题中提到了这是他想要移植的一段Java代码。一旦你喜欢或接受这个问题,只需单击勾号并向上投票即可