cocoa-touch

Last indexed cell in UITableView is taking on wrong font

I have the following code which is trivial at first sight. I simply set want to set the font type to "Georgia" with a size of 14 if the cell is from the result of a search or if there is a count of zero in my students array. However, with this particular code cell that's last in my tableView is taking on the font of Georgia with size 14....

Coupling in iPhone API

I've always been baffled about the strange coupling in the iPhone API -- in particular, with the UIViewController, which has hard-coded references to a UITabBarItem, UITabBarController, etc. So, you end up adding a UIViewController to a UITabBarController, which in turn queries the UIViewController as to what should be displayed on the ...

UIView bounds with top bar

When creating a UIView with a navigation bar in interface builder, the top bar takes some space, but the view still has the same size. This mean that the bottom of the view is not visible. Is there a way to get the "visible size" of a UIView? I would like to show a subview at the bottom of the screen, but part of the subview is hidden...

Preserving application state across restarts

I've been trying to preserve the state of my iPhone application by serializing my main UITabBarController using [NSKeyedArchiver archiveRootObject:toFile:], but I'm running into difficulties. First I had a problem with UIImage, since it doesn't implement the NSCoding protocol, but I solved that by making an extension category for UIImag...

Cocoa: Memory management with NSString

When creating a string using the following notation: NSString *foo = @"Bar"; Does one need to release foo? Or is foo autoreleased in this case? ...

Problem using NSURLRequest to POST data to server

i create a NSURLRequest to post my data in the iphone application to a server to proceed the php script, my php script is look like this <?php $name = $_POST['name']; $email = $_POST['email']; $link = mysql_connect("localhost", "fffasfdas","Nfdsafafs") or die ("Unable to connect to database."); mysql_select_db("muradsbi_mydatabase") o...

How to get battery status?

Hello, How do I get the battery status on an iPhone? Regards, Devara Gudda ...

Setting the iPhone keyboard language

I'd like the iPhone virtual keyboard to appear pre-set to a particular language (Russian for example) when the user taps a UITextField. Is there a way to do this in Cocoa code? ...

Safari plug in for iPhone

Hi all, i want to ask if you can use SIMBL and develop a plug-in for iPhone Safari. ...

Cocoa Threadsafe Mutable Collection Access

I'm creating a KVC/KVO-compliant mutable array on one of my objects the recommended way: @interface Factory { NSMutableArray *widgets; } - (NSArray *)widgets; - (void)insertObject:(id)obj inWidgetsAtIndex:(NSUInteger)idx; - (void)removeObjectFromWidgetsAtIndex:(NSUInteger)idx; @end Clearly this is a tricky thread-safety issue. In ...

How to deal with low memory warnings on the iPhone?

I'm having problems with my application receiving low memory warnings while the user is deep within a navigation controller stack of views. After the user browses through a bunch of hierarchical options in subsequent UITableViews, he can open a PDF document in a UIWebView (in a different view controller). Everything works fine, the PDF ...

Inserting and deleting UITableViewCell at the same time not working

Hiya, I'm having quite a bit of pain inserting and deleting UITableViewCells from the same UITableView! I don't normally post code, but I thought this was the best way of showing where I'm having the problem: - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView { return 5; } - (NSInteger)tableView:(UITableView *)t...

Managing multiple asynchronous NSURLConnection connections

Hey folks, I have a ton of repeating code in my class that looks like the following: NSURLConnection *connection = [[NSURLConnection alloc] initWithRequest:request delegate:self]; The problem with asynchronous requests is when you have various requests going off, and you h...

NSURLConnection and handling response code and response data

I have an odd edge case right now in that a response code from an NSURLConnection delegate method: - (void)connection:(NSURLConnection *)connection didReceiveResponse:(NSURLResponse *)response; Is triggered before the subsequent delegate method: - (void)connection:(NSURLConnection *)connection didReceiveData:(NSData *)data; My code...

Threadsafe UITableView

I'm using a UITableView to show some data from an array. This array can be changed at any time by other threads. (I believe that whether the array is mutable, or just replaced entirely, doesn't make a difference.) Access to the array itself is threadsafe. What's the proper way to ensure thread safety with regard to the tableview? I'm wo...

Adding a UILabel to a UIToolbar

I'm trying to add a label to my toolbar. Button works great, however when I add the label object, it crashes. Any ideas? UIBarButtonItem *setDateRangeButton = [[UIBarButtonItem alloc] initWithTitle:@"Set date range" style:UIBarButtonItemStyleBordered ...

Polyphonic sound playback

I need audio playback with these features: good performance (for game), pitch control, and ability to layer the same sample multiple times at the same time (polyphony). What would be a quick way to get this on the iphone sdk? Here's what I found out so far: There's no available libraries or sample code that does this, please show me ...

How do I get the UIPickerView to slide up over another view?

I am looking for a way to slide a UIPickerView (and UIDatePickerView) up over a view (UITableView in particular) when a particular button press takes place. I understand how to get the events for clicks into the UITableView, but there doesn't seem to be a good way to have the UIPickerView slide up on top of it... All the examples I hav...

How do I launch my settings bundle from my application?

I am working on adding in a settings bundle for my application as a cheap way of getting a GUI on my preferences. Is it possible to launch this from a button in my application or will my users always have to access it manually via the built in settings application? ...

"Slider" type label as seen on Facebook and AP Mobile News

Please pardon my lack of Photoshop skills, but I'm curious what type of strategy Apps like Facebook and AP Mobile News are using for the 'label slider' in their applications. Here's a quick snippet outlining what I'm talking about as I'm sure the name I'm labeling the utility as is being butchered: http://dl-client.getdropbox.com/u/57676...