iOS Development is easy with XCode, Swift3, UITableView, cocatouch, let's build iPhone, iPad and Macbook Applications.

Why is CGFloat float on 32 bit and double on 64 bit?

From “CoreGraphics/CGBase.h”: #if defined(__LP64__) && __LP64__ # define CGFLOAT_TYPE double # define CGFLOAT_IS_DOUBLE 1 # define CGFLOAT_MIN DBL_MIN # define CGFLOAT_MAX DBL_MAX #else # define CGFLOAT_TYPE float # define CGFLOAT_IS_DOUBLE 0 # define CGFLOAT_MIN FLT_MIN # define CGFLOAT_MAX FLT_MAX #endif Why did Apple do this? What’s the advantage? I can seem to think of downsides […]

How to randomize an NSMutableArray?

Possible Duplicate: iphone – nsarray/nsmutablearray – re-arrange in random order I have an NSMutableArray that contains 20 objects. Is there any way that I could randomize their order like when you shuffle a deck. (By order I mean their index in the array) Like if I had an array that contained: apple orange pear banana […]

Is it possible to add “keyed-subscripting” to Class objects?

In the vein of… @implementation MyClass – (id) objectForKeyedSubscript:(id)k { return [self something:k]; } Is it also possible to “subscript” Class objects? I too, am about to find out, with you.. but thought I would post this question as I tested it out, myself… + (id) objectForKeyedSubscript:(id)k { return [self.shared something:k]; } And alas.. it […]

Xcode gives 3 syntax errors dealing with Stray '\342' in program

I am working on a simple project in Objective-C in Xcode and I’m getting some stray/ errors about the following line of code: if(celsius < −273.15) { NSLog(@”It is impossible to convert temperatures less than −273.15 degrees Celsius, because this is absolute zero, the coldest possible temperature.”); } It’s actually only about the first line, […]

Is it necessary to declare ivars in @interface to match properties?

Possible Duplicate: Properties and Instance Variables in Objective-C 2.0 I’m confused by these two code segments: First: //.h @interface Student : NSObject { } @property (nonautomic, copy) NSString *name; @property (nonautomic, retain) NSNumber *age; @end //.m @implementation Student @synthesize name; @synthesize age; @end Second: //.h @interface Student : NSObject { NSString *name; // <<============ difference […]

How to display an array in reverse order in objective C

This question already has an answer here: How can I reverse a NSArray in Objective-C? 17 answers

How can I animate zoom in / zoom out on iOS using Objective C?

I’m looking to replicate the zoom in / zoom out animations so common in iOS applications (example #1, #2). I am specifically looking for a source that can provide some common library with pre-specified values for ideal sort of animations. Like for zoom in, it should come with preconfigured transform values that are easily identifiable […]

How to make an iPhone dropdown-looking button

I’ve seen a dropdown-like button on many apps, including Turf Wars, that simulates a dropdown with a picker. I need to use the same functionality in my app, but I’m not too sure what the best way to go about it may be. Example: I figured I could make two images and set them as […]

Instruments (Leaks) and NSDateFormatter

When I run my iPhone app with Instruments Leaks and parse a bunch of NSDates using NSDateFormatter my memory goes up about 1mb and stays even though these NSDates should be dealloc’d after the parsing (I just discard them if they aren’t new). I thought the malloc (in my heaviest stack trace below) could become […]

How to know we reached the last row of NSTableView

NSTableView is what I am using to display millions of data, which I can not get in response due to time out. So what I decided to get response in pages say 1-100 then 101-200 etc. So my problem starts here, how can I know that I have reached to the end of tableView or […]