iphone

How do I memory manage UIViewControllers with a navigation controller?

So yeah, I'm a Java guy in this crazy iPhone world. When it comes to memory management I stiill don't have a very good idea of what I'm doing. I have an app that uses a navigation controller, and when it's time to go on to the next view I have code that looks like this: UIViewController *myController = [[MyViewController alloc] initWi...

Persisting Dates to SQLite3 in an iPhone Application

I am developing an iPhone application that persists data to a SQLite3 database. For each row I persist I wish to include a 'created date' and a 'last modified date' My question is what is the recommend approach for storing this information in a table? The properties are represented as NSDate in my application but I am unsure how to ...

Timer and animation events trumping TouchesEnded events

Hi all, I've implemented a tap-and-hold handler using an NSTimer that I first set in the TouchesBegan overload. However, what I actually want is for an action to be continuously performed in quick-fire succession while the touch is being held. So, on timer expiry I call a handler to do the work, which then sets another timer and the cy...

Does adding many many subviews to a viewcontrollers default view make my app slow?

I have an app where I create many uiviews and add them to the self.view of the UIViewController. My app is running really slowly. I am releasing all of my objects and have no memory leaks (I ran the performance tool). Can anyone tell me what could be making my app so slow? (code is below) [EDIT] The array has around 30 items. [/EndEdit]...

How to remove a Run Script phase from Xcode

I tried this step: Select the menu options "Project > New Build Phase > New Run Script Build Phase", and enter the following script (don't forget to replace /Users/youruser/bin by the correct path to gen_entitlements.py) : export CODESIGN_ALLOCATE=/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/codesign_allocate if [ "${PL...

How to pause a UIImageView animation

I have an animation that I'm displaying using a UIImageView: imageView.animationImages = myImages; imageView.animationDuration = 3; [imageView startAnimating]; I know I can stop it using stopAnimating, but what I want is to be able to pause it. The reason is that when you call stop, none of your animation images are displayed, whereas...

Converting audio to CAF format for playback on iPhone using OpenAL

I am using the SoundEngine sample code from Apple in the CrashLanding sample to play back multiple audio files. Using the sample caf files included with CrashLanding everything works fine but when I try and use my own samplesconverted to CAF using afconvert all I get is a stony silence ;) Does anyone have settings for afconvert that wil...

UITableView issue when using separate delegate/dataSource

General Description: To start with what works, I have a UITableView which has been placed onto an Xcode-generated view using Interface Builder. The view's File Owner is set to an Xcode-generated subclass of UIViewController. To this subclass I have added working implementations of numberOfSectionsInTableView: tableView:numberOfRowsInS...

Deploying Test Resources in the iPhone Simulator

I am working on an iPhone Application that stores images in the Applications 'Document' folder. I am currently doing the majority of my testing using the iPhone Simulator. In order to aid development I want to have some test images pre-loaded into the Document folder of the application that my application can access and display. I have...

Why is my iPhone app crashing?

When I try to allocate a Texture2D the app just crashes. I've stepped through the code where the crash occurs... all I can tell is "EXC BAD ACCESS". Here is the line in the app delegate that makes it crash: _textures[myTex] = [[Texture2D alloc] initWithImage: [UIImage imageNamed:@"sometex.png"]]; sometex.png has been added to the re...

How do I make my iPhone app find my images?

My app crashes when I do the following in the applicationDidFinishLaunching event in the app delegate: _textures[mytex] = [[Texture2D alloc] initWithImage: [UIImage imageNamed:@"a.png"]]; However when I replace @"a.png" with @"/Users/MyUserName/Desktop/MyProjectFolder/a.png" everything works fine. I've experimented with the relati...

Problem with #Import <AppKit/AppKit.h> in Xcode

I need to use NSImage which appears need to be imported from <AppKit/AppKit.h>. I have included the AppKit framework, and I do see AppKit.h there. But I am still getting compilation error saying <AppKit/AppKit.h> not found. What I might missed ? Thanks. ...

-didSelectRowAtIndexPath: not being called

I'm writing an iPhone app with a table view inside a tab view. In my UITableViewController, I implemented -tableView:didSelectRowAtIndexPath:, but when I select a row at runtime, the method isn't being called. The table view is being populated though, so I know that other tableView methods in my controller are being called. Does anyon...

How do I change the text size and component width of a UIPickerView?

I have the following code to create a UIPickerView: pickerView = [[UIPickerView alloc] initWithFrame:CGRectMake(0.0f, 416.0f - height, 320.0f, height)]; pickerView.delegate = self; pickerView.showsSelectionIndicator = YES; [pickerView setSoundsEnabled:YES]; I would like to change the component widths and change the text size in each ...

How to "simplify" UIImagePickerController

I am using UIImagePickerController to take photo, there are two steps involved, "Take photo" and "Use photo". Is there any way to override the behavior, merge these two action in one? Say "Take and use photo". Thanks. ...

NSData and UIImage

I am trying to load UIImage object from NSData, and the sample code was to NSImage, I guess they should be the same. But just now loading the image, I am wondering what's the best to troubleshoot the UIImage loading NSData issue. Thanks. ...

Trying to play sound through iPhone Simulator

I'm trying to play a sound file from an iPhone program. Here's the code: NSString *path = [[NSBundle mainBundle] pathForResource:@"play" ofType:@"caf"]; NSFileHandle *bodyf = [NSFileHandle fileHandleForReadingAtPath:path]; NSData *body = [bodyf availableData]; NSLog( @"length of play.caf %d",[body length] ); NSURL *url = [NSURL fileURL...

SRV record lookup with iPhone SDK

In either a Windows or Mac OS X terminal if you type... nslookup -type=SRV _xmpp-server._tcp.gmail.com ... (for example) you will receive a bunch of SRV records relating to different google chat servers.. Does anyone have any experience in this area and possibly know how to service this information (hostname, port, weight, priority) ...

How do I use CALayer with the iPhone?

Currently, I have a UIView subclass that "stamps" a single 2px by 2px CGLayerRef across the screen, up to 160 x 240 times. I currently animate this by moving the UIView "up" the screen 2 pixels (actually, a UIImageView) and then drawing the next "row". Would using multiple CALayer layers speed up performance of rendering this animation...

Are there any standard way to implement the "blue badge" in iPhone?

A lot of iPhone apps use a blue badge to indicate the number of items in the subviews, such as the Mail client: Are there any standards way (or even an API) do this? UPDATE: I have created a class called BlueBadge to do this. It is available at http://github.com/leonho/iphone-libs/tree/master ...