iOS & macOS development
113.9K views | +29 today
iOS & macOS development
cool tips and source code for Cocoa, Swift and Objective-C
Curated by Alessio Nonni
Your new post is loading...
Your new post is loading...
Scoop.it!

Ownership of presented view controllers with and without ARC

Yesterday, I tweeted a classical design issue on who should own a view controller.


Mugunth Kumar ()@mugunthkumar
The controller that presents a modal controller should dismiss it. Don't do [self dismissModalViewControllerAnimated:NO] in the child.

25 Feb 12 ReplyRetweetFavorite


Mugunth Kumar ()@mugunthkumar
Calling [self dismissModalViewControllerAnimated:NO] on child is like committing seppuku. A child shouldn't kill itself.
25 Feb 12 ReplyRetweetFavorite


The negative replies I received to the tweet were phenomenal that I had to write this post explaining the “why” behind the tweet.

more...
No comment yet.
Scoop.it!

Beginning ARC in iOS 5 Tutorial Part 2 | Ray Wenderlich

Beginning ARC in iOS 5 Tutorial Part 2 | Ray Wenderlich | iOS & macOS development | Scoop.it

This is the second part of a two part tutorial series on using ARC in iOS 5.
In the first part of the series, we covered how ARC works and how to convert projects to use ARC with Xcode’s built in conversion utility.
In this second and final part of the series, we’ll cover how to convert files by hand, ARC as it relates to Core Foundation, weak properties, and much more!

more...
No comment yet.
Scoop.it!

Migrating your code to Objective-C ARC | MKBlog

Migrating your code to Objective-C ARC | MKBlog | iOS & macOS development | Scoop.it
Recently, Apple introduced several new developer stuff including Xcode 4, ARC, LLVM Compiler 3.0 and iOS 5.
more...
No comment yet.
Scoop.it!

ARC Gotcha – Unexpectedly Short Lifetimes

ARC Gotcha – Unexpectedly Short Lifetimes | iOS & macOS development | Scoop.it

One of our engineers was working on a project and wrote some code that crashed when running on a device:


CGColorRef color =
[UIColor colorWithRed: 0.2
green: 0.3
blue: 0.4
alpha: 1.0].CGColor;
[[self.view layer]
setBackgroundColor: color];


It looks reasonable. Could it be a toolkit bug? It’d be weird for something to be so obviously broken in a fundamental CoreAnimation call. It’s like the CGColor is pointing to garbage when it gets used. Almost as if the newly-created UIColor suddenly vanished and took the CGColor down with it.

more...
No comment yet.
Scoop.it!

Beginning ARC in iOS 5 Tutorial Part 1 | Ray Wenderlich

Beginning ARC in iOS 5 Tutorial Part 1 | Ray Wenderlich | iOS & macOS development | Scoop.it

The most disruptive change in iOS 5 is the addition of Automatic Reference Counting, or ARC for short. ARC is a feature of the new LLVM 3.0 compiler and it completely does away with the manual memory management that all iOS developers love to hate.

more...
No comment yet.