objective-c

How many pictures does iPhone 3G(not 3GS) take in one second?

There is an iPhone App: iVideoCamera (http://labs.laan.com/blog/2010/01/the-ivideocamera-update-approved/), I am wondering what is the way it uses to reach the function that performing video recording on iPhone 3G? Write an iPhone program to take several pictures in one seconds? But I think it is not possible to take more than 15 pictu...

iphone app NSNumber memory leak

Hi, I'm having a memory leak and I have no clue where it comes from and how to fix it. At some point i calculate the distance between 2 locations. double calc = [self getDistance:location to:otherLocation]; NSNumber *distance = [NSNumber numberWithDouble:calc]; in instruments i get as leaked object NSCFNumber and it identifies NSN...

Objective-C Condtions operators weirdness

Okay here's the damned thing: - (void)setMinimumNumberOfSides:(NSNumber *)newMinimumNumberOfSides { if (newMinimumNumberOfSides != minimumNumberOfSides) { NSNumber *minimum = [[NSNumber alloc] initWithInt:(int)2]; if (newMinimumNumberOfSides > minimum) { [newMinimumNumberOfSides retain]; [mi...

Use Three20 URL-based Navigation with PureMVC?

Hi there, is anybody already using Three20 URL-based Navigation with PureMVC? I am not sure where to implement the URL mapping. In the AppDelegate, Faceade, RootViewController? Thanks for helping. ...

Property Grid for Cocoa

I didn't find anything similar to .NET PropertyGrid class in Cocoa, so I started to write my own version. I use information from runtime to get properties of object: Class reflectedClass = [reflectedObject class]; uint propertyCount = 0U; objc_property_t *properties = class_copyPropertyList(reflectedClass, ...

iphone/objective-c: using singleton class as a container for globals

So I'm finding that I'm using a singleton User class to access global variables throughout an iphone app. In some cases I use the instance in almost all the methods within a class. So in the first few lines of each method I have statement such as: User *user = [User sharedManager]; This is obviously not a very DRY implementation. My...

Attaching Files to PDFs?

PDF files can contain attachments (see here). This is useful when you need machine-readable data (e.g., XML) to be associated with a human-readable PDF. Does Cocoa's PDFKit support adding file attachments to an existing PDF? I'm looking through the documentation and I don't see anything. ...

centralizing my objective C app's networking code

I am trying to centralize my app's networking code. Basically, in any of the various places that need information from a server, I create an object serverRequest of my class ServerRequest to get the information. When ServerRequest is done, it needs to send the information back to the calling object. Of course it should work asynchrono...

How to tell if an object has already been allocated, so it isn't allocated multiple times?

Please be nice.. I am a noob with this stuff. I want to allocate and use an object through a method that I call many times, and instead of making it a global variable and allocating it in my initWithFrame method I want to alloc it in just the one method, and make it a local variable that I allocate then and use then. ...

How do I reduce Image quality/size in iPhone objective-c?

I have an app that lets the user take a picture with his/her iPhone and use it as a background image for the app. I use UIImagePickerController to let the user take a picture and set the background UIImageView image to the returned UIImage object. IBOutlet UIImageView *backgroundView; -(void)imagePickerController:(UIImagePickerContro...

Communicating between view Controllers

one of my view controllers has several UISwitches, and I want another view Controller to be able to access the values of the UISwitches for If/and statements. How do I do this in Objective-c? ...

Showing/hiding navigation bar with smooth animation

I have a navigation based app. The first view (rootcontroller) starts with three large buttons only. No navigationbar. From there, everything else is tableviews and have navigation bars. I'm doing this to show/hide the navigation bar: MyAppAppDelegate *appDelegate = [[UIApplication sharedApplication] delegate]; appDelegate.navigatio...

How to flip a UIButton horizontal with another UIButton on the backside?

Hello, I want a button that has a another button on the backside. When you press the button it should flip horizontal and show the other button. Apple did this in the ipod-App. When you hear a song you can press the button on the right site of the navigationbar and then the view flips and you can see all the songs from the album. But the...

Questions about validating user input in Objective-C, number vs string

Why 'exactly' does this code loop endlessly if you enter a non number character? The first question comes about because I want to learn good defensive coding. Does anyone know a good way to check user input? My google-fu failed me. Some people seemed to be of the opinion that if I specify %f in scanf that I am 'demanding' a float; I ver...

iPhone - How to play a sound on button touch?

I'm trying to make a button play a sound upon touching the button. I can get the sound to play with the Touch Up Inside option but that's not what I'm looking for because the sound only plays after the button is released. I've tried to use touchesBegan to play the sound upon touching the button but it doesn't seem to work. Any ideas wh...

What is the delegate method that is called when an MKPinAnnotationView is touched?

I have been searching for this all night and I have just so frustrated. When a MKPinAnnotationView is clicked, the name and the subtitle comes up. I also want to center that point on the view. I figured there was some method I had to override because the information that pops up happened without me having to code it. Hopefully this was c...

Listening for events from a tableviewcell

I have a custom uitableviewcell. It has a uitextfield. I'd like the parent tableview controller to take action when the uitextfield keyboard return key is pressed. How do I get the notification to the parent tableview without creating an app wide event notification? Or, is that the best way? ...

Can't initialize C-array in Objective-C

hello! my YYY.h file is #define W 1 // i am #define B 2 // opponent #define F 3 // board margin static int boardPos[12][12]; @interface YYY : NSObject {...} -(id)init; @end and YYY.m is #import "YYY.h" @implementation YYY -(id)init { if (self = [super init]) { // initializing Empty Board boardPos[1...

How to send email from iPhone app without user interface

I want my app to be able to send an email with attachment to a hard-coded recipient with no user input required, unlike the MessageUI framework. Is there any way to do this? Any example code would be appreciated. Thanks in advance. ...

Display picture in UIWebView store locally (Iphone)

Hi, In My Iphone app I display a local HTML file into a UIWebView. Inside the html code I try to display a local picture who is store in the repertory 'Ressource'. I want to know what is the path, I can't point to my picture. Thanks, ...