cocoa-touch

Modal View changes dimensions of original view?

I am specifying the dimensions of a UITabBarController, which is positioned at coordinates 0x 40y on the screen. I then call a ABPeoplePickerNavigationController to view a contacts list. I was able to specifiy the location of the contacts list to match the position of the UITabBarController. However, I am having problems restoring the UI...

UITabBar Badging

Any idea why this works: [[[[[self tabBarController] tabBar] items] objectAtIndex:2] setBadgeValue:@"Hello"]; But this doesn't? [[self tabBarItem] setBadgeValue:@"Hello"]; I would rather not have to provide an explicit tab bar index (2 in the code above). Also, is there a way to get the ta...

How to detect if the phone app is available for various devices using iphone os

I'd like to show or hide a button that lets a user make a phone call based on whether or not the user can actually make a call (iPhone or iPod touch). Is it possible to somehow detect if the phone app is available to the user in cocoa-touch? Or am i constrained to detecting the device type to make that distinction? I would rather chec...

Filling class variables from an NSDictionary in a loop

I would like to fill in the class variables in a loop from an dictionary. What I want to do is having the dictionary key as a class variable and assign the class variable (the dictionary key) the value from dictionary... something like this : +(void) initWithDictionary:(NSDictionary *)dic { MyClass *classInstance = [[[self alloc] ini...

How do I create a login system for an iPhone application.

Hi guys, I'm trying to make a login system for my cocoa app. How would I do this? I know it involves SQL, but I know nothing of SQL. I want the user to register or login. It would be easier if apple had a source code for this kind of thing, but I don't think they do. Best Regards, Kevin ...

This loop is very slow, I think because I create a lot of intermediate strings. How can I speed it up?

NSArray *splitPoints = [routeGeom componentsSeparatedByString:@"], ["]; routePoints = malloc(sizeof(CLLocationCoordinate2D) * ([splitPoints count] + 1)); int i=0; NSArray *coords; for (NSString* coordStr in splitPoints) { coords = [coordStr componentsSeparatedByString:@","]; routePoints[i].latitude = [[[coords objectAtIndex:0] su...

Another Speed Boost Possible?

Thanks to the respondents on this question (http://stackoverflow.com/questions/1396949/this-loop-is-very-slow-i-think-because-i-create-a-lot-of-intermediate-strings-h) I was able to speed up my code many orders of magnitude. I think I can probably do a bit better though. Is it possible to avoid the creation of a bunch of NSString's here...

Why is this C-style code 10X slower than this obj-C style code?

//obj C version, with some - less than one second on 18,000 iterations for (NSString* coordStr in splitPoints) { char *buf = [coordStr UTF8String]; sscanf(buf, "%f,%f,", &routePoints[i].latitude, &routePoints[i].longitude); i++; } //C version - over 13 seconds on 18,000 iterations for (i = 0; buf != NULL; buf = strchr(buf,'[...

IPhone - Get reference to cells that are currently on screen.

I have a Table View Controller with cells. I want to update the text that is displayed on the visible UITableViewCells. Is there a way to get a reference to the cells that are currently on the screen? ...

What is the scope of (nested) autorelease pools?

Hello, I'm creating an autorelease pool in a for loop (in method A). At each iteration of the loop, I'm calling another method (method B). Method B returns an autoreleased object to Method A. If I drain the pool within the for loop in Method A, will that release the objects sent from Method B? Thanks! ...

Tab Bar on TableView?

Hi, Expecting your well advice! I have a TableView(Grouped Table created via I.B). I'm showing some data on the table when code executes using Navigation Controller view. I want to add a "Tab Bar" in my Table view whether through I.B (or) Programmatically. For ex: Launch built-in "Clock" app, where you can see a Tab Bar which has optio...

imageWithCGImage and memory

If I use [UIImage imageWithCGImage:], passing in a CGImageRef, do I then release the CGImageRef or does UIImage take care of this itself when it is deallocated? The documentation isn't entirely clear. It says "This method does not cache the image object." Originally I called CGImageRelease on the CGImageRef after passing it to imageWit...

MKMapView and dequeueReusableAnnotationViewWithIdentifier:

I have an MKMapView with about 1000 MKPinAnnotationView's on-screen at the same time. It has extremely slow scrolling performance. I am attempting to dequeue my annotations views appropriately like so: - (MKAnnotationView *)mapView:(MKMapView *)mapView viewForAnnotation:(id <MKAnnotation>)annotation { static NSString *viewIdentifi...

Launch Mail app to check for new email

I know how to launch the Mail app to write a new email (using mailto). But I have a facility for users who have forgotten their password to get it sent to their email, and when they submit the request I would like to launch the Mail app, preferably in their Inbox. Is there a way to do this? ...

Can Cocoa Touch UI objects be serialized, transmitted over a network, and reconstituted on a client?

I've been working on and off with a team that's developing an iPhone app. Like a lot of other developers new to Cocoa Touch, we decided to create a hybrid Cocoa-Web app which was essentially a few buttons controlling some UIWebViews -- partly to (a) leverage existing web development expertise, partly because of (b) the advantage in pushi...

How to "fake" ivars in an Obj-C category (iPhone)

Update: iPhone OS 3.1 has associated objects. However, the iPhone simulator does not. If you want to test associated objects code in the simulator, you should file a bug. See my SO question here. rdar://7477326 Snow Leopard now has associated objects. Is there a way to accomplish something similar without associated objects? (Spe...

Why is sizeWithFont:constrainedToSize:lineBreakMode: returning an incorrect size?

I have two possible widths for a string i want to display in a label in a table cell, and i need to compute the height so that the table cell's height is recorded correctly. however, no matter what I do for the constraining size i get the same height, which is incorrect in the case i want. The code i'm using: CGFloat width = 300.0f; N...

Content of custom table view cells not drawing correctly

I have several parts in my app where I use custom table view cells. Their content is created with subviews. The problem is that on some of these cells, the content does not appear at all or does not appear correctly until after the cell was selected for the first time. One example is a custom cell which has a custom subview which can...

Switching between ModalViews

Scenario: 1. Show navigation controller based view 2. User select option 3.   Show modal view A 4. User select another option in modal view A 5.   Hide modal view A 6.   Show modal view B // This function must show modal view A This scenario implemented like this: - (IBAction)showModalViewA:(id)sender { ModalViewA *viewA = [[ModalVi...

How do I display a button on a UIAlertView after displaying it.

Hi, im newbie developing with objc. Im working on a piece of code that installs a plugin to my application. It downloads a .zip package, uncompress it and copy some data to my sqlite database. I have a UIAlertView that shows a UIProgressView while the app is downloading and uncompressing, when it finish I add to the UIAlertView a butto...