objective-c

Is it possible to save the state of a timer in the User Defaults?

I have a label on which I am showing countdown timer. Now if I close my app the timer will be off and the label's text also. I know that we can save the label's text value. But how do we show the correct countdown when the app starts again. Suppose I close at 00:05:35 after 3 minutes when app is launched again the label should show 00...

Using the showUserLocation property of MKMapView

I have an app at the moment which shows various pins on a map. I've tried setting mapView.showsUserLocation = YES; to show the user's current pos, however this crashed my app ("Program received signal: SIGABRT") with the following error message: Mon Oct 19 12:31:27 unknown Hull Ads[3111] <Error>: *** -[MKUserLocation counter]: unrecogni...

Why subclass NSObject?

What is the purpose/use of NSObject in Objective-C? I see classes that extend NSObject like this: @interface Fraction : NSObject In C++ or Java, we don't use any variables like NSObject even though we have preprocessor directives and import statements in both Objective-C and Java. Why do classes explicitly inherit from NSObject in O...

NSXMLParser avoids UILabel to show/hide

Hi, I have the following methods in my class: -(IBAction)loginToAccount:(id)sender { // Display the network activity status indicator [UIApplication sharedApplication].networkActivityIndicatorVisible = YES; // Show the load indicator [self.loadIndicator startAnimating]; self.loadIndicator.hidden = NO; self.loadLabel.hidden = NO;...

Drag and drop .app files into NSImageView and get the file path.

Hi, I have an NSWindow containing and NSImageView. I want that the user can drag 'n drop a .app file (application) into the NSImageView, and my application see which file is dropped. Is there a way to do this (okay, I'm sure there is a way to do this -_- but which one :p )? So much like iWeb does it with image files. A tutorial would ...

Converting audio and video to NSData

I would like to confirm what the recommended ways are to convert audio and video files into NSData objects. Is + dataWithContentsOfFile: the best way to do this? Thank you ...

Sending a Selector to another Class. And Creating an Instance of A Class.

How would I send a Selector to another class? I know to send it to a selector in the same file you do [self performSelector:@selector(doSomething)]; and for sending it to another class I've tried [otherClass performSelector:@selector(doSomethingElse)]; But I just get an error in the Debugger saying +[otherClass doSomethingElse]:...

Advantage of data type id vs NSString in Objective C?

This code... NSString * s = [[NSString alloc] initWithString:@"Hello, World"]; s = s.lowercaseString; NSLog(@"%@", s); ...allows the use of dot notation but is strongly typed. This code... id s = [[NSString alloc] initWithString:@"Hello, World"]; s = [s lowercaseString]; NSLog(@"%@", s); ... is weakly typed and requires use of sq...

Consolidate annotations on a zoomed MKMapView

There are a number of bad ways to go about what I want to do, but this seems like one of those cases of "there must be a better way". I am using an MKMapView in an iPhone app that displays a number of annotations. Pretend for conceptual discussion that each town in a US state has an annotation, so there's a fairly dense pile of annotati...

How do I insert a welcome screen to my Navigation-Based Iphone App?

I am new to Iphone App develoment and I was wondering how to insert a welcome screen when my app first start up. The app is primarily navigation based. There are tables that users can drill down and see a characteristic of the item that they selected. I want there to be a welcome screen that gives two options. But I don't want this t...

Difference Between Object And NSObject

Hello, I'm learning Objective-C and as I can see, in some tutorials they use Object(imported from objc/Object.h) and in others i see the use of NSObject(imported from Foundation/NSObject.h), but what are the main differences between they? Regards. ...

UITableViewController problems

I have a nib that contains two TableViews. The table views are of the same class that I have created that is a subclass of a UITableViewController. I believe that everything is hooked up correctly. However, when I set the UITableView to the UITableViewController then run [uitableviewcontrollervariablename reloadData]; I first get a w...

Warp image animations on iPhone

Hi, just working up to building another app and we'd like to include the ability to animate regions of the screen in response to device shakes/touches etc. For example you could tap the screen and the device would animate a 'poke' into the image at that point (think this would be a lens type effect, like a weight on a trampoline) or you ...

A good way to create a shortcut selection field for use in a Mac app?

I need to have a way for the user to input a shortcut key combination in my Preferences and I'm looking to do something that works similar to how the System Preferences keyboard shortcut panel works. I thought about subclassing an NSTextField and override keyDown: and keyUp: but it seems these overrides do nothing... any hints? Altern...

Facebook connect and the "session" object

I'm trying to create an iPhone app that connects to FB using their API. The documentation says to do as such to session = [[FBSession sessionForApplication:@"key" secret:@"secret" delegate:self]retain]; ... but what is this "session" object. How do I define it? If I just use this code I get errors saying that "session" is undefined. ...

Objective-C and C interoperability

We're going to have to write a C library and this library has to be accessible from Objective-C. Now I don't know anything about Objective-C so I wonder how simple Objective-C <-> C interoperability is. Is that as simple as including the C header in the Objective-C code and linking to the library? Is there anything special I'm supposed t...

Character Input In Objective-C

Hello, I'm learning Objective-C using GNUstep, but i searched at Google for some example of character input using Objective-C, like scanf in C and cin at C++, but i didn't found, someone can help me? Thanks. ...

Cocoa API Image Manipulation

Is there any way to do simple image manipulation like adjusting brightness, contrast, exposure, etc. using Cocoa? Something like NSImage? ...

UIDatePicker and UITextView

Hi Sorry if i did wrong english typing I want to show a text in UITextView depend on the date, some thing like "in This Day App", I have this code in action -(void)changingText:(id)sender{ NSDateFormatter *df = [[NSDateFormatter alloc] init]; df.dateStyle = NSDateFormatterMediumStyle; label.text = [NSString stringWithFormat:@"%...

Gradient Scale - Cocoa

Hi all, How would I write a code that would set the gradient level to 50%? It's pretty straight forward, but I'm not using an NSSlider so it just needs to be dropped down to 50% or anywhere around there. Thanks Kevin ...