Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/115.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
Ios 如何通过单击UITableViewController中的自定义单元格禁用segue,而不在此单元格中禁用文本字段编辑_Ios_Swift - Fatal编程技术网

Ios 如何通过单击UITableViewController中的自定义单元格禁用segue,而不在此单元格中禁用文本字段编辑

Ios 如何通过单击UITableViewController中的自定义单元格禁用segue,而不在此单元格中禁用文本字段编辑,ios,swift,Ios,Swift,我有带textfild的自定义单元格。 对于某些单元格,我需要通过单击禁用segue并启用文本字段进行编辑。我尝试这样做: if indexPath.row<tests.count{ cell.themeTextField?.text = test.name cell.themeTextField.enabled=false } else { cell.accessoryType = UITableViewCellAcce

我有带textfild的自定义单元格。 对于某些单元格,我需要通过单击禁用segue并启用文本字段进行编辑。我尝试这样做:

    if indexPath.row<tests.count{
       cell.themeTextField?.text = test.name
       cell.themeTextField.enabled=false
    }
    else {
        cell.accessoryType = UITableViewCellAccessoryType.None
        cell.selectionStyle = UITableViewCellSelectionStyle.None;
        cell.userInteractionEnabled = false;   
    }
如果indexath.row尝试另一种方法

从tableCell中删除该序列,并从
UITableViewController
(从对象导航器而不是情节提要中将其拖动)创建一个新的序列到下一个控制器-并为其命名(例如:
DidSelectCellSegue

然后在
didselectrowatinexpath:
delegate方法中,以编程方式和条件执行该步骤

func tableView(tableView: UITableView!, didSelectRowAtIndexPath indexPath: NSIndexPath!) {

    if conditionForPerformingSegueIsSatisfied {
        self.performSegueWithIdentifier("DidSelectCellSegue", sender: self)
    }
}
并将
cellForRow
code更改为

if indexPath.row<tests.count{
   cell.themeTextField?.text = test.name
   cell.themeTextField.enabled=false
}
else {
    cell.accessoryType = UITableViewCellAccessoryType.None
    cell.selectionStyle = UITableViewCellSelectionStyle.None;
    cell.themeTextField.enabled = true;   
}
如果indexath.row尝试另一种方法

从tableCell中删除该序列,并从
UITableViewController
(从对象导航器而不是情节提要中将其拖动)创建一个新的序列到下一个控制器-并为其命名(例如:
DidSelectCellSegue

然后在
didselectrowatinexpath:
delegate方法中,以编程方式和条件执行该步骤

func tableView(tableView: UITableView!, didSelectRowAtIndexPath indexPath: NSIndexPath!) {

    if conditionForPerformingSegueIsSatisfied {
        self.performSegueWithIdentifier("DidSelectCellSegue", sender: self)
    }
}
并将
cellForRow
code更改为

if indexPath.row<tests.count{
   cell.themeTextField?.text = test.name
   cell.themeTextField.enabled=false
}
else {
    cell.accessoryType = UITableViewCellAccessoryType.None
    cell.selectionStyle = UITableViewCellSelectionStyle.None;
    cell.themeTextField.enabled = true;   
}
如果indexath.row尝试另一种方法

从tableCell中删除该序列,并从
UITableViewController
(从对象导航器而不是情节提要中将其拖动)创建一个新的序列到下一个控制器-并为其命名(例如:
DidSelectCellSegue

然后在
didselectrowatinexpath:
delegate方法中,以编程方式和条件执行该步骤

func tableView(tableView: UITableView!, didSelectRowAtIndexPath indexPath: NSIndexPath!) {

    if conditionForPerformingSegueIsSatisfied {
        self.performSegueWithIdentifier("DidSelectCellSegue", sender: self)
    }
}
并将
cellForRow
code更改为

if indexPath.row<tests.count{
   cell.themeTextField?.text = test.name
   cell.themeTextField.enabled=false
}
else {
    cell.accessoryType = UITableViewCellAccessoryType.None
    cell.selectionStyle = UITableViewCellSelectionStyle.None;
    cell.themeTextField.enabled = true;   
}
如果indexath.row尝试另一种方法

从tableCell中删除该序列,并从
UITableViewController
(从对象导航器而不是情节提要中将其拖动)创建一个新的序列到下一个控制器-并为其命名(例如:
DidSelectCellSegue

然后在
didselectrowatinexpath:
delegate方法中,以编程方式和条件执行该步骤

func tableView(tableView: UITableView!, didSelectRowAtIndexPath indexPath: NSIndexPath!) {

    if conditionForPerformingSegueIsSatisfied {
        self.performSegueWithIdentifier("DidSelectCellSegue", sender: self)
    }
}
并将
cellForRow
code更改为

if indexPath.row<tests.count{
   cell.themeTextField?.text = test.name
   cell.themeTextField.enabled=false
}
else {
    cell.accessoryType = UITableViewCellAccessoryType.None
    cell.selectionStyle = UITableViewCellSelectionStyle.None;
    cell.themeTextField.enabled = true;   
}

if indexath.row在else中启用
themeTextField
并进行检查。@Akhilrajtr在else中启用
themeTextField
并进行检查没有帮助。@Akhilrajtr在else中启用
themeTextField
并进行检查没有帮助。@Akhilrajtr没用