![](/img/trans.png)
[英]the keyboard did not appear when i click the textfield in a cell in swift
[英]Viewcontroller appear twice when I click cell
我有個問題。
我在NavigationController中嵌入了一個ViewController。
並使用StoryBoard在此viewController中添加tableView。
然后,我添加了segue。
最后,我單擊下一個viewController兩次顯示的單元格。
我不知道該如何解決。
謝謝!
這是我的代碼:
-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
if(indexPath.row == 2){
[self performSegueWithIdentifier:@"showAdd" sender:self];
}
}
-(void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender{
if ([segue.identifier isEqualToString:@"showAdd"]) {
AddCommentViewController *AddCommentVC = segue.destinationViewController;
AddCommentVC.CommentString = _DetailString;
}
}
您必須在UIViewController
而不是單元格和UIViewController
之間添加UIViewController
,因為在單擊單元格時已連接該序列號,並且您手動調用了序列號,這就是為什么它顯示兩次的原因。
做一件事,刪除segue並將其連接到UIViewControllers
之間,然后它將僅被調用一次。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.