Chào mừng đến với Diễn đàn lập trình - Cộng đồng lập trình.
Kết quả 1 đến 2 của 2
  1. #1
    Ngày tham gia
    Sep 2015
    Bài viết
    0

    PopviewController quay về viewController trước đó

    Mình có 1 SessionListViewController khi minh nhấn button Send Email trong SessionListViewController thì nó sẽ hiện lên SendEmailViewController
    trên SendEmailViewController ta có button Send khi click vao button Send ta sẽ cho xuất hiện navigationController SendEmailPopupViewController như sau : code như sau
    SendEmailPopupViewController *sessionListController = (SendEmailPopupViewController *)[self.storyboard instantiateViewControllerWithIdentifier:@"SendEmai lPopupViewController"];
    CustomNavigationController *navigationController =[[CustomNavigationController alloc]initWithRootViewController:sessionListController];
    navigationController.modalPresentationStyle = UIModalPresentationFormSheet;
    [self presentViewController:navigationController animated:YES completion:nil];

    trên SendEmailPopupViewController ta có button X khi nhân vào thì sẽ quay về SessionListViewController , tôi đã dùng dismissview nhưng nó chỉ quay về SendEmailViewController chứ chưa quay về SessionListViewController
    Khi cố gắn dùng popview
    SessionListViewController *settingsVC = [self.storyboard instantiateViewControllerWithIdentifier:@"Identifi erBackEmail"];
    [self.navigationController popToViewController:settingsVC animated:YES];
    [self.navigationController popViewControllerAnimated:YES];
    thì nó error là tried to pop to a view controller that doesn't exist.

    Mong mọi người giúp đỡ.

  2. #2
    Ngày tham gia
    Sep 2015
    Bài viết
    0
    Do bạn present SendEmailPopupViewController nên không thể dismiss theo kiểu đó được, mà present thì nó làm gì có navigation mà pop nữa
    Mình nghĩ có 2 cách thế này
    1- Bạn dismiss SendEmailPopupViewController khi dismiss xong thì pop về SessionListViewController
    2- Bạn đừng present mà push hết đi, như vậy mình có thể
    Mã:
    popToViewController:settingsVC
    được

    p/s : code bạn nên để trong thẻ CODE để mọi người dễ đọc

 

 

Quyền viết bài

  • Bạn Không thể gửi Chủ đề mới
  • Bạn Không thể Gửi trả lời
  • Bạn Không thể Gửi file đính kèm
  • Bạn Không thể Sửa bài viết của mình
  •