前提・実現したいこと
下記のようにUIBarButtonItemの前面にバッジを表示させたいのですが
アラートを表示後
OKボタンを押すと背面に隠れます。
この回避策を教えて頂けますでしょうか。
再現するのはiOS 11, 12です。
iOS 9, 10では再現しませんでした。
補足情報(FW/ツールのバージョンなど)
使用ライブラリ
RKNotificationHub
XCode 10.1
Swift 4.2.1
AppDelegate
1 func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool { 2 // viewConrollerを生成. 3 let myViewController = ViewController() 4 5 // navigationControllerを生成. 6 let navigationController = UINavigationController(rootViewController: myViewController) 7 8 // windowを生成. 9 window = UIWindow(frame: UIScreen.main.bounds) 10 11 // rootViewControllerにnavigationControllerを設定. 12 window?.rootViewController = navigationController 13 14 window?.makeKeyAndVisible() 15 16 return true 17 }
ViewController
1import UIKit 2import RKNotificationHub 3 4class ViewController: UIViewController { 5 6 private var myLeftButton: UIBarButtonItem! 7 override func viewDidLoad() { 8 super.viewDidLoad() 9 // Do any additional setup after loading the view, typically from a nib. 10 11 self.view.backgroundColor = UIColor.cyan 12 self.title = "Title" 13 14 myLeftButton = UIBarButtonItem(barButtonSystemItem: .camera, 15 target: self, 16 action: nil) 17 18 myLeftButton.tag = 1 19 20 self.navigationItem.leftBarButtonItem = myLeftButton 21 22 DispatchQueue.main.async { 23 let hub = RKNotificationHub(barButtonItem: self.navigationItem.leftBarButtonItem) 24 hub?.increment() 25 hub?.showCount() 26 hub?.moveCircleBy(x: 0, y: 10) 27 } 28 29 // Alertを表示する 30 self.alert() 31 } 32 33 override func didReceiveMemoryWarning() { 34 super.didReceiveMemoryWarning() 35 // Dispose of any resources that can be recreated. 36 } 37 38 /* 39 ボタンイベント 40 */ 41 private func alert(){ 42 let myAlert: UIAlertController = UIAlertController(title: "タイトル", message: "メッセージ", preferredStyle: .alert) 43 let myOkAction = UIAlertAction(title: "OK", style: .default) { action in 44 print("Action OK!!") 45 } 46 myAlert.addAction(myOkAction) 47 present(myAlert, animated: true, completion: nil) 48 } 49 50 51}
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。