|
Re: How to Display a Time Interval
You want NSDateComponentsFormatter:
/* NSDateComponentsFormatter provides locale-correct and flexible string formatting of quantities of time, such as "1 day" or "1h 10m", as specified by
You want NSDateComponentsFormatter:
/* NSDateComponentsFormatter provides locale-correct and flexible string formatting of quantities of time, such as "1 day" or "1h 10m", as specified by
|
By
Jens Alfke
·
#960
·
|
|
Re: How to Display a Time Interval
Hi Dave
I seem to remember using NSCalendatDate and the descriptionWithCalendarFormat: method to get what you want.
NSCalendarDate is now deprecated - the docs advocate the use of NSDate,
Hi Dave
I seem to remember using NSCalendatDate and the descriptionWithCalendarFormat: method to get what you want.
NSCalendarDate is now deprecated - the docs advocate the use of NSDate,
|
By
Peter Hudson
·
#959
·
|
|
Re: Why would an instance of NSMutableArray be immutable?
Nope. This is due to the way CF bridging works — the magic class __NSCFArray (?) is bridged to CFArray and CFMutableArray. To support mutable arrays, that means __NSCFArray has to subclass
Nope. This is due to the way CF bridging works — the magic class __NSCFArray (?) is bridged to CFArray and CFMutableArray. To support mutable arrays, that means __NSCFArray has to subclass
|
By
Jens Alfke
·
#958
·
|
|
Why would an instance of NSMutableArray be immutable?
I was trying to add an object to an array and got an exception saying that I was trying to modify an immutable object. I set a breakpoint just before the addObject: line, and said to lldb
po
I was trying to add an object to an array and got an exception saying that I was trying to modify an immutable object. I set a breakpoint just before the addObject: line, and said to lldb
po
|
By
James Walker
·
#957
·
|
|
Re: Some gestures aren't working right away
No ideas about this?
I have an iOS app that's giving me a pain. One view hierarchy has a scroll view, page view, and other views. The storyboard has 3 gesture recognizers scattered among a couple of
No ideas about this?
I have an iOS app that's giving me a pain. One view hierarchy has a scroll view, page view, and other views. The storyboard has 3 gesture recognizers scattered among a couple of
|
By
Steve Mills
·
#956
·
|
|
Some gestures aren't working right away
I have an iOS app that's giving me a pain. One view hierarchy has a scroll view, page view, and other views. The storyboard has 3 gesture recognizers scattered among a couple of the view controllers.
I have an iOS app that's giving me a pain. One view hierarchy has a scroll view, page view, and other views. The storyboard has 3 gesture recognizers scattered among a couple of the view controllers.
|
By
Steve Mills
·
#955
·
|
|
Dragging a file unto an app in iOS simulator
Hi:
Previously, you could drag and drop from the Mac desktop over an app in iOS Simulator, and if the app was set up for that file extension, it would open the app and open the file through the
Hi:
Previously, you could drag and drop from the Mac desktop over an app in iOS Simulator, and if the app was set up for that file extension, it would open the app and open the file through the
|
By
Owen Hartnett
·
#954
·
|
|
Re: flagsChanged: not being called on NSControl subclass
Aha! No, it was not. It does now and I’m getting flagsChanged. I guess that makes sense that the OS only sends those to the firstResponder. Thanks for your hunch.
Extending your suggestion, I added
Aha! No, it was not. It does now and I’m getting flagsChanged. I guess that makes sense that the OS only sends those to the firstResponder. Thanks for your hunch.
Extending your suggestion, I added
|
By
Steve Mills
·
#953
·
|
|
Re: flagsChanged: not being called on NSControl subclass
Does your control actually become first responder? That might be necessary for flagsChanged: to go to your control.
A less than perfect option would be to poll the modifier flags on mouse
Does your control actually become first responder? That might be necessary for flagsChanged: to go to your control.
A less than perfect option would be to poll the modifier flags on mouse
|
By
James Walker
·
#952
·
|
|
Re: How to Display a Time Interval
They wanted the number of weeks - I didn’t ask questions, plus the Total Number of Weeks and Total Number of days.
Cheers
Dave
They wanted the number of weeks - I didn’t ask questions, plus the Total Number of Weeks and Total Number of days.
Cheers
Dave
|
By
Dave
·
#951
·
|
|
Re: How to Display a Time Interval
*snip*
I'm not sure why you needed to reinvent the wheel when NSCalendar and NSDateComponents already does this via:
-(NSDateComponents*) components:(NSCalendarUnit)unitFlags
*snip*
I'm not sure why you needed to reinvent the wheel when NSCalendar and NSDateComponents already does this via:
-(NSDateComponents*) components:(NSCalendarUnit)unitFlags
|
By
Steve Mills
·
#950
·
|
|
Re: How to Display a Time Interval
Hi,
As far as I know I don’t have to worry about leap years, get the Interval between now and some future date, this includes all the leap years in between. I am displaying it at the moment by
Hi,
As far as I know I don’t have to worry about leap years, get the Interval between now and some future date, this includes all the leap years in between. I am displaying it at the moment by
|
By
Dave
·
#949
·
|
|
Re: How to Display a Time Interval
If he has a time interval, why not just use NSDateComponentsFormatter's -stringFromTimeInterval:?
Either way, be aware that NSDateComponentsFormatter doesn't cope with an interval of 2^32 or above.
If he has a time interval, why not just use NSDateComponentsFormatter's -stringFromTimeInterval:?
Either way, be aware that NSDateComponentsFormatter doesn't cope with an interval of 2^32 or above.
|
By
Shane Stanley
·
#948
·
|
|
Re: How to Display a Time Interval
Sorry, forgot the last part. After you get the components using the calendar you wish to use with your two dates, then call NSDateComponentsFormatter. For a simple case, you could get by with:
+
Sorry, forgot the last part. After you get the components using the calendar you wish to use with your two dates, then call NSDateComponentsFormatter. For a simple case, you could get by with:
+
|
By
Gary L. Wade
·
#947
·
|
|
Re: How to Display a Time Interval
Ooops, I’m wrong...
Leap year complications should be part of the time interval and be ignored.
My programming history got the better of my knowledge... the first ever COBOL program I wrote
Ooops, I’m wrong...
Leap year complications should be part of the time interval and be ignored.
My programming history got the better of my knowledge... the first ever COBOL program I wrote
|
By
Marco S Hyman
·
#946
·
|
|
Re: How to Display a Time Interval
Use NSCalendar’s method:
- (NSDateComponents *)components:(NSCalendarUnit)unitFlags fromDate:(NSDate *)startingDate toDate:(NSDate *)resultDate options:(NSCalendarOptions)opts;
--
Gary L.
Use NSCalendar’s method:
- (NSDateComponents *)components:(NSCalendarUnit)unitFlags fromDate:(NSDate *)startingDate toDate:(NSDate *)resultDate options:(NSCalendarOptions)opts;
--
Gary L.
|
By
Gary L. Wade
·
#945
·
|
|
Re: How to Display a Time Interval
Can not be done accurately using only a Time Interval in seconds. You also need either the start or end date to figure out leap year complications.
Don’t know of any. I’d probably roll my
Can not be done accurately using only a Time Interval in seconds. You also need either the start or end date to figure out leap year complications.
Don’t know of any. I’d probably roll my
|
By
Marco S Hyman
·
#944
·
|
|
Re: How to Display a Time Interval
There's NSDateComponentsFormatter, although it's fairly limited.
--
Shane Stanley <sstanley@...>
<www.macosxautomation.com/applescript/apps/>, <latenightsw.com>
There's NSDateComponentsFormatter, although it's fairly limited.
--
Shane Stanley <sstanley@...>
<www.macosxautomation.com/applescript/apps/>, <latenightsw.com>
|
By
Shane Stanley
·
#943
·
|
|
Re: How to Display a Time Interval
Look at the NSDate and NSDateFormatter classes.
-Owen
Look at the NSDate and NSDateFormatter classes.
-Owen
|
By
Owen Hartnett
·
#942
·
|
|
How to Display a Time Interval
Objective-C, Mac.
Hi,
I’m trying to display a countdown to a date in the future e.g. the number of years, weeks and days to 1/1/2021.
I have the Time Interval between now and the future date in
Objective-C, Mac.
Hi,
I’m trying to display a countdown to a date in the future e.g. the number of years, weeks and days to 1/1/2021.
I have the Time Interval between now and the future date in
|
By
Dave
·
#941
·
|