Mac Cocoa |
Author |
Message |
Ike Kapetan
Joined: 17 Jun 2006 Posts: 3136 Location: Europe
|
|
Back to top |
|
|
delovski
Joined: 14 Jun 2006 Posts: 3524 Location: Zagreb
|
|
Back to top |
|
|
Ike Kapetan
Joined: 17 Jun 2006 Posts: 3136 Location: Europe
|
Posted: Fri Jun 19, 2009 4:21 pm Post subject: |
|
|
SO - Is it possible to detect if the cellular network is available?
"I'm working on an iPhone app and I'd like to be able to check if the phone is
able to make phone calls (and warn the user if not). This could be due to no
cellular service being available or if the user has placed the phone in airpla-
ne mode." |
|
Back to top |
|
|
delovski
Joined: 14 Jun 2006 Posts: 3524 Location: Zagreb
|
Posted: Sun Jul 05, 2009 4:19 pm Post subject: |
|
|
iphonedevsdk.com - Is it possible to retrieve these information?
"It does not enumerate every single app, instead it uses the MobileInstalla-
tion cache which is always up-to-date with SpringBoard and holds the Info
dictionaries of all apps installed. Although you're not "supposed" to access
the cache, it's readable my App Store apps. Here is my code which at least
works perfectly fine with the Simulator..." |
|
Back to top |
|
|
delovski
Joined: 14 Jun 2006 Posts: 3524 Location: Zagreb
|
Posted: Mon Jul 06, 2009 12:10 am Post subject: |
|
|
SO - How to Check for an active Internet Connection on iPhone SDK?
"The Reachability class is not shipped with the SDK, but rather a part of this
Apple sample application. Just download it and copy Reachability.h/m to your
project. Also, you have to add the SystemConfiguration framework to your
project." |
|
Back to top |
|
|
delovski
Joined: 14 Jun 2006 Posts: 3524 Location: Zagreb
|
Posted: Wed Jul 22, 2009 12:04 am Post subject: |
|
|
SO - how do I detect the iPhone orientation before rotating
"If that property doesn't get set until some later time, you might try expe-
rimenting with performSelector:afterDelay: to initialize the UI after a small
delay." |
|
Back to top |
|
|
delovski
Joined: 14 Jun 2006 Posts: 3524 Location: Zagreb
|
|
Back to top |
|
|
delovski
Joined: 14 Jun 2006 Posts: 3524 Location: Zagreb
|
|
Back to top |
|
|
XNote Kapetan
Joined: 16 Jun 2006 Posts: 532
|
Posted: Tue Jun 08, 2010 1:57 pm Post subject: |
|
|
SO - How to convert NSDate into unix timestamp iphone sdk
"A Unix timestamp is the number of seconds since 00:00:00 UTC January 1,
1970. It's represented by the type time_t, which is usually a signed 32-bit
integer type (long or int)." |
|
Back to top |
|
|
delovski
Joined: 14 Jun 2006 Posts: 3524 Location: Zagreb
|
Posted: Wed Jun 16, 2010 8:09 pm Post subject: |
|
|
so - iPhone iOS 4 addTimeInterval deprecated
"I'm using addTimeInterval for creating local notification but it seems that it
is now deprecated (iOS 4)." |
|
Back to top |
|
|
delovski
Joined: 14 Jun 2006 Posts: 3524 Location: Zagreb
|
Posted: Wed Oct 27, 2010 10:18 pm Post subject: |
|
|
iphonedevsdk.com - How To Get Date And Time
"I have tried using that to get the month and the day too. But I cannot get it
too work.
NSCalendarUnit, NSDate, NSDateComponents,..."
Code: | sprintf(aString, "The current time is %s\n", [[[NSDate date]
descriptionWithCalendarFormat:@"%H:%M:%S %Z" timeZone:nil
locale:[[NSUserDefaults standardUserDefaults] dictionaryRepresentation]]
UTF8String]); |
|
|
Back to top |
|
|
delovski
Joined: 14 Jun 2006 Posts: 3524 Location: Zagreb
|
Posted: Mon Nov 01, 2010 9:43 pm Post subject: |
|
|
CocoaWithLove - Control and configuration of applications through Info.plist
"The default fields: identifiers, icons and version numbers, How Xcode builds
the Info.plist, Reading from the Info.plist in your program, Essential iPhone
Info.plist entries & Essential Mac OS X Info.plist entries." |
|
Back to top |
|
|
delovski
Joined: 14 Jun 2006 Posts: 3524 Location: Zagreb
|
Posted: Thu Nov 18, 2010 10:01 pm Post subject: |
|
|
Jeff LaMarche - A Category on NSDate
"Among these methods are one that takes a date with a datetime value
and turns it into a date without time, a method that calculates a new dates
that is a certain number of days after the date, and a method that calcu-
lates the difference between two dates given in days."
Code: | @interface NSDate(Misc)
+ (NSDate *)dateWithoutTime;
- (NSDate *)dateByAddingDays:(NSInteger)numDays;
- (NSDate *)dateAsDateWithoutTime;
- (int)differenceInDaysTo:(NSDate *)toDate;
- (NSString *)formattedDateString;
- (NSString *)formattedStringUsingFormat:(NSString *)dateFormat;
@end
|
|
|
Back to top |
|
|
delovski
Joined: 14 Jun 2006 Posts: 3524 Location: Zagreb
|
|
Back to top |
|
|
delovski
Joined: 14 Jun 2006 Posts: 3524 Location: Zagreb
|
Posted: Mon Dec 20, 2010 10:17 am Post subject: |
|
|
MF - Getting a country list in Cocoa
"Something like this should work:"
Code: | NSMutableArray *countryNamesArray = [NSMutableArray array];
NSLocale *current = [NSLocale currentLocale];
for (NSString *countryCode in [NSLocale ISOCountryCodes])
{
[countryNamesArray addObject:[current displayNameForKey:NSLocaleCountryCode value:countryCode]];
}
|
|
|
Back to top |
|
|
Ike Kapetan
Joined: 17 Jun 2006 Posts: 3136 Location: Europe
|
Posted: Tue Jan 25, 2011 9:32 pm Post subject: |
|
|
SO - Initialize a NSDate object with a specific time
Code: | NSDate *today = [NSDate date];
NSCalendar *gregorian = [[NSCalendar alloc]
initWithCalendarIdentifier:NSGregorianCalendar];
NSDateComponents *weekdayComponents =
[gregorian components:(NSDayCalendarUnit | NSWeekdayCalendarUnit) fromDate:today];
[weekdayComponents setHour:12];
[weekdayComponents setMinute:10];
[weekdayComponents setSeconds:30]; |
"I think will set using today's date and then you can create NSDateComponents from that and set time values." |
|
Back to top |
|
|
Ike Kapetan
Joined: 17 Jun 2006 Posts: 3136 Location: Europe
|
Posted: Fri Apr 08, 2011 9:06 pm Post subject: |
|
|
iphonedevsdk.com - Display Version Number in Application
Code: | NSString* version = [[[NSBundle mainBundle] infoDictionary] objectForKey:(NSString*)kCFBundleVersionKey]; |
|
|
Back to top |
|
|
delovski
Joined: 14 Jun 2006 Posts: 3524 Location: Zagreb
|
Posted: Thu Jun 09, 2011 12:12 pm Post subject: |
|
|
Cocoa With Love: WorldTimeConverter: Dates and timezones in Cocoa
"A timezone is represented by ... NSTimeZone... The truly valuable infor-
mation, the data which makes world time conversion possible, comes from
two class methods on NSTimeZone — the knownTimeZoneNames method
and the timeZoneWithName: method. Between the two methods, you can
obtain access to a nearly complete list of world time zones." |
|
Back to top |
|
|
delovski
Joined: 14 Jun 2006 Posts: 3524 Location: Zagreb
|
Posted: Wed Apr 11, 2012 1:42 am Post subject: |
|
|
so - Time Zone Problems with NSDate+InternetTime Class
"I'm using a class of NSDate+InternetTime to help with parsing XMLs for
Calendars, Blogs, etc. I am in Central Time Zone and when I view the
TableView showing each RSS Item, the time listed is correct. However, if
a user is in EST it shows an hour later, and earlier times for Mountain and
Pacific Time Zones. Any ideas why this may be?" |
|
Back to top |
|
|
delovski
Joined: 14 Jun 2006 Posts: 3524 Location: Zagreb
|
Posted: Wed Apr 11, 2012 2:17 am Post subject: |
|
|
Michael Waterfall - NSDate from Internet Date & Time String
"An NSDate class method (intended for use in a category) that will attempt
to return an NSDate from a formatted internet date time string (RFC822 or
RFC3339)." |
|
Back to top |
|
|
delovski
Joined: 14 Jun 2006 Posts: 3524 Location: Zagreb
|
Posted: Mon Jul 09, 2012 10:20 pm Post subject: |
|
|
github.com - gekitz / UIDevice-with-UniqueIdentifier-for-iOS-5
"Brings back the unique identifier support under iOS 5, it uses the device's
mac address in combination with the bundle identifier to generate a new
hashed unique identifier."
Referer: UIDevice uniqueIdentifier Deprecated - What To Do Now?
"Do not use the uniqueIdentifier property. To create a unique identifier
specific to your app, you can call the CFUUIDCreate function to create
a UUID, and write it to the defaults database using the NSUserDefaults
class." |
|
Back to top |
|
|
Ike Kapetan
Joined: 17 Jun 2006 Posts: 3136 Location: Europe
|
Posted: Tue Jul 10, 2012 4:25 pm Post subject: |
|
|
github - mwaterfall / MWFeedParser
See also: GTMNSString+HTML.m & NSDate+InternetDateTime.m
Cool - Ref:
"Check out my NSString category for HTML. Here are the methods available:
- (NSString *)stringByConvertingHTMLToPlainText;
- (NSString *)stringByDecodingHTMLEntities;
- (NSString *)stringByEncodingHTMLEntities;
- (NSString *)stringWithNewLinesAsBRs;
- (NSString *)stringByRemovingNewLinesAndWhitespace;" |
|
Back to top |
|
|
Ike Kapetan
Joined: 17 Jun 2006 Posts: 3136 Location: Europe
|
Posted: Wed Jan 23, 2013 5:06 pm Post subject: |
|
|
github.com - Universal-iOS-App-Template / UniversalExample-Info.plist
Code: | <key>UIInterfaceOrientation</key>
<string>UIInterfaceOrientationPortrait</string>
<key>UIInterfaceOrientation~ipad</key>
<string>UIInterfaceOrientationPortrait</string>
<key>UIStatusBarStyle</key>
<string>UIStatusBarStyleDefault</string>
<key>UISupportedInterfaceOrientations</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationPortraitUpsideDown</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
<key>UISupportedInterfaceOrientations~ipad</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationPortraitUpsideDown</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array> |
|
|
Back to top |
|
|
Ike Kapetan
Joined: 17 Jun 2006 Posts: 3136 Location: Europe
|
Posted: Wed Mar 06, 2013 4:32 pm Post subject: |
|
|
waracle - iPhone NSDateFormatter date formatting table
"This blog is for two reasons: my sanity and yours. The number of times I’ve
had to google this information only to lose the bookmark or scroll through
the 5 mile long page at unicode.org trying to locate the NSDateFormatter
string beggers belief and yes, you’d think I would know it off by heart now." |
|
Back to top |
|
|
Ike Kapetan
Joined: 17 Jun 2006 Posts: 3136 Location: Europe
|
|
Back to top |
|
|
delovski
Joined: 14 Jun 2006 Posts: 3524 Location: Zagreb
|
Posted: Thu Oct 03, 2013 4:58 pm Post subject: |
|
|
MF - Remove iPad status bar (iPhone App)
"Is it possible for the App to remove the status bar when running on iPad,
when the App is not a Universal App (compiled only for iPhone) ?" |
|
Back to top |
|
|
Ike Kapetan
Joined: 17 Jun 2006 Posts: 3136 Location: Europe
|
|
Back to top |
|
|
Ike Kapetan
Joined: 17 Jun 2006 Posts: 3136 Location: Europe
|
Posted: Mon Jan 13, 2014 12:13 am Post subject: |
|
|
vpdn - A closer look at the iOS7 App Switcher
"Apple has revamped the app switcher in iOS7 and now present screenshots
alongside with the app icon. Supplementing the notifications system, the app
switcher gives running apps one extra channel to communicate their current
state. In terms of real estate, the card associated with each running app is
the largest visual representation outside of the app itself." |
|
Back to top |
|
|
Ike Kapetan
Joined: 17 Jun 2006 Posts: 3136 Location: Europe
|
Posted: Sun Apr 13, 2014 10:48 pm Post subject: |
|
|
github.com - iStats
"Quick attempt at writing a Ruby wrapper for a small C library that interacts
with the IOKit library (apple) to get the CPU temperature. Will expand to
more hardware data and stats in the future." |
|
Back to top |
|
|
delovski
Joined: 14 Jun 2006 Posts: 3524 Location: Zagreb
|
Posted: Sun Jan 07, 2018 5:52 pm Post subject: |
|
|
so - Difference between 'YYYY' and 'yyyy' in NSDateFormatter
"A common mistake is to use YYYY. yyyy specifies the calendar year whereas
YYYY specifies the year (of 'Week of Year'), used in the ISO year-week
calendar. In most cases, yyyy and YYYY yield the same number, however they
may be different. Typically you should use the calendar year." |
|
Back to top |
|
|
Ike Kapetan
Joined: 17 Jun 2006 Posts: 3136 Location: Europe
|
Posted: Sat Jul 20, 2019 2:39 pm Post subject: |
|
|
so - How to determine if locale's date format is Month/Day or Day/Month?
"In an ideal world, I want to use NSDateFormatterShortStyle, but just not
display the year (only month & day#). What's the best way to accomplish
this?"
Code: | BOOL dayFirst = [[NSDateFormatter dateFormatFromTemplate:@"MMMMd" options:0 locale:[NSLocale currentLocale]] hasPrefix:@"d"]; |
|
|
Back to top |
|
|
delovski
Joined: 14 Jun 2006 Posts: 3524 Location: Zagreb
|
|
Back to top |
|
|
delovski
Joined: 14 Jun 2006 Posts: 3524 Location: Zagreb
|
Posted: Fri Oct 23, 2020 11:43 am Post subject: |
|
|
r - Falsehoods programmers believe about time zones
"I soon discovered just how wrong I was. One after another, I kept learning
the falsehood of yet another "fact" that had seemed obviously true. Eventually
my original vision became literally impossible to pull off without making serious
compromises (more about that in a future blog post).
Hopefully this list will help you avoid the landmines I stepped on. All the
falsehoods below are ones I'd considered true at some point in my adult life."
|
|
Back to top |
|
|
|