분류 전체보기 (162) 썸네일형 리스트형 round number to 2 decimal places let currentRatio = Double (rxCurrentTextField.text!)! / Double (txCurrentTextField.text!)! railRatioLabelField.text! = String(format: "%.2f", currentRatio) Round up double to 2 decimal places How do I round up currentRatio to two decimal places? let currentRatio = Double (rxCurrentTextField.text!)! / Double (txCurrentTextField.text!)! railRatioLabelField.text! = "\(currentRatio)" stackoverflow.com make a countdown with NSTimer? @IBOutlet var countDownLabel: UILabel! var count = 10 override func viewDidLoad() { super.viewDidLoad() var timer = Timer.scheduledTimer(timeInterval: 0.4, target: self, selector: #selector(UIMenuController.update), userInfo: nil, repeats: true) } func update() { if(count > 0) { countDownLabel.text = String(count--) } } How can I make a countdown with NSTimer? How can I make a countdown with an .. Immutable value X is never used consider replacing with '_' In several cases of my old code I am getting the warning: Immutable value X is never used consider replacing with '_' For instance this often occurs if I am checking an enum which has an associated object (but I don't use the object in this case) - or if I am using the 'If let' construct to check if an object is nil or not. A. These changes are recommended because if you don't use these variable.. iOS: Tracking Visited Locations Introduction iOS has very powerful APIs for tracking user locations and working with maps. You might be making an app for your local café and want to notify the user of special offers when they are nearby. Or, you’re making a music player and you want to start playing some bouncy beats when the user enters a gym. Tracking location all the time, however, can drain a battery really fast! In this C.. Article: Choosing the Location Services Authorization to Request Determine the authorization your app needs to access location data. Overview The authorization status that your app has determines if and when it receives location events. There are two types of authorization your app can request: When In Use Your app can use all location services and receive events while the app is in use. In general, iOS apps are considered in use when they're in the foregroun.. Class: AVAudioPlayer An object that plays audio data from a file or buffer. Declaration class AVAudioPlayer : NSObject Overview Use an audio player to: Play audio of any duration from a file or buffer Control the volume, panning, rate, and looping behavior of the played audio Access playback-level metering data Play multiple sounds simultaneously by synchronizing the playback of multiple players For more information.. App Architecture Launching The launch experience has a significant impact on the way people feel about your app. Regardless of the device people are using or how long it's been since they last opened your app, the launch experience should be fast and seamless. The guidelines below can help you design a delightful launch experience. For developer guidance, see Responding to the Launch of Your App. developer.apple.. iOS Design Themes As an app designer, you have the opportunity to deliver an extraordinary product that rises to the top of the App Store charts. To do so, you'll need to meet high expectations for quality and functionality. Three primary themes differentiate iOS from other platforms: Clarity. Throughout the system, text is legible at every size, icons are precise and lucid, adornments are subtle and appropriate,.. Class: UIViewController An object that manages a view hierarchy for your UIKit app. Declaration class UIViewController : UIResponder Overview The UIViewController class defines the shared behavior that is common to all view controllers. You rarely create instances of the UIViewController class directly. Instead, you subclass UIViewController and add the methods and properties needed to manage the view controller's view.. MVVM Design Pattern Model-View-ViewModel (MVVM) is a structural design pattern that separates objects into three distinct groups: Models hold application data. They’re usually structs or simple classes. Views display visual elements and controls on the screen. They’re typically subclasses of UIView. View models transform model information into values that can be displayed on a view. They’re usually classes, so they.. 이전 1 2 3 4 5 ··· 17 다음