将值返回到tableView函数

时间:2016-02-15 04:29:48

标签: ios swift

我想在自定义表格的按钮中填充标签。一切正常,但我不知道如何将计算数据从我的 login.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { request = new StringRequest(Request.Method.POST, URL, new Response.Listener<String>() { @Override public void onResponse(String response) { progressDialog.show(); try { JSONObject jsonObject = new JSONObject(response); if (jsonObject.names().get(0).equals("success")) { progressDialog.dismiss(); User user = new User(email.getText().toString(), password.getText().toString()); Toast.makeText(MemberLogin.this, jsonObject.getString("success"), Toast.LENGTH_SHORT).show(); userLocalStore.setUserLoggedIn(true); userLocalStore.storeUserData(user); startActivity(new Intent(MemberLogin.this, MemberHome.class)); } else { progressDialog.dismiss(); Toast.makeText(MemberLogin.this, jsonObject.getString("error"), Toast.LENGTH_SHORT).show(); } } catch (JSONException e) { e.printStackTrace(); } } }, new Response.ErrorListener() { @Override public void onErrorResponse(VolleyError error) { progressDialog.dismiss(); } }) { @Override protected Map<String, String> getParams() throws AuthFailureError { HashMap<String, String> hashMap = new HashMap<>(); hashMap.put("email", email.getText().toString()); hashMap.put("password", password.getText().toString()); progressDialog.dismiss(); return hashMap; } }; requestQueue.add(request); } }); 函数发送回IBAction函数,以便通过UITableView语句显示。

请参阅以下代码中的代码和注释:

return cell

1 个答案:

答案 0 :(得分:2)

您可以使用indexpath获取单元格

let cell = tableView.cellForRowAtIndexPath(NSIndexPath(forRow:sender.tag,inSection:0))