cocoa-touch

How to properly work (retrieve values) with NSUserDefaults

Hi all, I have a simple method in my code which looks like the following: - (BOOL)isFirstTimeLogin { NSString *t_gName = [NSString stringWithFormat:@"%@", [[NSUserDefaults standardUserDefaults] objectForKey:kGroupIdentifierKey]]; if ([t_gName isEqualToString:@""] || t_gName == nil) { DLog(@"LoginViewController, m:::isFi...

Most performant audio layer?

I'm curious as to which of the available audio layers is the most performant, out of the ones available on the iPhone. Currently I've used the SystemSoundID method, and the AVAudioPlayer method, and I'm wondering if it's worth investigating AudioQueue or OpenAL...are there significant performance gains to be had? Thanks! ...

How do you add multi-line text to a UIButton?

I have the following code... UILabel *buttonLabel = [[UILabel alloc] initWithFrame:targetButton.bounds]; buttonLabel.text = @"Long text string"; [targetButton addSubview:buttonLabel]; [targetButton bringSubviewToFront:buttonLabel]; ...the idea being that I can have multi-line text for the button, but the text is always obscured by the...

Displaying UIActivityIndicator for x seconds

I have a UITableViewController, which is RootViewController. It's XIB only has a table view. I've add a UIActivityIndicator through IB and created an IBOutlet. I've programmatically added a toolbar with a delete button to the RootViewController. When the user clicks the toolbar's delete button, I want to display the indicator, center...

How do i resolve EXC_BAD_ACCESS errors encountered in iphone development

I'm trying to do a simple thing; read an image from the internet, save it to the app's documents directory on the iphone, and read it back from that file so that i can do other things with it later. Writing the file works fine but when i try to read it back i get an EXC_BAD_ACCESS error in GDB that i have no idea how to resolve. Here i...

Playing sounds in iPhone games - slowdowns

I'm using the AVAudioPlayer to play sound FX on a separate thread in my app. Right now my app is fairly simple, I have a UIScrollView for a scrolling background, and a couple of CALayers that represent a player and an enemy in a simple side-scroller type game (think Mario or Kung Fu or whatnot)...I can move the player left and right, wit...

add "Now Loading" before UITabBarController tab select?

Hello everyone - One of the tabs of my UITabBarController takes some time to work before it can be displayed. What is the best way to display a "Now Loading" before the viewcontroler completes its work? I tried setting up a "now loading" view in the tab's viewController's viewDidLoad method, then I do the work in viewDidAppear, settin...

iPhone unread counts on tabbar

Which is the best way to implement on Cocoa Touch the unread counts on a icon on a TabBar? I want to mimic the SMS or Mail application behavior, showing the unread message count to the user of my application, with a red dot containing a number. ...

How do I reset (i.e. un-zoom) a UIScrollView?

I have a UIScrollView that contains an image and a segmented control that allows the user to switch the image inside of the ScrollView. If I just swap the image out inside of the UIImageView, it will display the new image in the zoomed-in state. How do I reset the UIScrollView back to its un-zoomed-in state? ...

What's the easiest way to resize/optimize an image size with the iPhone SDK?

My application is downloading a set of image files from the network, and saving them to the local iPhone disk. Some of those images are pretty big in size (widths larger than 500 pixels, for instance). Since the iPhone doesn't even have a big enough display to show the image in its original size, I'm planning on resizing the image to som...

Layer vs Scene in Cocos2d for iPhone game development

Using cocos2d for iPhone game development, I am confused between Layer and Scene. For example, My simple game have several "UI Pages" like main menu, highscores, game board etc. So should I use Layer or Scene for every "UI page", and why? ...

WiFi iPhone Application

Hi im working on an iPhone application which requires communication between 2 devices through WiFi. Can somebody please help me by providing a simple iphone application code for the same which is able to communicate data between the devices...i hv gone through the "witap application" available on the developers site but wasnt able to un...

UICachedDeviceWhiteColor and NSAutoRelease for table cell mem leaks

I have a memory leak that displays UICachedDeviceWhiteColor. I'm not using UICachedDeviceWhiteColor anywhere and a search on it turns up people saying this is a bug in the iPhone-SDK. I found this blog entry: http://piezoelectrics.blogspot.com/2009/02/uicacheddevicewhitecolor-leak-in-iphone.html but I can't find #import "NSAutorelea...

iPhone Views at Runtime?

Hello, I am new to the iPhone SDK and am trying to create 3 views and switch between them. Data will come from a server and I will basically be showing 1 view and caching the other two. So far I am just trying to create a view and display it at run-time. My code is listed below. It shows only a blank screen and I think I am missing a key...

Architecting a multiview application on the iPhone

I have an app with a root view controller, a primary view controller, and a secondary view controller. I would like to be able to send a message to the primary view controller from the secondary view controller. How can I get a reference to the primary so that I can send messages to it? Is there a better way to architect this? ...

iPhone - access location information from a photo.

Is it possible, in an iPhone app, to extract location information (geocode, I suppose it's called) from a photo taken with the iPhone camera? If there is no API call to do it, is there any known way to parse the bytes of data to extract the information? Something I can roll on my own? ...

Where is the UIWindow instantiated in an iPhone app?

When you create an application from the "View-Based" template in the iPhoneSDK the following code is generated. I basically understand what is happening here, but I do not see where window and viewController are instantiated. Any Help? @class jojojViewController; @interface jojojAppDelegate : NSObject <UIApplicationDelegate> { UIWi...

How to use scroll view on iPhone?

I want to display a text with a lot of lines. I added a multiline-label to a scroll view, but it didn't show anything. Looks like this is not the correct way to use the scroll view. How to use scroll view so that users can drag down to see more text? ...

Wi-Fi Application

HI I am developing game in that I want to Play that game through Wi-Fi. So more that one player can also play the game. I want to develop this game for iphone. I gone through WiTap application which is on developer.apple.com since it's very hard to use. So if anybody knows how to send a simple data such as integer or string etc. th...

Adding Icon on desktop of iPhone

Hi, I want to place an icon on the iPhone screen form my application, like placing an icon and if i will touch that icon it will do the desired operation, like opening a sound file or an image. So i want to ask is it possible to place an icon on screen through an application and do some events on it. Regards, Vishal ...