How can you make something like a tooltip when moving to a new scene, so that everything appears automatically once? I try to make through alert, but can there be an easier way?
1 answer
I suggest you use this method.
let defaults1 = NSUserDefaults.standardUserDefaults() var count1 = defaults.integerForKey("count3") ?? 0 if count1 == 0 { // ΠΊΠ°ΠΆΠ΄ΡΠ΅ 40 Π²Ρ
ΠΎΠ΄ showAlert(count1) } count1 += 1 defaults1.setInteger(count1, forKey: "count3")
This method will be used only once at the first launch.
and here is an example of an alert.
func showAlert(count:Int) { let alert = UIAlertController(title: "ΠΠ½ΠΈΠΌΠ°Π½ΠΈΠ΅", message: "ΠΡΠ»ΠΈ Ρ ΠΠ°Ρ Π²ΠΎΠ·Π½ΠΈΠΊΠ°ΡΡ ΠΏΡΠΎΠ±Π»Π΅ΠΌΡ Π² ΡΠ°Π±ΠΎΡΠ΅ ΠΏΡΠΈΠ»ΠΎΠΆΠ΅Π½ΠΈΡ, ΠΡ ΠΌΠΎΠΆΠ΅ΡΠ΅ ΠΎΠΏΠΎΠ²Π΅ΡΡΠΈΡΡ Π½Π°Ρ ΠΎΠ± ΡΡΠΎΠΌ, Π²ΡΠ±ΡΠ°Π² ΠΏΡΠ½ΠΊΡ Β«ΠΠΏΠΎΠ²Π΅ΡΡΠΈΡΡ ΠΎΠ± ΠΎΡΠΈΠ±ΠΊΠ΅Β» Π² ΠΏΡΠ°Π²ΠΎΠΌ Π²Π΅ΡΡ
Π½Π΅ΠΌ ΡΠ³Π»Ρ ΡΠΊΡΠ°Π½Π°.", preferredStyle: .Alert) alert.addAction(UIAlertAction(title: "OK", style: UIAlertActionStyle.Default, handler: nil)) // show the alert dispatch_async(dispatch_get_main_queue(), { () -> Void in self.presentViewController(alert, animated: true, completion: nil) }) }
Good luck.
|