ios - StringWithFormat "%.2ld" objc to swift -


I have a pickerView object in a fast project. I understand the code in Objective-C but I'm not sure How to implement it in swift

Objc method

  - (NSInteger) pickerView: (UIPickerView *) pickerView numberoffs ows Ingestion: (NSInteger) component {switch (component) {case 0: // week return 7; Case 1: // hour return 24; Default: // min 60; // or 7; (10 10) or / or 13; (5 5)}}   

I'm not sure how to implement the Switch Statement for the Title ForRow function. Then the stringWithFormat: @ "% .2ld", (long) line is the problem. (NSString *) pickerView: (UIPickerView *) pickerView titleForRow: Earning for NSInteger: (NSInteger) Component {Switch (Component) {Case 0: // Week Return _DayFewike [ Line]; Case 1: // hour return [NSString stringWithFormat: @ "% .2ld", (long) line]; Default: // minutes back [NSString stringWithFormat: @ "% .2ld", (long) line]; // or, line * 10] // or, line * 5]}}

Can anyone help me out?

Greetings, Dex

You can continue using string with format , But the initiator names do little mating:

  return NSString (format: "% .2ld", line)   

Basically any Name as class {{class}} (XXXX: ...) is [{{class}} {{class}} withXXXX: ...] / Code>

Comments

Popular posts from this blog

java - ImportError: No module named py4j.java_gateway -

python - Receiving "KeyError" after decoding json result from url -

.net - Creating a new Queue Manager and Queue in Websphere MQ (using C#) -