Objective-C中的搜索框
我正在为Objective-C中的搜索框编写程序 我在数组中存储了所有公司的名称 当我在搜索栏中写“我”时,所有以“我”开头的公司都应该 在新数组中显示如何在新数组中动态获取此公司列表 我有一个java程序,我想把它转换成Objective-CObjective-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
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代码。一旦你喜欢或接受这个问题,只需单击勾号并向上投票即可