NotificationContentExtension 本地化

This commit is contained in:
Fin 2018-07-05 17:40:04 +08:00
parent 57e9b55197
commit adf72cd76a
3 changed files with 9 additions and 2 deletions

View File

@ -27,6 +27,7 @@
0637FA8A20E0D58800E80174 /* NewServerViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0637FA8920E0D58800E80174 /* NewServerViewController.swift */; };
0637FA8C20E0D7A700E80174 /* BaseViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0637FA8B20E0D7A700E80174 /* BaseViewController.swift */; };
063C499520E36BF9001BCA35 /* Localizable.strings in Resources */ = {isa = PBXBuildFile; fileRef = 063C499720E36BF9001BCA35 /* Localizable.strings */; };
065A4D4220EE1A31002EB2DB /* Localizable.strings in Resources */ = {isa = PBXBuildFile; fileRef = 063C499720E36BF9001BCA35 /* Localizable.strings */; };
0661A543204FDA4100965E4E /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0661A542204FDA4100965E4E /* AppDelegate.swift */; };
0661A545204FDA4100965E4E /* HomeViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0661A544204FDA4100965E4E /* HomeViewController.swift */; };
0661A54A204FDA4100965E4E /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 0661A549204FDA4100965E4E /* Assets.xcassets */; };
@ -311,6 +312,7 @@
buildActionMask = 2147483647;
files = (
06802E5320ECC40C00767047 /* Assets.xcassets in Resources */,
065A4D4220EE1A31002EB2DB /* Localizable.strings in Resources */,
0632CE2620EC9098003FDF46 /* MainInterface.storyboard in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;

View File

@ -24,7 +24,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
UNUserNotificationCenter.current().setNotificationCategories([
UNNotificationCategory(identifier: "myNotificationCategory", actions: [
UNNotificationAction(identifier: "copy", title: NSLocalizedString("Copy2"), options: UNNotificationActionOptions.init(rawValue: 0))
UNNotificationAction(identifier: "copy", title: NSLocalizedString("Copy2"), options: UNNotificationActionOptions.foreground)
], intentIdentifiers: [], options: .customDismissAction)
])

View File

@ -15,7 +15,7 @@ class NotificationViewController: UIViewController, UNNotificationContentExtensi
let noticeLabel:UILabel = {
let label = UILabel()
label.textColor = UIColor.black
label.text = "复制完成!"
label.text = NSLocalizedString("Copy", comment: "")
label.font = UIFont.systemFont(ofSize: 16)
label.textAlignment = .center
return label
@ -26,8 +26,13 @@ class NotificationViewController: UIViewController, UNNotificationContentExtensi
self.view.addSubview(self.noticeLabel)
self.preferredContentSize = CGSize(width: 0, height: 1)
}
override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)
self.preferredContentSize = CGSize(width: 0, height: 1)
}
override func viewDidAppear(_ animated: Bool) {
super.viewDidAppear(animated)
self.preferredContentSize = CGSize(width: 0, height: 1)
}
func didReceive(_ notification: UNNotification) {