cocoa-touch

What's the maximum number of bluetooth connections on the iPhone?

If you have any insight on this, it would also be nice to know whether there's a big latency between connections. ...

How do I create multiple threads in same class?

Hi, all! I want to create multiple threads in my application. I' using following code for creating a thread. This' buttonPress method where I'm creating a thread: (void) threadButtonPressed:(UIButton *)sender { threadStartButton.hidden = YES; threadValueLabel.text = @"0"; threadProgressView.progress = 0.0; [NSThread detachNewThrea...

How to use LIKE query in sqlite & iPhone

I'm using the following for a LIKE query. Is this technique for LIKE correct? selectstmtSearch = nil; if(selectstmtSearch == nil){ const char *sql = "SELECT col1, col2 FROM table1 t1 JOIN table2 t2 ON t1.cityid = t2.cityid where t1.cityname like ?001 order by t1.cityname"; if(sqlite3_prepare_v2(databaseSearch, sql, -1, &selectstm...

Linking to selected photos

If I allows users to select photos and need to store those selections (in a database), can I store a link to the selected photo or do I need to grab the image and store it in the app's Documents folder? The latter doesn't seem practical since it will cause the image to neednessly take up double the amount of space. I'm familiar with UI...

iPhone: Some Views Landscape others Portrait

Hey there, I've got a tabbar setup with a few tabs. The first tabitem is viewcontroller that programmatically loads a xib that is laid out in portrait. When the user rotates the phone, it automatically presents a modal view that is laid out in landscape. This mechanism works fine. When the device is rotated to portrait mode, it dism...

Vertical UITabBar

I wanted to make a UITabBar that when device-Orientation changes the icons of the TabBar match. Anyone who has used a Palm Pre/ Web OS device camera will know what i mean. At this stage i'm just interested in hearing different approaches to the problem. My solution is (theoretical) Subclass UITabBar, listen for the orientation change, ...

- (void)applicationWillResignActive:(UIApplication *)application never gets called

I'm trying to handle phone calls and standby and things of that nature. I added the function - (void)applicationWillResignActive:(UIApplication *)application and - (void)applicationDidBecomeActive:(UIApplication *)application to my UIApplicationDelegate. When coming out of standby, "applicationDidBecomeActive" always gets called. ...

Using performSelectorInBackground to load UITableViewCell image in background, performance

I have a method for loading images for UITableViewCell in the background. I use performSelectorInBackground. The problem is these threads are finishing and loading images even though they may not be on the screen anymore. This can be taxing on resources, especially when the use scrolls quickly and lots of cells are created. The images ...

Wrap text in a UILabel with quotes?

By default, UILabels truncate text and then put an ellipsis on the end. How might I wrap all the text, including the ellipse, in double quotes? ...

Objective C: Write a function to return the position of the last character in a UILabel?

A UILabel's text is drawn in a CGRect(x,y,size,width). The label can have multiple lines of text. Is it possible to write a function to return a CGPoint within this rectangle that designates the position of the last character? I ask because I am trying to wrap the text of a UILabel in an arbitrary prefix and suffix. The prefix/suffix n...

Creating static library for all builds

When I get a 3rd party static library, I can use it in my debug or release builds for both the simulator and device. However, when I build locally, it is targeted for debug simulator/device or the same for release. I then have to coordinate my host app to match the library build. How can I create a single static library build that wor...

Drawing an equation in Quartz

Hello everyone, I have got experience in iPhone programming but not really in graphics programming. I decided to make a 2d game and choose Quartz 2D for this purpose (I'm familiar with Open GL, but quartz seems to be easier for a 2d game). Is there a built-in way to draw a graph of a math formula in Quartz? For beginning it will be on...

accessoryType Checkmark indents UITableViewCell to the left

Hi there! When i select a cell in my tableview, the cell was pushed to the left by the accessoryTypeCheckMark. my custom cell was programmatically inserted into a tableview - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { UITableViewCell *selectedCell = [tableView cellForRowAtIndexPath: ...

Create a UIBarButtonItem with a title, and an image, and the default background

I am trying to create a UIBarButtonItem that looks like the normal Apple ones, but I'd like to include an image and a piece of text. As far as I can tell, you can't specify both an image and a title (the image shows but the title doesn't if you set both). Also, if you use a customView, then you lose the BarButtonItem look and feel. Wh...

Ideas for toy projects with which to familiarize oneself with Cocoa and Cocoa Touch

[Distilled from this question, with less informality.] What are some things a new Cocoa programmer should write as sample projects, outside of the hand-holding of a tutorial? Let's have one project idea per answer. If you have multiple ideas to suggest, post multiple answers. It'll help for you to also list what Cocoa concepts your pr...

How to launch an app in debug mode from xcode with a URL

Is there a way for xcode to launch an application with an app URL? I've read the answer to this question http://stackoverflow.com/questions/1239000/debugging-app-when-launched-by-push-notification, and it works great for single tests. I'm trying to write unit tests for launching the app with lots of different URLs, and using the previo...

Parse NSURL path and query (iphoneOS)

Are there any standard objects or functions to parse an NSURL's components? Clearly I could write one, but why re-invent the wheel? [NSURL path] will return an NSString like "argX=x&argY=y&argZ=z" What I would rather get back is a dictionary populated with {@"argX" => @"x", @"argY" => @"y", @"argZ" = @"z"} For the path, which returns ...

Extract part of a NSString in Cocoa in an efficient way

Hi, How could I extract a part of an NSString before certain word(s): For example: If the keyword set of 'separators' is an NSArray of the following words "Series" and "documentary" and if the NSStrings where "Chain two Series documents" <---- I'd like to extract "Chain two" "Chain documentary documents" <---- I'd like to extract ...

Changing my CALayer's anchorPoint moves the view

I want to alter the anchorPoint, but keep the view in the same place. I've tried NSLog-ing self.layer.position and self.center and they both stay the same regardless of changes to the anchorPoint. Yet my view moves! Any tips on how to do this? self.layer.anchorPoint = CGPointMake(0.5, 0.5); NSLog(@"center point: %f %f", self.layer.posi...

How do I change the UITextField so it looks like the Search Text Field?

I would like to change the standard iPhone UITextField so that it looks exactly like the search text field within the UISearchBar. You can see an example of this for the SMS text entry field within the iPhone Messages application. I do not believe that the UITextField has a style property that will meet this requirement. Any ideas? ...