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

Determine MIME Type of NSData Loaded From a File

For various reasons I am intercepting http requests and loading content from files in my app’s document directory using NSURLProtocol. Part of the process involves loading an NSData object, which could be anything from an html file to a jpeg image. NSURLProtocol requires setting a mimetype. Is there an API in the iPhone-SDK to determine […]

xcode 6 IB_DESIGNABLE- not loading resources from bundle in Interface builder

I am trying to make a custom control that updates live in Interface Builder using the new IB_DESIGNABLE option described here. – (void)drawRect:(CGRect)rect { CGContextRef context = UIGraphicsGetCurrentContext(); CGRect myFrame = self.bounds; CGContextSetLineWidth(context, 10); CGRectInset(myFrame, 5,5); [[UIColor redColor] set]; UIRectFrame(myFrame); NSBundle *bundle = [NSBundle mainBundle]; NSString *plistPath; plistPath = [bundle pathForResource:@”fileExample” ofType:@”plist”]; UIImage *tsliderOff = […]

Is there anything like a generic list in Cocoa / Objective-C?

What I really like in C# are generic lists. A list that can contain only one type of objects. Is there something like a generic list in Cocoa/Objective-C? As far I only know NSArray who will take a pointer to any object.

Implement a pure virtual method in Objective-C

I want to go to there. Seriously though, how does one implement a pure virtual method in an “Apple” way? Do you use a Protocol with your base class and throw exceptions on those methods?

Objective C – How do I use initWithCoder method?

I have the following method for my class which intends to load a nib file and instantiate the object: – (id)initWithCoder:(NSCoder*)aDecoder { if(self = [super initWithCoder:aDecoder]) { // Do something } return self; } How does one instantiate an object of this class? What is this NSCoder? How can I create it? MyClass *class = […]

Create a table of contents from a pdf file

I’m using quartz to display pdf content, and I need to create a table of contents to navigate through the pdf. From reading Apple’s documentation I think I am supposed to use CGPDFDocumentGetCatalog, but I can’t find any examples on how to use this anywhere. Any ideas? Update: Still haven’t found a solution for this. […]

Cocoa/ Objective-C Shell Command Line Execution

This is probably a stupid question, but how can I execute a shell command from my Cocoa app? I have the command as a string “command”, but can easily manipulate data as needed. There is no need to get a returned output value.

How to programmatically rotate image by 90 Degrees in iPhone?

Possible Duplicate: How to Rotate a UIImage 90 degrees? How to programmatically rotate image by 90 Degrees in iPhone?

Why can't I release an object anymore?

This question already has an answer here: Under automatic reference counting, why are retain, release, and dealloc not allowed? 4 answers

Serialize and Deserialize Objective-C objects into JSON

I need to serialize and deserialize objective-c objects into JSON to store in CouchDB. Do people have any example code for best practice for a general solution? I looked at a few JSON framework and they are stopped at the NSDictionary/NSArray level. i.e. A lot of framework will serialize and deserialize NSDictionary/NSArray into JSON. But […]