iphone

iPhone Camera API and Zoom

I am just curious as to how current ZOOM-Camera Apps on the AppStore are implemented (Are they using undocumented APIs?) ...

What are atomic store types?

Hi, I've read the Core Data references on Apple's site. But I wonder, what they mean with atomic store types? They write something of "they have to be read and written in their entirety". Could somebody clarify this, please? ...

MKMapView refresh after pin moves

A custom AnnotationView is updated with new coordinates. But the problem is that it visually updates only after some manipulations with MKMapView, e.g. zooming or moving. What should I do to manually update visual position on a map? PS. I've tried to change region to current map's region. But it does change zoom. It's strange. [mapView...

Count the number of times a method is called in Cocoa-Touch?

I have a small app that uses cocos2d to run through four "levels" of a game in which each level is exactly the same thing. After the fourth level is run, I want to display an end game scene. The only way I have been able to handle this is by making four methods, one for each level. Gross. I have run into this situation several times ...

Scrolling to range in UITextView

I have a UITextView with text in it, and I want to be able to scroll it such that a given NSRange of the text is at the top of the view. Using scrollRangeToVisible: does not work: it will scroll the range such that it is somewhere in the view, not necessarily where I want it to be. How can I scroll such that this specific NSRange of text...

Multithreaded iPhone app crashes with [NSAutoreleasePool release]

Hi, I have a memory management-related question in a multithreaded iPhone application. Let's say we have this method, that is called in a separate thread than the main-UI-thread: - (BOOL)fetchAtIndex:(NSUInteger)index { NSURL *theURL = [NSURL URLWithString:[queryURLs objectAtIndex:index]]; // Pay attention to this line: NSD...

iPhone SDK:Trouble Dragging a UIImageView

Hi, I am trying to drag a UIImageView around the iphone screen in my app. Currently The drag functionality I have set up is fine and dragging the image does move it around the screen, the trouble is that you don't have to drag the image view to move it, you can also drag anywhere on the screen and it will move the image. I am new to t...

Play a sound of indefinite duration on the iPhone

I need to play a "horn" sound when a user touches the screen. The horn sound needs to play for as long as the user's finger remains in contact with the screen. The ending of the sound effect will be different. Imagine the horn "petering" out at the end as airflow decreases. Would I have to stitch 2 sound files together? Do I need to...

UIAlertViewDelegate method didDismissWithButtonIndex gets called while the phone is sleeping/locked.

I have a UIAlertView who's didDismissWithButtonIndex delegate method calls pops the view controller (same class, it's the alertview delegate and the viewcontroller) to return the user to the previous screen. The issue is that when you lock the phone before the [alert show]; is called, something is calling didDismissWithButtonIndex while ...

What is the best way to architect a "find nearest" location-aware application on the iPhone?

I would like to build a location-aware application that automatically detects a user's location and presents them a sorted list of the nearest landmarks from a landmark database. The application will be built on the iPhone. The fundamental questions are: How to calculate the distances to nearby landmarks and sort by "closest" Where to...

Purpose of a static library

I want to create an application core that connects to a webservice, downloads the data, parses it and then returns it to a view controller. This core would ideally handle requests from multiple controllers and abstract away a lot of repetitive code. Also, I want to potentially use this core for a mac os x application. Would these tasks...

iPhone Sound: Adjust speed of playback of audio file while playing

Hi, is there a way to adjust the speed of the playback of an audio while playing in Objective C for the iPhone/iPod touch? Also would be interesting if playing a file backwards would be possible. Thanks Tom ...

CoreData Memory management Problem

I'm using Coredata and have a Data Model with the following toMany relationships: Rooms.isUsedBy -> Class many classes use a Room Class.hasStudents -> Students many Students are in a Class Given the Room I want to get all of the students that use the room. Here is the simplified code: -(void) studentsinRoom:(Room*)aRoom { ...

UIDatePicker in UIActionSheet layering problem

Someone posted this code in another question to put a UIDatePicker in a UIAlertSheet: UIActionSheet *menu = [[UIActionSheet alloc] initWithTitle:@"Date Picker" delegate:self cancelButtonTitle:@"Cancel" destruct...

Is there a method in Objective-C to recursively create directories from a string?

I am trying to write to the iPhone app's cache folder with images downloaded from a server. My plan is to save the images in "site.com/path/to/image.jpg", since mirroring the server folder structure like that makes duplicate names impossible, and it just seems the right way to do it. Unfortunately, it seems I have to create the folders m...

iphone-peakPowerForChannel function in AVAudioRecorder doesn't work

Hi I am trying to use an AVAudioRecorder instance to record sound, the whole recording progress runs well, except that when I call [recorder peakPowerForChannel:0] trying to get the volume, the return value is always 0, that's pretty odd.. I have checked the recorded audio file, it's totally fine. Then I use AVAudioPlayer to play it, an...

iphone 3.1 - MPMediaPlayer shows up portrait, not landscape, which is strange...

I have a movie file that does work. I added a tableview controller inside a nav controller, inside a tab view controller, and when a user clicks on the table view cell I load the video view. It launches the movie (and rotates in the simulator), but the video doesn't play and the controls are for portrait view. I do hear sound and see tim...

UIImageView scaling/interpolation

I have a small IPhone app that I am working on and I am displaying an image with a UIImageView. I am scaling it up using the Aspect Fit mode. I would like to have the image scale up with no interpolation/smoothing (I want it to look pixellated). Is there any way I can change this behavior? A little more general question would be ca...

iPhone Slide Tap Delete

Does the slide tap delete (ex: Deleting a video in Videos app.) come default when you make an iPhone vertical table? If not, how would I do that? Thanks. Sorry if this is a newbie question. ...

EXC_BAD_ACCESS with Objective-C Properties

In my iPhone application, I have the following line in a constructor: self.myVar = myVar_in; where myVar is a property and myVar_in is a parameter passed to the constructor. When I run the code, I get an EXC_BAD_ACCESS error on this line. However, when I replace the line with: [myVar release]; [myVar_in retain]; myVar = myVar_in; t...