Tag: cocoa touch

Get a PDF/PNG as output from a UIWebView or UIView

Is there any way to get the content of a UIWebView and convert it to a PDF or PNG file? I’d like to get similar output to that available on the Mac by selecting the PDF button when printing from Safari, for example. I’m assuming this isn’t possible/built in yet, but hopefully I’ll be surprised […]

Where's the iPhone MIME type database?

I have a program for the iPhone that is supposed to be doing intelligent things (picking out appropriate icons for file types) given a list of filenames. I’m looking for the iPhone take on something like /etc/mime.types or something similar- an API call is what I’m assuming would be available for the phone. Does this […]

Multiple value enum in Obj-C

In the Cocoa and Cocoa Touch frameworks, enums are used as constant. I understand how to use it except in one case, the case you can pass as a parameter multiple value with the | operator. Like in : pageControl.autoresizingMask = (UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleTopMargin); The enum is declared like that: enum { UIViewAutoresizingNone = 0, […]

Styling the cancel button in a UISearchBar

I have a UISearchBar that has a cancel button (it’s displayed using -(void)setShowsCancelButton:animated). I’ve changed the tintColor of the search bar like this in an attempt to get a grayish searchbar: UISearchBar *searchBar = [[UISearchBar alloc] initWithFrame:CGRectMake(0, 0, 320, 40)]; searchBar.tintColor = [UIColor colorWithWhite:0.8 alpha:1.0]; This is what it looks like now – notice how […]

Can you do custom animations for UITableView Cell Inserts?

I’ve got a UITableView that is being populated by an NSFetchedResultsController. On the initial load of the table I would like the Cells to be animated in but I would like to do a little bit more custom animation than [tableView insertRowsAtIndexPaths:withRowAnimation:]; Allows. Specifically I would like to slow down the animations and have them […]

Round double value to 2 decimal places

I have a double value as 22.368511 I want to round it to 2 decimal places. i.e. it should return 22.37 How can I do that?

iOS 5: Curious about UIAppearance

On the tech talk 2011 I saw a speech about the new UIAppearance protocol. There is not a lot of documentation out there yet. I will shortly summarize what I remember to explain where my question is coming from: About UIAppearance: So far you had to customize EVERY navigation bar (toolbar, etc.) property in all […]

How to reload and animate just one UITableView cell/row?

how can I reload and animate just one cell/row ? Right now i download some files. Everytime a file finished downloading, i call it’s finished delegate and call [tableview reload]. But then the whole table reloads. And how can i animate the table, so that it doesn’t blink in. For example a fade effect or […]

How to check for local Wi-Fi (not just cellular connection) using iPhone SDK?

I’m currently using the following to check whether Wi-Fi is available for my application: #import <SystemConfiguration/SystemConfiguration.h> static inline BOOL addressReachable(const struct sockaddr_in *hostAddress); BOOL localWiFiAvailable() { struct sockaddr_in localWifiAddress; bzero(&localWifiAddress, sizeof(localWifiAddress)); localWifiAddress.sin_len = sizeof(localWifiAddress); localWifiAddress.sin_family = AF_INET; // IN_LINKLOCALNETNUM is defined in <netinet/in.h> as localWifiAddress.sin_addr.s_addr = htonl(IN_LINKLOCALNETNUM); return addressReachable(&localWifiAddress); } static inline BOOL addressReachable(const […]

Properties and Instance Variables in Objective-C

I’m rather confused about properties and instance variables in Objective-C. I’m about half-way through Aaron Hillegass’s “Cocoa Programming for Mac OS X” and everything is logical. You would declare a class something like this: @class Something; @interface MyClass : NSObject { NSString *name; NSArray *items; Something *something; IBOutlet NSTextField *myTextField; } @property (nonatomic, retain) NSString […]