objective-c

How to set retain for properties nested to struct ?

Hi, There is really something in objc I cannot understand. I know how to make retainable properties but cannot understand how to make retainable "sub" struc fields which are not "public" properties but only "private" properties (the private properties are only managed by my methods). Here is my code: struct _device_descriptor { ...

iPhone - initialising variables using self

So, let's say you have a local variable NSArray *myArray declared in your class header file. You then write @property (nonatomic, retain) NSArray *myArray also in your header file. In your .m file, you write @synthesize myArray. All very standard so far. You now have a variable myArray, which can be accessed through setters and getter...

Removing time components from an NSDate object using Objective C/Cocoa

Hello geniuses, I'm trying to write a simple function using Objective C that accepts an NSDate object and returns an NSDate object that contains the same date value but has removed any time components from the date. For example if I were to pass an NSDate with a value of '2010-10-12 09:29:34' the function would return 2010-10-12 00:00:...

NSArray Memory-Management Issue

Hi folks, Here is my code that is being run in a background thread: -(void)updateFAQCache { NSAutoreleasePool *objPool = [[NSAutoreleasePool alloc] init]; // Grab the new plist NSMutableArray *arrLoadedData = [[NSMutableArray alloc] initWithContentsOfURL:[NSURL URLWithString:@"http://myurl.com/"]]; // If the data is ...

Built-in preprocessor token to detect iPhone app target

Hi, I need to set up correctly the FIRM ID for my app(according to target).For example I wrote in my Distribution.h the following lines: #define X_FIRM_ID @"X" #define XX_FIRM_ID @"XX" #define FIRM_ID XX_FIRM_ID For each build that I made I must manually change the FIRM_ID.I want to this automatically, just like I do for Default.png...

Save part of NSDictionary

hi all! i have a NSDictionary with NSString and NSArray i have to save in a variable only the NSArray without know the key. Is Possibile? Thx all And sorry for my bad english ...

Creating a game with multiple screens ?

Hi all, Just scouting for ideas here, but what would be a good way to implemenent mulitple screens in a game. I am thinking of a 2d game where when the player hits the edge of one screen it scroll to the next room. Thanks all, Martin ...

How to find application folder on iPhone

Hello, I'm going to make an app which influence another app. The only thing I don't know is ... How to find the folder of the other app (Like "0A007EC0-F477-4A61-8F67-C075024F8463"). Does someone know it ? Thanks, Vinzgore ...

Neon Intrinsics in iOS

I have recently started using Neon intrinsics in my iOS image convolution code and have a shaky grasp at best. Right now, I get to the pixel data from CGBitmapContextGetData (cgctx); but I would like to take advantage of de-interleaving using vld4 (ARGB data). What is the best way to do this? I'm sure it's one of those simple things I ...

2 UIScrollView detect current page and loading correct ppage

Hi, First part of the question: Detecting current images being displayed in scrollview A and B i want to place two UIScrollViews in my main view. Very simply done. So ive placed UIScrollView A above UIScrollView B. so it looks like this: Graphical representation ________ | A | ScrollViewA is above ScrollViewB |______| | B |...

Converting NSString to NSDate (and back again)

How would I convert an NSString like "01/02/10" (meaning 1st February 2010) into an NSDate? And how could I turn the NSDate back into a string? ...

Adding a navigationController to a xib file in interace File

Hi all, I have a existing xib file, it's a simple uiviewcontroller, but now I want a put a navigation controller in this xib file, because this view is modal, so the navigation controller in the mainWindow don't work. So, if I put a navigationController in my xib file, what is the view that I must link with the file owners..? ...

How to specify exactly the last time webViewDidFinishLoad for UIWebView get called?

I've read the previous post for this question, UIWebView - How to identify the “last” webViewDidFinishLoad message? but in fact I didn't get the answer very much. what I need is to execute a script on the webView but after it finishes its loading completely. I've tried to count the frames inside the HTML by reading it to a string and the...

Example for startMonitoringSignificantLocationChanges

I am new to iPhone programming. I am looking for an example or a demo on how to use startMonitoringSignificantLocationChanges method with the CoreLocation Manager. I am confused by the documentation because, I am not sure if the same delegate method is called as in the case of invoking startUpdatingLocation. (i.e. the delegate location...

Access files in "private Documents" folder transferred with iTunes

Hi, currently i'm trying to access the files that are transferred using the new ios feature introduced with 3.2. - (NSString *)getPrivateDocsDir { NSArray *paths = NSSearchPathForDirectoriesInDomains(NSLibraryDirectory, NSUserDomainMask, YES); NSString *documentsDirectory = [paths objectAtIndex:0]; documentsDirectory = [do...

Delegation and Modal View Controllers

According to the View Controller Programming Guide, delegation is the preferred method to dismiss a modal view. Following Apple's own Recipe example, i have implemented the following, but keep getting warnings that the addNameController:didAddName method is not found... NameDelegate.h @protocol NameDelegate - (void)addNameContr...

Creating a label using NSTextField is blurry

Hi, I'm trying to create a label programmatically using NSTextField, but it comes out blurry: screenshot This is my code so far: NSTextfield *textfield = [[NSTextField alloc] initWithFrame:NSMakeRect(5,5,150,20)]; [texField setStringValue:@"some text here"]; [textField setEditable:NO]; [textField setSelectable:NO]; [textField setBorde...

@property problem - Objective C

Hello, I'm having a problem with properties. First, I define it: @property (readwrite) BOOL isPerformingOperation; then synthesize it: @synthesize isPerformingOperation; Then I am setting the property as such: self.isPerformingOperation = YES; To make sure I've done things right, I log: NSLog(@"class perform is %i",self.isPerfo...

How much do experienced Cocoa programmers rely on Interface Builder for wiring up their apps?

In IB one can instantiate controllers, build up references to UI elements, and define action targets. It is also possible to do that programmatically. I wonder what (most) seasoned Cocoa developers prefer? In many other environments, I would not bother too long with interface builders (lower case), but the Apple tools are clearly a clas...

iphone: co-processor offset out of range

hi, i have a strange compiling problem with xcode and iphone. my game is almost finish but now i got suddently this compiling error: {standard input}:6108:co-processor offset out of range gcc-4.2 failed with exit code 1 this only happens if i compile the release version for the device. the debug version and both versions for the simu...