cocoa-touch

Replace the blue-gray stripes background in a grouped UITableView?

How do I replace the vertical blue-gray stripes background in a grouped UITableView? For example, it would be cool to have a background of horizontal stripes instead! Here is a nice example: ...

Objective-C: Fixing memory management in a method

Hi all, I'm almost there understanding simple reference counting / memory management in Objective-C, however I'm having a difficult time with the following code. I'm releasing mutableDict (commented in the code below) and it's causing detrimental behavior in my code. If I let the memory leak, it works as expected, but that's clearly not...

Tricks to debugging UITextField

I'm debugging some code and finding it difficult to see & track the values being entered by the iPhone's keyboard into a UITextField (and from the UIDatePicker.) I would expect Arguments>self>textField>_text to reflect the value that was entered into the textField but it isn't. It show's a different value ($0.00 instead of $1.25 for ins...

How to display a progress indicator overlay/HUD on iPhone?

I want to display a progress indicator in a semi-transparent box that floats over a table view. In other words, when the table contents are being downloaded, I want an "Updating" label to appear over it. I have seen this in several apps in the store, notably Facebook (when you shake to reload) and Darkslide. My first impulse is to cre...

Struggling with currency in Cocoa.

I'm trying to do something I'd think would be fairly simple: Let a user input a dollar amount, store that amount in an NSNumber (NSDecimalNumber?), then display that amount formatted as currency again at some later time. My trouble is not so much with the setNumberStyle:NSNumberFormatterCurrencyStyle and displaying floats as currency. ...

How to use NSScanner?

Hi, I've just read Apple's docu of NSScanner. I'm trying to get the integer of that string: @"user logged (3 attempts)". I can't find any example, how to scan within parentheses. Any ideas? Here's the code: NSString *logString = @"user logged (3 attempts)"; NSScanner *aScanner = [NSScanner scannerWithString:logString]; [aScanner sca...

Why am I having trouble with a deep copy in Objective C?

I'm assuming my understanding of how to perform a deep copy isn't just there yet. The same with some sub-optimal memory handling that I'm performing down below. This code below probably depicts a shallow copy, and I believe that's where my problem might be. I have some cookie-cutter code for an example that looks like the following: NSA...

How expensive is UITableView's reloadData?

I'm curious just how expensive in as far as resources go is UITableView's reloadData? I have an app which will make roughly 10 subsequent HTTP requests, and as it gets data / preps, it reloads the tableView. As the data set grows larger and larger, it's becoming very sluggish. I'm trying to figure out if it's because of the amount of tim...

How to prevent UIView's drawRect from clearing out the paths drawn by previous drawRect calls?

Everytime UIView's drawRect is called, the content drawn by previous drawRect (using Core Graphics) is cleared out. How can I make it so that the paths rendered from previous drawRect calls stay until I explicitly clear it? ...

Does it make sense to first learn Cocoa for Leopard and then Cocoa Touch for iPhone?

Actually I don't care too much about Mac OS X development. I want to do only iPod Touch and iPhone development. But anyways, I started learning Cocoa and Objective-C. But it seems like there are many differences between Cocoa and Cocoa Touch, so I am wondering if I am actually wasting my time. Should I just jump directly into iPhone topi...

Is NSTimer auto retained?

I have a -(void)save method that is called when a user clicks a navigation bar button. In that method is the following NSTimer: [NSTimer scheduledTimerWithTimeInterval:.25f target:self selector:@selector(flashBackgroundRed) userInfo: nil repeats: flashRepeat]; The timer repeats 4 times since the flashBackgroundRed keeps a count and s...

CFReadStreamHasBytesAvailable polling - best practices

I'm currently polling my CFReadStream for new data with CFReadStreamHasBytesAvailable. (First, some background: I'm doing my own threading and I don't want/need to mess with runloop stuff, so the client callback stuff doesn't really apply here). My question is: what are accepted practices for polling? Apple's documentation on the subj...

Does Core Data exist on the iPhone? Or how would you save Data on the iPhone?

Lets say I make an App that enables users to make short notes and write things down. Is there Core Data on iPhone OS too? Or how else would you save that data in iPhone? ...

removing some view from a view controller

Hi, I want to remove the current subview (added atIndex:0) from my root view controller and insert a new view in its place. Currently I can only find code snippets that show unloading a view using removeFromSuperView, which requires you to know what viewcontrollers view is currently loaded. The only other thing to note is that I have ...

How to reload UITableView when empty?

Calling [self.tableView reloadData] works fine when adding a new row or deleting one. When deleting all rows and wanting to see an empty table, reloadData has no affect. All of the phantom rows are still there until the app is relunched. I'm doing this on the RootViewController, which is a UITableViewController. Is there another way ...

Should I save strings returned by NSLocalizedString()?

I'm working on an iPhone app that we're localizing in both English and Japanese for our initial release. We frequently call NSLocalizedString() to load the appropriate localized string for display. Is it generally better to save the localized strings in instance variables for the next time we need them, or am I micro-optimizing here an...

conceptual or technical problem with Cocoa programming

I find myself in need of access to a viewcontroller from its view. Here is the method -(void)changePageView:(UIViewController*)newviewcont withtransitiontype:(int)t andtransitionspeed:(int)s { //Remove whatever view is currently loaded at index 0, this index is only to be used by "page" views UIView *oldview = [self.view.subvie...

iPhone Dev: XCode debugger does not stop on breakpoints

I've got XCode 3.1.2 on OS X 10.5.5. I have an iPhone project that builds fine but the debugger will not hit any of the breakpoints I set. I've tried all the standard fixes that I find on the net: I've turned off 'Load Symbols Lazily' in XCode preferences My active config is Debug Optimization level is 0 in build settings I've cleaned ...

How to transform Navigation Bar and Navigation Controller in Landscape mode

Hi I am developing a game in which I am using Landscape mode I have total 4 view. 2 views are properly coming in Landscape mode. But in third view I have UITable and Navigation bar. I can able to rotate table in landscape mode but not able to transform Navigation bar and Navigation controller. Navigation bar and Navigation Controller al...

Aligning UIToolBar items?

I have three UIBarButtonItem created as below. They align left and I'd like to align center so there isn't a gap on the right side. I don't see an align property on UIToolBar. Is there another way to accomplish this? //create some buttons UIBarButtonItem *aboutButton = [[UIBarButtonItem alloc] initWithTitle:@"About" style:UIBarButton...