cocoa-touch

How is the relation between UIView's clipsToBounds and CALayer's masksToBounds?

A UIView has a CALayer. That's pretty sure. But both seem to provide something that means the same thing. If I'd set clipsToBounds=YES, would this also set the layer's masksToBounds=YES? Why different names? Anyone knows? ...

UITableView pushViewController On Selecting a Row

Hi all, I'm building an iPhone app with a UITableView. On selecting a row, I'd like a UIWebView to be pushed in loading a specific URL. I currently have: - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { NSDictionary * story = [stories objectAtIndex:[indexPath row]]; NSString * storyLink =...

Creating an alternative way to scroll TableView on iPhone

I currently have a TableView with over 35,000 cells. Obviously the standard iPhone flick-and-scroll becomes inefficient with this many cells. I have already implemented search but still think that a way to scroll the entire table is necessary. I am currently using the -sectionIndexTitlesForTableView: method to populate the side wit...

Favorite way to synchronize sqlite3 db on iPhone over HTTP

I currently have an sqlite3 database in my iPhone application. The database has grown to 10MB+ on its own with all of the data I've thrown at it so far. Some of the data I'd rather not have part of the App Bundle as well. If I provide just the schema, what's your favorite way of syncing all of the tables over HTTP? ...

Number of days in the current month using iPhone SDK?

A fairly straight forward question, I am trying to figure out how I can get the current number of days in the current month using NSDate or something similar in Cocoa touch. Thanks. ...

How to copy objects, like AVAudioPlayer

I'm rather surprised at how few objects implement NSCopying. This is the third time in two weeks where I have needed to duplicate an existing object, without having to either go to disk and reload, or recreate the object and set its settings. Now I have to duplicate an AVAudioPlayer sound. Why? I want to play the sound twice, withou...

Are there Constraint Layout Managers on iPhone OS?

The CA Programming Guide is talking about Constraints Layout Managers. However, the CALayer in the iPhone SDK doesn't have any constraints property or addConstraint method. They say iPhone OS just doesnt provide custom layout managers. But how about the standard ones? ...

Archiving and Unarchiving results in Bad Access.

I'm having trouble setting up a model object to save the visual state of user generated CALayers in a simple graphics application for the iphone. I'm attempting to save the background color and frame of all the current layers on screen by passing those properties to model objects which implement the NSCoding protocol and then into an NS...

How much does it matter regarding to memory if I create an CALayer rather than an UIView?

While an UIView has a memory footprint of at least 4 * width * height pixels, I wonder how that would look when I create a CALayer only. ...

Does the -presentationLayer tell me the in-flight values of an view while it is beeing animated?

The doc says: presentationLayer Returns a copy of the layer containing all properties as they were at the start of the current transaction, with any active animations applied. And somewhere else Apple said, that the presentation layer contains the values like they are currently displayed to the user. So when I ask for this ...

What's your method for this... wiping out your DocumentsDirectory during iPhone development?

I'm sure there is a better way to do this. I have this chunk of code that I use to wipe out the DocumentsDirectory on an iPhone or Simulator. Sometimes I just want a clean slate, and sometimes I make changes to a database and I need to rebuild it. So, in one of my functions that gets called when I turn on my app, I have this code comme...

Play Alert Sound (Vibrate) While AudioQueue is Recording

It seems that it's not possible to play an alert sound AudioServicesPlayAlertSound(kSystemSoundID_Vibrate); while the AudioQueue is being used to record audio. Is that correct? Maybe I'm doing something wrong. Is there a way to do this other than pausing the recording? TIA. ...

Removing text shadow in UITableViewCell when it's selected

I've added a text shadow to cells in my UITableView to give them an etched look: cell.textLabel.textColor = [UIColor colorWithWhite:0.2 alpha:1.000]; cell.textLabel.shadowColor = [UIColor whiteColor]; cell.textLabel.shadowOffset = CGSizeMake(0, 1); Since the shadow color is actually white, when a row gets selected and becomes blue, th...

Converting a normal PNG to iPhone Optimized format

I have an iPhone application that downloads images from the internet and saves them for display later. The user can select the images to view from a UITableView, the table view has custom cells which display thumbnails of the original images in varying sizes. When the large image is first downloaded it is scaled to thumbnail size and t...

Getting UIResponder touches

Without subclassing a UIResponder class(e.g. UIView) and overriding its touchesBegan:withEvent: method, is it possible to get informed of touch events of a UIResponder class? This question was answered here. ...

MKPinAnnotationView: Are there more than three colors available?

According to the Apple docs, MKPinAnnotationView's pin color is available in red, green and purple. Is there any way to get other colors also? I've found nothing in the docs. ...

Propagating touches from UIApplication in a custom manner

Is it possible to propagate touches from shared application object to a custom view which has not actually received touches and somewhere at the back of the top view? Assume that I can't use my top view to track touches. ...

Would the general iPhone pasteboard ever contain more than one item?

Would pasteboard.numberOfItems (in the code below) ever be greater than 1? How would the user cause this to happen? UIPasteboard *pasteBoard = [UIPasteboard generalPasteboard]; pasteBoard.numberOfItems Note that I'm not asking if a single pasteboard item can have more than one representation type. That they can is clear. Update: I ...

Basic Objective-C: Why does this code work?

Question 1) I have a navigation based application where clicking on an entry opens a second view with the details of that entry. It's working now with the following code [self.navigationController pushViewController:descriptionController animated:YES]; [self.descriptionController.textView setText:[s description]]; self.descriptionC...

Invoke method in another class

I have two view controllers (viewControllerA and viewControllerB) with their own views. When the user touches a button in the view of viewControllerA, I am able to load the view of the viewControllerB. However, I don't know how to invoke a method in viewControllerB's class! ...