objective-c

iPhone NSDate eg. next Friday

Hello I want to create a function which results the date of next Friday but i've no plan how to do it. Has anyone a good hint to me ? Greets Simon ...

Approaches to create a nested tree structure of NSDictionaries?

I'm parsing some input which produces a tree structure containing NSDictionary instances on the branches and NSString instance at the nodes. After parsing, the whole structure should be immutable. I feel like I'm jumping through hoops to create the structure and then make sure it's immutable when it's returned from my method. We can p...

Casting to derived type problem in C++

Hey there everyone, I am quite new to C++, but have worked with C# for years, however it is not helping me here! :) My problem: I have an Actor class which Ball and Peg both derive from on an objective-c iphone game I am working on. As I am testing for collision, I wish to set an instance of Ball and Peg appropriately depending on th...

how to search in contact list like messages application in iphone with adding selected item in front of ' To:' ?

I needs to make application like messages application in iphone. Just needs To:(search text) and below it there is contact list. If user type in search text then list automatically filtered & when user select particular row then it is visible in front of To: & then again user is able to search text like in messages application. You can...

Architecting iPhone Views - seeking help on a specific issue + general advice

Hi there, I am primarily a web developer (ruby, python) that is new to iPhone development. I've done some desktop development in the past within the MS environment (C#), but never anything on the mac. I'm trying to build a really simple iPhone application and I am confused by the way that views work in general. If someone can provide a...

Sqlite3 update statement problem

how to create SQl statement for update using 'where' condition with 'name', how to bind this name to sql statement... ///example const char *sql = "update profile set name = ? ,Lname = ?, date = ?,phno = ? ,image = ? , id= ? where **name=?**;"; ...

How to get macosx Log-in User Name in objective-c

please let me know how to get the currently logged in user's name or mac machine name (if possivle) in objective-c. Thanks ...

Memory leak for NSDictionary loaded by plist file

I have a memory leak problem that just can not understand! Watch this initialization method: - (id)initWithNomeCompositore:(NSString *)nomeCompositore nomeOpera:(NSString *)nomeOpera { if (self = [super init]) { NSString *pathOpere = [[NSBundle mainBundle] pathForResource:kNomeFilePlistOpere ofType:kTipoFilePlist]; NSDictionar...

How do I read a text file in Objective-c?

Can someone provide a simplest-case example of reading a text file? ...

Are UIView's in TableViewCells cause for performance problems?

Hi, I have a UITableView of UITableViewCells that so far performed well. I now aded a simple UIView to my UITableViewCell as a color indicator (backgroundColor only, no other content or attributes). Running the tableview again I realise scrolling is not as smooth as it used to be. The tableView suddenly also takes long time (~1+ secs) t...

Objective-C memory leak in loading remote content

I try to load a plist file from my server. I can think of 2 ways to do that, but for both Instruments says there's huge memory leak : NSData* plistData = [NSData dataWithContentsOfURL:url]; and NSDictionary* updateDigest = [NSDictionary dictionaryWithContentsOfURL: [NSURL URLWithString:updateURL] ]; The backtrace of the memory lea...

Change window title to the one in text box in Objective-C?

I'm just getting started with Objective-C and I'm writing a simple application. I made two outlets : wnd - main window display - the text box Then I've tried using this code: [wnd setTitle:[display value]]; Unfortuanately it didn't work ... The debugger said : 2010-05-22 XX:XX:08.577 HelloWorld[2536:a0f] -[NSTextField va...

UISwitch text not showing on device

Hi, I have a screen with several UISwitch controls. On my iPhone simulator this screen works correctly and The Switch text shows as On/Off. Different on my testing device (iPod Touch). Here the text seems to get lost and I only get "1" (instead of "On") and "0" (instead of "Off"). I don't know where the iPod Touch is different and w...

static NSStrings in Objective-C

I frequently see a code snippet like this in class instance methods: static NSString *myString = @"This is a string."; I can't seem to figure out why this works. Is this simply the objc equivalent of a #define that's limited to the method's scope? I (think) I understand the static nature of the variable, but more specifically about ...

How to ask for permissions?

How do I create a dialog like the following one in Objective-C? I'm quite new to Objective-C, and I need root access to a file in the /etc directory. Thanks!! Yvan ...

Scaling MKMapView Annotations relative to the zoom level

The Problem I'm trying to create a visual radius circle around a annonation, that remains at a fixed size in real terms. Eg. So If i set the radius to 100m, as you zoom out of the Map view the radius circle gets progressively smaller. I've been able to achieve the scaling, however the radius rect/circle seems to "Jitter" away from the P...

Why this kind of release doesn't work?

Hello, I have a newbie question about the following: - (NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section { NSArray *anArray; anArray = [dictionary objectForKey: [NSString stringWithFormat:@"%d", section]]; //here dictionary is of type NSDictionary, initialized in another place. An...

Sending a message from Objective-C and getting the return value?

I have this code NSString *tr = [self sendUrl:@"http://google.com/"]; But for some reason 'tr' will remain nil after it is executed. What am I doing wrong? sendUrl : - (NSString *)sendUrl:(NSString *) uri { NSLog(@"Requesting URI 1 ..."); // Prepare URL request to download statuses from Twitter NSURLRequest *request = [NSURLRe...

How does Mach-O loader loads different NSString objects?

I have known that If you define a bunch of @"" NSString objects in the source code in Mac OS. These NSStrings will be stored in a segment in the Mach-O library. Section sectname __ustring segname __TEXT addr 0x000b3b54 size 0x000001b7 offset 731988 align 2^1 (2) reloff 0 nreloc 0 flags 0x00000000 reserved1 0 reserve...

Offline copy of Mac OS X Reference Library?

Is there an offline copy of Mac OS X Reference Library for download? My connection is not always available so it would be useful to have a local copy. ...