2016-09-20 5 views
-1

updateHeaderNotificationsとDebugAlertをNSlocalizedStringに割り当てるにはどうしたらいいですか?私はupdateHeaderNotifications = Nslocalized("text_text")を追加しようとしましたが、それは動作しません。あなたのメソッドの定義に基づいて、ヘルプswitch文をNSlocalizedStringに割り当てる

private func initViewToCurrentState(pocketStatus: pocketStatus?) { 
    if let status = pocketStatus { 
     switch status { 
     case .Created: 
      **updateHeaderNotifications** ("text1") 
      initpocketBeforeTripView() 

     case .Paid: fallthrough 
     case .Undone: fallthrough 
     case .Aborted: fallthrough 
     default: 
      PocketRideService.sharedInstance.removeCachedRide() 
      dismissViewControllerAnimated(false, completion: { 
       DebugAlert.show("text") 

      }) 
     } 
    } 
} 
+1

? – matsoftware

答えて

0

ためのおかげで、あなたは以下のように使用することができます:

private func updateHeaderNotifications(bigNotify: String, smallNotify: String) { 
    bigNotification.text = NSLocalizedString(bigNotify, comment: "bigNotify")//you can set any text for comment parameter 
    smallNotification.text = NSLocalizedString(smallNotify, comment: "smallNotify") 
} 

とあなたのswitch文で:updateHeaderNotificationsが定義されている方法

 case .Created: 
     updateHeaderNotifications("text1", smallNotify: "text2") 
+0

私はそれが好きですか? –

+0

ケース。作成: updateHeaderNotifications(NSLocalizedString( "AA_AA")、NSLocalizedString( "AA_AA2")) initRouteBeforeTripView()) –

+0

NSLocalizedStringは、2つのパラメータを必要とします。はい、スイッチ自体にテキストを設定しようとすることができます。 – Santosh