Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | ||||||
2 | 3 | 4 | 5 | 6 | 7 | 8 |
9 | 10 | 11 | 12 | 13 | 14 | 15 |
16 | 17 | 18 | 19 | 20 | 21 | 22 |
23 | 24 | 25 | 26 | 27 | 28 |
Tags
- ObservableObject
- Homomorphic Encryption
- 애플인텔리전스
- 동형 암호
- pipelines
- Security as a Service
- provisioning file path
- URLSession
- AI
- error outputting keys and certificates
- ObObjective c
- app intents
- colorLiteral
- SwiftUI
- #colorLiteral
- 정보관리기술사
- apache
- Data Flow Through SwiftUI
- EnvironmentObject
- BindableObject
- apple intelligence
- php
- HTTP
- Xcode
- VirtualBox
- 앱 인텐트
- swift
- MAC
- IOS
- URLSessionConfiguration
Archives
- Today
- Total
Project Jo
UIAlertController 를 여러번 띄우기 본문
UIAlertController 를 사용하게 되면서 UIAlertView 와는 다르게 어러개의 팝업이 중첩되어 표시되지 않는 상황을 확인하였다.
따라서 윈도우 1개에 UIAlertController 1개를 표시하여 여러개의 UIAlertController 를 표시가 가능하게 하는 방법이 좋아보여 정리하였다.
단, 해당 방법은 윈도우에 추가 하기 때문에 최근에 나온 Scene 을 이용하는 앱에는 사용이 불가능하다.
ObObjective c
- (void)showAlert
{
__block UIWindow *alertWindow = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];
alertWindow.rootViewController = [[UIViewController alloc] init];
alertWindow.windowLevel = UIWindowLevelAlert + 1;
[alertWindow makeKeyAndVisible];
UIAlertController* alert = [UIAlertController alertControllerWithTitle:@"UIAlertController"
message:@"UIAlertController Multi Show"
preferredStyle:UIAlertControllerStyleAlert];
UIAlertAction* onAction = [UIAlertAction actionWithTitle:@"OK" style:UIAlertActionStyleDefault
handler:^(UIAlertAction * action) {
[alertWindow setHidden:YES];
}];
[alert addAction:onAction];
[alertWindow.rootViewController presentViewController:alert animated:YES completion:nil];
}
Alert ObObjective c.zip
0.04MB
Swift
func showAlert() {
var alertWindow: UIWindow?
let windowScene = UIApplication.shared
.connectedScenes
.filter { $0.activationState == .foregroundActive }
.first
if let windowScene = windowScene as? UIWindowScene {
alertWindow = UIWindow(windowScene: windowScene)
} else {
alertWindow = UIWindow.init(frame: UIScreen.main.bounds)
}
alertWindow?.frame = UIScreen.main.bounds
alertWindow?.rootViewController = UIViewController.init()
alertWindow?.windowLevel = UIWindow.Level.alert + 1
alertWindow?.makeKeyAndVisible()
let alert: UIAlertController = UIAlertController.init(title: "UIAlertController",
message: "UIAlertController Multi Show",
preferredStyle: .alert)
let onAction: UIAlertAction = UIAlertAction.init(title: "OK",
style: .default) { (action: UIAlertAction) in
alertWindow?.isHidden = true
}
alert.addAction(onAction)
alertWindow?.rootViewController?.present(alert, animated: true, completion: nil)
}
'Developer > iOS' 카테고리의 다른 글
cocoapods-binary-cache 를 이용한 빌드 속도 개선 검토 (0) | 2022.05.27 |
---|---|
iOS MVVM 적용해 보기 (0) | 2022.01.06 |
MDM Push 인증서 만들기 (9) | 2015.11.18 |
pem 만들기 커멘드 (0) | 2015.09.04 |
WebView 를 이용해서 HTML 긁어 오는 방법 (0) | 2015.04.14 |