objective-c

Error With Foundation.h

Hello, I learning Objective-C in Linux(Ubuntu), but when i tryed to compile my application that needs the Foundation headers i got an error saying that the file cannot be found, but i have installed the GNUstep development package(gnustep-devel). Here is my code: // Fraction.h #import <Foundation/NSObject.h> @interface Fraction: NSObj...

Mapping integers to booleans in Objective-C

In Objective-C I need to associate a mutable collection integers (monotonic, non-contiguous, could get fairly large) to boolean values. The obvious way is just to have an NSDictionary w/ NSNumbers as keys and values. Is there a better way that doesn't involve so much object creation? I'm really not trying to pre-optimize so much as lea...

Is MonoTouch worth the cost or should I just learn Objective-C?

After sitting through a session today on Mono at a local .Net event, the use of MonoTouch was 'touched' upon as an alternative for iPhone development. Being very comfortable in C# and .Net, it seems like an appealing option, despite some of the quirkiness of the Mono stack. However, since MonoTouch costs $400, I'm somewhat torn on if t...

I dont get my tableView to navigate even though i feel the code is right

My table view cells have the ContentView as the Labels. When i click on them to navigate to another view whose viewController is as shown does not navigate. - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { DetailedWebViewController *detailedWebViewTab1=[[DetailedWebViewController alloc] ...

NSLog and printing of an object

I have a class and I want to setup what is printed when I call NSLog with that class. For example, NSLog(@"%@",nonstandardObject); How do I setup the object so it prints out what I'd want? ...

App modal NSPanel / sheet / dialog + NSThread == window hangs ??

I'm in the midst of debugging an extremely unusual problem, and I was wondering if anybody might have any insight into what might be going wrong: In a controller class from a NIB, I take an NSPanel from that same NIB, and then show it app modally on an NSWindow (that was created by hand in code): [[NSApplication sharedApplication] begi...

How to use performSelector:withObject:afterDelay: on a method with multiple arguments

Let's say I have a method with this signature: -(void)plotPoly:(Polygon *)poly WithColor:(UIColor *)color AndFill:(BOOL)filled; How do I get that UIColor and BOOL in there as well as the Polygon? Should I wrap them in a NSArray and pull them out inside the called method? That would mean I have to change the method sig, right? Is th...

Should I initialize ALL primitive data types to 'safe' values in Obj-C?

Is there any primitive data type that it's safe to not initialize? How about structs like CGPoints or NSRects? ...

Cocoa and Cocoa Touch: is an object on the dictionary?

I thought it would be simpler to find if an object in on a dictionary, but it appears it is not. I have a NSMutableDictionary with just one key named "products". I have several products added to the dictionary dynamically, using something like [myDict addObject:@"banana" forKey:@"products"]; [myDict addObject:@"orange" forKey:@"produc...

Problem in Reloading UITableview..!

hi, i am parsing two xml files with one xml parser class , i have a table view where the data is displaying after parsing .. here is a imageview and label , when i parse the first xml like if i parse myxml_1.xml and then display data in a table view its fine . but when i parse again the xml named myxml_2.xml and display the data in that...

What's the difference?

I'll preface my question by saying that I'm a beginner objective-c developer. What is the difference between: NSString * foo; NSString* foo; NSString *foo; Is there a difference? ...

View Controller being sent a message even though it has been deallocated.

I am not sure if something has changed in the iPhone SDK 3.0 but I am getting the strangest error. I have a view controller hierarchy where I switch between view controllers depending upon interface orientation. From what I can tell, the error is caused whenever I rotate the interface a view controller which has been deallocated is being...

Converting a date (string) into another date format (string)

I have a novice question, will be happy if any one out there can help me. I have an NSMutableArray, for example: { JobID = 109302930; Subject = "Test Subject"; SubmitDate = "2009-09-15 17:27:34"; } I am now trying to create sections in my table view and want to group my records based on "formatted" SubmitDate. For example; 16th May'...

How do I append a new item to a plist?

In my iPhone app, I have two plist files to store "Themes". One is a read-only file containing default themes, and one contains custom Themes that the user has created. I'm using plist files because it's very easy for me to read from the plist and create new Theme objects. My plist is an array of dictionary objects. Is there any easy w...

Bug in iPhone Library Access?

Hi, This code: MPMediaQuery *query = [MPMediaQuery artistsQuery]; NSArray *songsByArtist = [query collections]; for( MPMediaItemCollection *c in songsByArtist ) { NSLog(@"artist %@ has %u songs",[[c representativeItem] valueForProperty:MPMediaItemPropertyArtist], [[c items]count]); } works as expected. But this code: MPMediaQuery ...

My table view does not navigate to another uiview page. Could any one tell me what might be wrong?

My table view cells have the ContentView as the Labels. When i click on them to navigate to another view whose viewController is as shown does not navigate. (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { DetailedWebViewController *detailedWebViewTab1=[[DetailedWebViewController alloc] initW...

How does UIView nextReponder know what the UIViewController is?

Just as a matter of curiosity, how does the nextResponder method implementation of the UIView class know who is the UIViewController that manages the view? The UIResponder documentation states this, and I can see it work, but I don't quite understand it. To the best of my knowledge, a UIView does not maintain a reference to it's controll...

Draw a random line.Set CGPoint nil ? - Objective C

Hi, I use ccTouchesBegan and ccTouchesEnded to draw a line. I want to draw a line when i drag the cursor(or finger) on screen. That mean, when i release the cursor, it will draw a line with the first point is the position which i has a first touch (ccTouchesBegan) and last point which i have when release (ccTouchesEnded). Here is my code...

objective c learning Web sites

im beginning in Objective-C development and as i can see in the development blogs(about Objective-C) like w3schools.com we dont have such type of sutes to learn Objective-c language , can any one known the such type of Sites to Learn objective-c language .. please let me know-- ...

Detecting UITableView scrolling

Hi I've subclassed UITableView (as KRTableView) and implemented the four touch-based methods (touchesBegan, touchesEnded, touchesMoved, and touchesCancelled) so that I can detect when a touch-based event is being handled on a UITableView. Essentially what I need to detect is when the UITableView is scrolling up or down. However, subcl...