Skip to main content

All Questions

Tagged with
346 votes
33 answers
124k views

What are best practices that you use when writing Objective-C and Cocoa? [closed]

I know about the HIG (which is quite handy!), but what programming practices do you use when writing Objective-C, and more specifically when using Cocoa (or CocoaTouch).
174 votes
7 answers
111k views

What's the difference between "bundle display name" and "bundle name" in cocoa application's info plist

Here is a good question: Bundle Name, Executable Name, Product Name...anything else? but I just wonder about the difference between "bundle display name" and "bundle name" in cocoa application's ...
xhan's user avatar
  • 6,277
151 votes
9 answers
74k views

What does the property "Nonatomic" mean?

What does "nonatomic" mean in this code? @property(nonatomic, retain) UITextField *theUsersName; What is the difference between atomic and nonatomic? Thanks
user avatar
140 votes
10 answers
109k views

Getting a list of files in a directory with a glob

For some crazy reason I can't find a way to get a list of files with a glob for a given directory. I'm currently stuck with something along the lines of: NSString *bundleRoot = [[NSBundle mainBundle]...
136 votes
14 answers
74k views

Changing my CALayer's anchorPoint moves the view

I want to alter the anchorPoint, but keep the view in the same place. I've tried NSLog-ing self.layer.position and self.center and they both stay the same regardless of changes to the anchorPoint. Yet ...
Kenny Winker's user avatar
  • 12.1k
135 votes
8 answers
70k views

Getting thread id of current method call

Is there a way to print out the current thread id on which the current method is executing on? (objective-c please)
Alexi Groove's user avatar
  • 6,686
127 votes
13 answers
50k views

Check whether or not the current thread is the main thread

Is there any way to check whether or not the current thread is the main thread in Objective-C? I want to do something like this. - (void)someMethod { if (IS_THIS_MAIN_THREAD?) { NSLog(@...
fish potato's user avatar
  • 5,619
124 votes
15 answers
37k views

Understanding reference counting with Cocoa and Objective-C

I'm just beginning to have a look at Objective-C and Cocoa with a view to playing with the iPhone SDK. I'm reasonably comfortable with C's malloc and free concept, but Cocoa's references counting ...
Matt Sheppard's user avatar
111 votes
9 answers
22k views

Best way to implement Enums with Core Data

What is the best way to bind Core Data entities to enum values so that I am able to assign a type property to the entity? In other words, I have an entity called Item with an itemType property that I ...
Michael Gaylord's user avatar
103 votes
13 answers
95k views

HTML character decoding in Objective-C / Cocoa Touch

First of all, I found this: Objective C HTML escape/unescape, but it doesn't work for me. My encoded characters (come from a RSS feed, btw) look like this: & I searched all over the net and ...
treznik's user avatar
  • 8,114
102 votes
5 answers
39k views

Is there any way to hide "-" (Delete) button while editing UITableView

On my iphone app, I have a UITableView in edit mode, where user is allowed only to reorder the rows no delete permission is given. So is there any way where I can hide "-" red button from TableView. ...
iPhoneDev's user avatar
  • 3,015
102 votes
10 answers
46k views

Interaction beyond bounds of UIView

Is it possible for a UIButton (or any other control for that matter) to receive touch events when the UIButton's frame lies outside of it's parent's frame? Cause when I try this, my UIButton doesn't ...
ThomasM's user avatar
  • 2,667
99 votes
5 answers
45k views

NSString: isEqual vs. isEqualToString

What is the difference between isEqual: and isEqualToString:? Why are classes adding isEqualTo* methods (isEqualToArray for NSArray, isEqualToData for NSData, ...) instead of just overriding isEqual: ...
Jaka Jančar's user avatar
  • 11.6k
93 votes
7 answers
44k views

NSLog with CGPoint data

I have a CGPoint called point that is being assigned a touch: UITouch *touch = [touches anyObject]; CGPoint point = [touch locationInView:self]; I want to get the x coordinate value into my console ...
Spanky's user avatar
  • 5,000
90 votes
12 answers
29k views

What's the best way to put a c-struct in an NSArray?

What's the usual way to store c-structures in an NSArray? Advantages, disadvantages, memory handling? Notably, what's the difference between valueWithBytes and valueWithPointer -- raised by justin ...

15 30 50 per page
1
2 3 4 5
175