Làm thế nào tôi có thể gọi viewwillappear
sau khi loại bỏ modalviewcontroller
?Calling viewwillappear sau khi loại bỏ modalviewcontroller
Bất kỳ ý tưởng xin vui lòng bởi vì sau khi sa thải viewwillappear
của tôi đã không được gọi:
trình bày viewController tôi modally: // firsviewcontroller:
-(IBAction)AddActivity:(id)sender{
CreateActivity *addViewController = [[CreateActivity alloc] initWithNibName:@"CreateActivity" bundle:nil];
addViewController.delegate = self;
addViewController.modalPresentationStyle = UIModalPresentationFormSheet;
addViewController.modalTransitionStyle = UIModalTransitionStyleFlipHorizontal;
[self presentModalViewController:addViewController animated:YES];
addViewController.view.superview.frame = CGRectMake(50, 260, 680, 624);
}
// secondvioewcontroller: Tôi tạo Một alertview để sa thải này modalview, nhưng viewwillapear không được gọi là:
- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex{
if (buttonIndex == 0){
if ([self respondsToSelector:@selector(presentingViewController)]){
[self.presentingViewController dismissModalViewControllerAnimated:YES];
}
else {
[self.parentViewController dismissModalViewControllerAnimated:YES];
}
}
}
Bạn có chắc chắn không? Bạn kiểm tra như thế nào? Theo kinh nghiệm của tôi, viewWillAppear luôn kích hoạt cho trình điều khiển xem trình bày khi phương thức được trình bày bị loại bỏ. – geraldWilliam
Tôi đã chỉnh sửa bài đăng của mình để xem tôi đã làm gì, Tôi đang thiếu gì? –
@OuassimMouyarden Bạn cần phải học cách suy nghĩ về OOP đúng cách trước khi đi thẳng vào mọi thứ. Điều đó đang được nói, tôi vẫn sẽ giúp bạn, cho đến bây giờ. Bạn muốn điều gì xảy ra chính xác khi nhấn nút UIAlertView? –