cocoa-touch

Releasing NSData causes exception...

Hi, Can someone please explain why the following code causes my app to bomb? NSData *myImage = UIImagePNGRepresentation(imageView.image); : [myImage release]; If I comment out the 'release' line, the app runs... but a few times calling the function containing this code and I get a crash - I guess caused by a memory leak. Even if I...

How to switch between primary and secondary thread within different controllers in cocoa

Hi, I know I can create a separate thread in cocoa touch with the following code: [NSThread detachNewThreadSelector:@selector(getEarthquakeData) toTarget:self withObject:nil]; How to go back to the process of my primary thread? I know I can do this from the delegate with this code: [(id)[[UIApplication sharedApplication] ...

Styling UITableViewCells with gradient backgrounds

Hi folks, I've been looking for ways to improve the overall attractiveness of my iPhone applications. A majority of the functionality happens in UITableView. I think I can start by adding subtle gradients to UITableViewCells, as that seems to improve the feel of the app by an order of magnitude. Selecting the appropriate fonts/sizes hel...

UITextView background image

Hi, how can I add a background image to UITextView? Thanks. ...

How to reference HTML anchor?

I'm loading a string of HTML into a UIWebView through loadHTMLString. It produces a very long webpage. Once that string is loaded, I need to navigate to an HTML anchor tag with its "name" attribute set. In the HTML, I might have: //3 pages of text here <a name="go here"></a> lots more text here //another 3 pages of text here I need...

subview running but not showing

From withing a UIViewController that is tied to a UIView (drawn in a nib file), i try to add another view, as a subview to the first view. In case you are confused: UIViewController -> UIView + GraphView (extends UIView) So i am saying: GraphView *myGraphView = [[GraphView alloc] init]; graphView = myGraphView; [self.view addSubview:g...

UIACtionSheet Delegate Question

I am using an action sheet to alert a user to several items upon logging into my app. listed are some examples of the alerts and the buttons that go with them. INVALID USER - OK INVALID PASSWORD - OK INVALID USER - OK UNKNOWN USER - CREATE NEW USER, CANCEL USER ALREADY LOGGED IN - DISCONNECT, CANCEL LOGIN What is the best way to manag...

Making sense of the 'leaks' command line utility for finding memory leaks

Hi all, I'm working on tracking down some difficult to find memory leaks in my iPhone program. I'm running a quick test on an app which leaks an NSString object with the following intentionally -incorrect- code: -(void)applicationDidFinishLaunching:(NSNotification *)notification; { NSMutableString *test = [[NSMutableString alloc] i...

Best way to learn iphone audio queue services, step by step tutorial

I'm trying to learn how to handle audio at a fairly low level with audio queue services. I have been progrmaing in memory managed languages for quite a while, and have just completed the c programing tutorial by vtc (2007). This has left me comfortable with the understanding of pointers and memory allocation, but the apple documention ...

UIImagePickerController Crash after 5 to 7 pictures - again

OK, I know this one has been beaten to death on this forum, but I'm still having the memory problem and I have tried all the techniques on the web to get around this. I have an application that uses the UIImagePickerController to capture an image from the camera. I've tried both creating and destroying the controller for each picture, a...

how to do an http post in cocoa on the iPhone

Can anyone paste some code on how to do an http post of a couple values? ...

scrolling background

Hi, in my app I am adding a background to UITextView. But when the text view scrolls down the image goes together with the text and the background for new lines of text appears to be white. Is there an easy way to cope with it? Here is my code: textView = [ [UITextView alloc] initWithFrame: CGRectMake(10, 100, 270, 130)]; UIImageView *...

Is UITextView empty?

Hi, To know if an UITextView is empty I used the following code: if ( [ [textField text] isEqualToString:@""] ) But unfortunately it somehow fails to tell if the text field is empty. What are the other ways? When [textField text] is empty, it equals to nil. Thank you. ...

Catching back button navigation event

I have a nav based app. Once a row is clicked in a tableview, I push a UIWebView. The UIWebView has web links in it. The user clicks a link, which renders the external webpage. This all happens within my app. The top nav bar hasn't changed with the clicking of a link that renders and external webpage. However, once the user clicks ...

Can you set a contact's image in AddressBook programmatically on the iPhone?

I'd like to be able to set a contact's default image programmatically on the iPhone. Does the API currently allow for that? I've found you can toggle several properties for the person, and create new contacts. I can't seem to find anywhere in the documentation that allows to set a photo. Thanks! ...

iPhone camera pics come up rotated -- CGAffineTransformInvert: singular matrix.

I'm getting the UIImage from the image picker and putting it into a UIImageView. It works fine for regular images, but for images taken with the iphone camera, they sometimes come up rotated 90 degrees. When accessing one of those images later (it has already been saved to disk) I noticed the above error. Any ideas? I assume it has som...

Changing UIImageView animation speed

I am using the UIImageView to animate a bunch of images. I know that I can change the speed by altering animationDuration, but that doesn't seem to take effect until the animation is restarted. My problem is that beside not really wanting to have to restart the animation as this limits me to only being able to change the speed once per ...

Locating the UIView that UITableView scrolls over

Hi all, I'm working on trying to obtain the UIView that UITableView scrolls over, if scrolling is enabled. Typically, the background is white, and if you push the UITableView out of its bounds, you'll see a background. I'm trying to set this background to a UIColor of blackColor. I can't seem to find the appropriate one to tag. I've tri...

Scrolling UITableView on the iPhone as seen in the Tumblr app?

Hi folks! This inquiry is rather difficult for me to properly phase, but I'm going to give it a shot either way. I'm currently trying to figure out how to set my UITableView's to scroll over a background, and not within their own bounds. What I mean by that, is if you look at the Tumblr application, screenshot here: http://dl-client.g...

iPhone Unable to receive data using UDP recvfrom

I am writing an application which is continuously sending and receiving data. My initial send/receive is running successfully but when I am expecting data of size 512 bytes in the recvfrom I get its return value as -1 which is "Resource temporarily unavailable." and errno is set to EAGAIN. If I use a blocking call i.e. without Timeout th...