iphone

custom properties for UIButton (iphone sdk)

I have created a subclass for a UIButton and was hoping to pass a custom property to it. However, it's not working and I've since read that subclassing a UIButton isn't a great idea. MY question is how do I assign a custom property to a button? I am creating a button which is being placed in the headerview of a grouped table. I want to ...

Sometimes CCCallFuncN is not fired in Cocos2d

I am noticing that sometimes the CCCallFuncN callback function is not triggered. I am not sure why is this behavior? [alphabetToFind stopAllActions]; id disappear = [CCFadeTo actionWithDuration:.5 opacity:0]; id actionMoveDone = [CCCallFuncN actionWithTarget:self selector:@selector(removeAlphabetToFindFromView:)]; ...

How to stop the UITextField from responding to the shake gesture?

By default, if you shake the iPhone while entering text in a UITextField, a little box will appear asking if you want to undo typing. How can I prevent this from happening? I looked through the UITextField, UITextFieldDelegate, and UITextInputTraits docs and found nothing relating to shaking. Presumably I could subclass UITextField to i...

Looping a CFRunLoopSource

Here is the source files I'm currently developing. The idea behind this class is to contain a target object and selector which will be invoked in whatever CFRunLoop passed to scheduleInCFRunLoop. I need this to loop repeatedly without consuming all available processing time on the iPhone. Any help on completion will be most helpful, I've...

initWithNibName is not getting called

I need to put it some custom logic into my iPhone app so that depending on what iOS version you are running, choose a different XIB file (i.e. iPhone or iPad will show different XIB files). I had built the whole iPhone app from day one and its all good, using a tabbarcontroller and the standard navigation controllers in each tab. So I ...

Connecting Java to Objective-C (using AsyncSocket)

I need to communicate between a Java app (desktop) and an iOS app. I've decided to use AsyncSocket on the iPhone side (and I've gotten data sending to work). For this question, I'm just running the EchoServer demo app on OSX 10.6.4. Source code is here. Here's my Java code, boiled-down: Socket echoSocket = new Socket("192.168.0.102...

How to Automatically Display Title/Subtitle on Map Annotation (pin)

I am loading an annotation onto my map view. The annotation displays as a pin when the map is loaded. However, the title and subtitle do not appear on the pin automatically. Currently, the user is required to tap on the pin before the title displays. Is there a way to get the title to display automatically on the pin when the map is lo...

iPhone static archive lib: Undefined symbol link error

I haven't found a solution for the exact problem I'm having, so perhaps someone here can help me. I've created a static archive library that uses the AVAudioPlayer class and links against the AVFoundation framework. However, when I link my app against this static library, I receive the following linker error: Undefined symbols: "_OBJ...

MPMoviePlayerController thumbnailImageAtTime returns empty UIImage

I'm working on an iPad app that plays a video with MPMoviePlayerController and - based on user interaction - uses thumbnailImageAtTime to try to grab an image from the video. I've tried using both options MPMovieTimeOptionNearestKeyFrame and MPMovieTimeOptionExact. Regardless of which option, I find that I sometimes get back an empty U...

iPhone/iOS SDK: How to make certain subviews autorotate?

I've got an app that has two parts. Basically, the first part shows a bunch of image thumbnails. When you tap an image thumbnail, a full view of that image pops up inside a UIScrollView, filling the screen, with some buttons on top of it for performing various actions. I want the main page with the thumbnails to always be in Portrait ...

Translation error

NSString *soundURL = [NSString stringWithFormat:@"http://translate.google.com/translate_tts?q=%@&tl=%@",strTextOfFilter,strCodeOfLanguage]; NSLog(@"URL : %@",soundURL); this show:http://translate.google.com/translate_tts?q=%E4%BD%A0%E5%A5%BD&tl=zh-TW copy url to Browser of firefox. it's right Translation of Chinese,b...

PDF in webview performance

Hi - I am using the following (simple) code to load a PDF from the documents folder in my app into a UIWebView. The performance is very poor. I tried loading the same PDF from the web via Safari and the performance was great. Does anyone have any ideas? (this viewController is being presented as a modalViewController). - firstView.m In...

iPhone Map Region Weirdness

The attached image is what happens sometimes when I try to size a MKMapView to fit one or more placemarks. It's intermittent, but the display is always in exactly the same position. Here is the code: // loc1 is always non-null, and is equal to one of the annotation locations CLLocationCoordinate2D topLeftCoord = loc1.coordinate; CL...

Core Data database doesn't save

I'm trying to implement the Paparazzi 2 assignment from the Stanford CS193 course and I'm running into a problem. My one call to save the database is when the app exits (I'm borrowing heavily from Mike Postel's version to check my code): - (void)applicationWillTerminate:(UIApplication *)application { if (flickrContext != nil) { ...

iphone social networking

I am trying to build an application which should send the data as an xml file to the server and other user's should be able to see the info uploaded by another user. Embedding everything in xml file is done but now the question is how to push this information to the other user's so that they can see it in a particular format. Also how i ...

Twitter-esque UITabBarController?

I'd like to make an app that uses a UITabBarController that is similar to the one in the Twitter app for iPhone and iPod touch. (Blue light for unread and sliding arrow for switching between content views). Is there an easy way to do this? Any open source code? ...

Prevent image resizing when attaching via Mail Composer?

I'm using the basic MFMailComposeViewController through the iPhone SDK to attach photos and send e-mails from within an app. The big problem I have is that, if I have HTML enabled (isHTML:YES), the control takes it upon itself to add reduced width and height values to the image element within the HTML that it generates. The actual imag...

Testing when an UIImage background color has changed

I have a student working on a project where he has a UIImage where he is able to draw a line on the screen. We want to know if you have any idea if he goes back and forth filling the entire screen with lines is there a way to test that every pixel has been covered with the line color? For example if the background is grey and the pen col...

iPhone: Find UITableViewCell using a UILabel

I have a UITableView that has about 20 cells. Each has a UILabel within, and I need to search and find the cell that has the label @"Test". Is there a way to loop through the cells and search for the NSString @"Test"? ...

Background UIImageView that doesn't get rotated

I have this UINavigationController-based iPad app that supports all 4 orientations. When I rotate the device, I'd like the background image to stay still and only have the UI on top of it get rearranged/rotated. I've succeeeded by returning NO to the UIViewController shouldAutorotateToInterfaceOrientation: and handle the orientation mys...