This tag should be used only on questions that are about Objective-C features or depend on code in the language. The tags "cocoa" and "cocoa-touch" should be used to ask about Apple's frameworks or classes. Use the related "ios" and "osx" for issues specific to those platforms.

learn more… | top users | synonyms (2)

549
votes
5answers
119k views

How can I disable ARC for a single file in a project?

I am using ARC successfully in my project. However, I have encountered a few files (e.g., in unit tests and mock objects) where the rules of ARC are a little more fragile right now. I recall hearing ...
147
votes
10answers
72k views

Passing Data between View Controllers

I'm new to iOS and Objective-C and the whole MVC paradigm and I'm stuck with the following. I have a View that acts as a data entry form and I want to give the user the option to select multiple ...
462
votes
19answers
168k views

How to check for an active Internet Connection on iPhone SDK?

I would like to check to see if I have an Internet connection on the iPhone using the Cocoa Touch libraries. I came up with a way to do this using an NSURL. The way I did it seems a bit unreliable ...
55
votes
9answers
6k views

When to use -retainCount? [closed]

I would like to know in what situation did you use -retainCount so far, and eventually the problems that can happen using it. Thanks.
121
votes
9answers
82k views

How do I do base64 encoding on iphone-sdk?

I'd like to do base64 encoding and decoding, but I could not find any support from the iPhone SDK. How can I do base64 encoding and decoding with or without a library?
86
votes
7answers
21k views

How does an underscore in front of a variable in a cocoa objective-c class work?

I've seen in a few iPhone examples that attributes have used an underscore _ in front of the variable. Does anyone know what this means? or how it works? an interface file I'm using looks like: ...
380
votes
16answers
163k views

How to sort an NSMutableArray with custom objects in it?

What I want to do seems pretty simple, but I can't find any answers on the web. I have an NSMutableArray of objects, let's say they are 'Person' objects. I want to sort the NSMutableArray by ...
591
votes
12answers
175k views

Atomic vs nonatomic properties

What do atomic and nonatomic mean in property declarations? @property(nonatomic, retain) UITextField *userName; @property(atomic, retain) UITextField *userName; @property(retain) UITextField ...
314
votes
5answers
63k views

How do I set up NSZombieEnabled in Xcode 4?

How do I set up NSZombieEnabled and CFZombieLevel for my executable in Xcode 4?
224
votes
5answers
124k views

How do I create delegates in Objective-C?

I know how delegates work, and I know how I can use them. But how do I create them?
286
votes
33answers
141k views

How to make a UITextField move up when keyboard is present

With the iPhone SDK: I have a UIView with UITextFields that brings up a keyboard. I need it to be able to: Allow scrolling of the contents of the UIScrollView to see the other text fields once the ...
416
votes
13answers
109k views

@class vs. #import

It is to my understanding that one should use a forward-class declaration in the event ClassA needs to include a ClassB header, and ClassB needs to include a ClassA header to avoid any circular ...
323
votes
7answers
195k views

Generating Random Numbers in Objective-C

I'm a java head mainly, and I want a way to generate a pseudo-random number between 0 and 74. In java I would use the method: Random.nextInt(74) I'm not interested in a discussion about seeds or ...
80
votes
6answers
31k views

What's the Best Way to Shuffle an NSMutableArray?

If you have an NSMutableArray, how do you shuffle the elements randomly? (I have my own answer for this, which is posted below, but I'm new to Cocoa and I'm interested to know if there is a better ...
156
votes
15answers
106k views

What is the difference between class and instance methods?

What's the difference between a class method and an instance method? Are instance methods the accessors (getters and setters) while class methods are pretty much everything else?

1 2 3 4 5 1060
15 30 50 per page