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 ...
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...
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 ...
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?
...
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...
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 ...
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)?
...
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...
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?
...
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];...
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...
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?
...
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...
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?
...
hi any one say , how to increase or decrease the UIWebview font size, not using scalePageToFit:NO;
...
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...
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
...
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.....
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...
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...