我想從UICollectionView的Cell顯示一個UIAlertController。UIAollectionViewCell的UIAlertController
UIAlertController *alert = [UIAlertController alertControllerWithTitle:nil message:nil preferredStyle:UIAlertControllerStyleActionSheet];
UIAlertAction *deleteAction = [UIAlertAction actionWithTitle:@"Delete" style:UIAlertActionStyleDestructive handler:^(UIAlertAction *action) {
}];
UIAlertAction *cancelAction = [UIAlertAction actionWithTitle:@"Cancel" style:UIAlertActionStyleCancel handler:^(UIAlertAction *action) {
}];
[alert addAction:deleteAction];
[alert addAction:cancelAction];
[self presentViewController:alert animated:YES completion:nil];
問題是,單元格沒有[self presentViewController:alert animated:YES completion:nil];方法。
也許有人可以幫助我嗎?
Theis解決方案與委託工作正常,但有另一種好辦法做到這一點。 [self.window.rootViewController presentViewController:alert animated:YES completion:nil]; 雙方都在做他們的工作。 – ViceBrot