objective-c

How to check what day of the week it is (i.e. Tues, Fri?) and compare two NSDates?

I'm looking two do two things: Check if a week has gone by (based on the day of the week) Check if a day has gone by (based on the date) I'm not sure what the best way to solve this is, since when comparing two NSDates (one at 1/1/09 at 21:30 and another at 1/2/09 at 00:30) I can't just see if 24 hours has gone by since in this case ...

Objective-C Bloggers

I've been primarily developing in c# for the last few years and have found that staying up-to-date with some of the best c# blogs (Ayende, Jeremy Miller, Greg Young, Phil Haack, et al) has been invaluable. So, I'm just getting into objective-c and iPhone development and am wondering who are the top bloggers I should be keeping up with ar...

Dynamically Add values to UIPickerView at run time

How can you dynamically add values to UIPickerView at runtime. I'm using the following code to populate a UIPickerView statically. Need to add values dynamically at run time, for e.g. Three, Four etc. - (NSString *) pickerView:(UIPickerView *)pickerView titleForRow:(NSInteger)row forComponent:(NSInteger)component{ NSString *title ...

How can I reverse a NSArray in Objective-C?

I need to reverse my NSArray. As an example: [1,2,3,4,5] must become [5,4,3,2,1] What is the best way to achieve this? ...

Objective-C: finding who has a retain count to an object

I have a UIViewController which has a retainCount of 3 the moment I instantiate it. That stirs me as terribly incorrect. What's the best way of figuring out who bumped up the retainCount to 3? I'd imagine instantiating the object should give the pointer 1, then I suppose maybe pushing it onto the UINavigationController's stack might bump...

iPhone question regarding memory management

Here's a hypothetical getter: - (DetailViewController *)detailController { if (detailController == nil) { DetailViewController *controller = [[DetailViewController alloc] initWithNibName:@"Detail" bundle:nil]; self.detailController = controller; [controller release]; } return detailController; } Then the ...

iPhone SDK: UIWebView to stop images from loading/downloading

How can I use the UIWebView in Xcode so that when it loads up pages it DOESN'T download the images (to cause a faster loading page)? ...

Do I release this instance variable on the iPhone?

I have a class which is responsible and the owner of building my model objects. It allocates memory for the models and has them retained and is responsible for releasing them when dealloc happens. Now I have a respective UIViewController which is acting as the client in this case. It will have several instance variables, pointing to the...

NSString @property, using copy instead of retain

I'm looking over Apple's sample application EditableDetailView, and noticed that in one of their controllers, they're setting an instance of NSString property with (nonatomic, copy). When would one use copy instead of retain? Is this so they can make a unique copy without affecting the existing data? ...

Unable to find standard libraries when compiling Objective-C using GNUstep on Windows

I just installed GNUstep on my Windows XP machine and I'm attempting to compile the following Objective-C Hello World program from the command line: #import <Foundation/Foundation.h> int main(int argc, const char *argv[]) { NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; NSLog(@"Hello world\n"); [pool drain];...

Possible for Instruments to show Leaks on autoreleased objects?

I'm having a difficult time understanding where actual Leaks are happening and where they are not in my application using Instruments. I have objects which are autoreleased and not being retained afterwards.. that are showing up as leaks via Instruments. There's also a bunch of objects which are listed as leaking that don't point back to...

NSMutableString and nil for memory management

If I have an NSMutableString such as NSMutableString *foo = [[NSMutableString alloc] init]; if I nil out the object, foo = nil, does that lower the retain count by 1, thus effectively releasing the memory? Would I need to reallocate foo from the heap at this point to be able to use it? ...

EXC_BAD_ACCESS error

I made an application that should run constant until I stop it. What it basically does is getting some data from connected another device and send that data to the server periodically using NSURLConnection, and read data from the server periodically and visualize that data as a graph using NSXMLParser. I ran the instrument to check allo...

Objective-C properties: atomic vs nonatomic

What do atomic and nonatomic mean in property declarations? @property(nonatomic, retain) UITextField *userName; @property(atomic, retain) UITextField *userName; @property(retain) UITextField *userName; What is the functional difference between these 3? ...

how to increase font size in UIWebView

hi any one say , how to increase or decrease the UIWebview font size, not using scalePageToFit:NO; ...

How to alloc a dynamic typed object in objective-c

Hi, I have seen a lot of talk about dynamic typing in objective-c. But i haven't seen any examples of what i think it is supposed to be. lets say I have a generic function that is supposed to juggle two objects (one gets allocated and the other gets freed) and the calling object attaches it self to the newly alloced object. Both are in...

casting a NSString to char problem

i want to casting my NSString to a constant char the code is shown below : NSString *date = @"12/9/2009"; char datechar = [date UTF8String] NSLog(@"%@",datechar); however it return the warning assignment makes integer from pointer without a cast and cannot print the char properly,can somebody tell me what is the problem ...

Best way to store a large array of boolean variables?

i am working on a code which requires me to store 60*4 boolean values, the titles for these values are being stored in a plist. i require to manipulate the boolean values runtime and couldnt find a way to update the plist file easily..also using sqlite database for storing the boolean values becomes hectic for such large amount of data.....

how is it possible to come back to the same page?

Hi friends, I am new at Objective C. I am just trying to build an iphone app. I have created some NIB file, and i have gone to other NIB file by creating an object and using this code: scoreViewController *sviewController = [[scoreViewController alloc] initWithNibName:@"scoreViewController" bundle:nil]; self.scoreView = sviewControl...

Question regarding a memory leak (screen shot from Instruments included)

Hi all, I'm trying to weed my application out of memory leaks. The problem I'm facing is that Instruments is reporting leaks for objects which I have not explicitly allocated myself. Now, I do understand that these objects might be instantiated as a result of some other code I've written, but I cannot find my client-code anywhere in the...