objective-c

Why or why not call an object with a "self." prefix?

@interface{ NSArray *array; } @property (nonatomic, retain) NSArray *array; @end @implementation @synthesize array; self.array = [[NSArray alloc] init]; array = [[NSArray alloc] init]; [self.array objectAtIndex:2]; [array objectAtIndex:2]; @end Is there a difference between them? Why should I use one over the other? ...

How to speed up TDD flow with iOS and Objective-C/Xcode

Have been searching for experiences on TDD with Objective-C and iOS development. Previous post about "string calculator"-kata in Objective-C was useful (thanks). But it would be nice to learn even more fluent iPhone-TDD. Do you have some experience of how to use UISpec (based on Rspec), iCuke (based on cucumber) or similar tools? An...

Combine string in objectivec

How do I concenate 2 strings in objective-c, like in VB.net you can just do "foo" & "bar" ...

Which programming tools techniques have empowered you most?

I'm curious which programming tools have empowered you as the programmer the most. By empower I essentially mean tools have made complex tasks simpler (both conceptually and implementation wise). I am talking about Objective C and Cocoa primarily, although I suppose this question is rather language independent. For instance, before I di...

Center text in a UILabel

How do you center the text inside a UILabel? ...

Mac server in order to compile obj-c projects?

Is it possible to write an obj-C code with any text editor and then upload it to Mac server to compile it using Xcode?? I know that it is possible to compile your project using Xcode without open it something like use some command lines, but I am not sure is it possible to make it a server and then upload any obj-c code! ...

How do I implement a bit array in C / Objective C

iOS / Objective-C: I have a large array of boolean values. This is an inefficient way to store these values – at least eight bits are used for each element when only one is needed. How can I optimise? ...

incompatible Objective-c types warning

Hi all, I have a user class that I use throught the iphone application,this is the init and initWithUser fuctions from my user class (A SUBCLASS OF NSobject),. when I use the initWithUser function I get the warning described after the code. please advise. // serialize.h #import <Foundation/Foundation.h> @protocol Serialize // seri...

Can this code be used with an array of custom objects?

[[NSUserDefaults standardUserDefaults] setObject:myArray forKey:@"myArray"]; If I make an array of custom objects conform to the NSCoding protocol, then does the above work? Do I have to make both the custom class and the view controller that holds the array of custom objects conform to the NSCoding protocol or just the custom class? D...

Can I monitor other windows' event like resizing, hiding etc from NSNotificationCenter?

Hi guys, I'd like to monitor all windows (include other applications' windows) changes like resizing, hiding, un-hiding etc. I found that if I use [NotificationCenter defaultCenter] , I just receive the event from my own application's window. But how about NSWorkspace's notification center? ...

iPhone - Problem with Distribution Certificate

I'm trying to publish my app to the app store. I followed the Apple instructions to create the Distribution Certificates and Provisioning profiles and added them to my XCode Organizer. When I select Project > Edit Project Settings and check the 'Code Signing Identity - Any iOS Device, my DistributionCertificate/Profile appears correctl...

iphone Application Loader problem

I successfully followed and completed all the steps in the apple provisioning portal for creating the distribution certificates/profiles needed. Got everything loaded upto xCode and my project compiles correctly. However, when I insert my last app.zip file into the Application Loader, I get this single error: Bundle identifer: com.you...

How do I load this array into memory

I saved an array using the following code: NSData *data = [NSKeyedArchiver archivedDataWithRootObject:myArray]; [[NSUserDefaults standardUserDefaults] setObject:data forKey:@"myArray"]; What is the code to load it back into memory? ...

How do I center a specific ImageView-coordinate in a UIScrollView

How do I best position an image (UIImageView) within a UIScrollView programmatically? I have the x and y coordinates (CGPoint C = centerCoordinate) of the image position that needs to be centered horizontally and vertically in the UIScrollView. ===Image============================================= | ...

Manually Paging in uiscrollview

hello all, I have a scrollview with lets say ten subviews in it. All are shown at the same time. I want to page between each subview. One idea is to set the frame size equal to a single subview and turn the paging on. But then it will receive the touch only within that frame. I want the user should be able to scroll it from any where i...

NSArchiver vs. NSKeyedArchiver

How do you know if you need to use NSArchiver or NSKeyedArchiver? What's the difference? ...

Do I need to use NSKeyedArchiver?

I have an object. It has only two NSStrings as properties. I created an array to hold several of these objects. Do I need to use NSKeyedArchiver to save this array to disk, or can I just use NSUserDefaults? ...

Objectiv C iPhone. Getting NSMutableArray in Table

Hi! I try to get the data of an array in an TableView but get an bad access error all the time. My code looks like this: NewsViewController.h #import "StatusMessage.h" @interface NewsViewController : UIViewController { IBOutlet UITableView *table; NSMutableArray *statusMessages; } @property(nonatomic, retain) NSMutableArray...

Wrapping my head around NSTreeController/NSOutlineView

Hey guys, In my application, like many Mac applications, I have a source list. At the moment this is an NSOutlineView bound to an NSTreeController. I can add items to it pretty easily, and have even been able to duplicate the "source list" appearance, with grey all-caps headers and all. There's something that evades me, though, and it's...

Array writeToFile

Let's say I create an object like this: Person: NSString *name; NSString *phone; NSString *address I create several of these objects. Then I create an NSMutableArray called people and store them in there. Can I save this array to disk with Array writeToFile? Does it need to be converted to NSData? ...