Cocoa
UITextView with Rounded Corners and Colored Border
In a previous post, Add Rounded Corners and Border to UIWebview, I wrote a few lines of code to add rounded corners and a border color to a webview. A few people have inquired if this is also possible on a UITextView, the answer is yes, and it’s equally as easy to code. The image [...]
Obfuscate / Encrypt a String (NSString)
Apple Keychain Services offer a secure means to store sensitive information. Through the keychain, all the hardwork is managed for you to store and retrieve content. As powerful as the keychain services are, I was recently tinkering with some code to see if I could obfuscate content within an application. I had a few strings [...]
Truncate a String and Append an Ellipsis, Respecting the Font Size
A number of the UI related controls will automatically truncate and append ellipsis with no effort required on your part. For example, with UILabel you can specify the linebreak mode to indicate how you would like the system to manage wrapping and truncating the label text. However, they are times when having a method to [...]
NSNotification, UserInfo and Object Methods
When working with an NSNotification object, you’ll want to familiarize yourself the userInfo dictionary, which provides access to any additional objects that may be of interest to the receiver. Understanding the object method may also be helpful if you are using the same notification on more than one object.
Add Rounded Corners and Border to UIWebview
Beyond simply displaying websites, UIWebview can be a nice alternative when you need to display formatted text, not to mention the option of incorporating JavaScript which presents some very interesting scripting and UI opportunities. I’ve found webviews handy for presenting help information, displaying HTML downloaded from remote servers as well as integrating custom ad banners [...]
Formatting Numbers – NSNumberFormatter Examples
The previous post on how to Get Total and Free Space on the Mounted File System is a good segue to this post, as the formatting of the output from the previous code example left a little to be desired, see the figure below. Without delimiters to mark off thousands, it’s a little difficult to [...]
Overriding NSObject Description Method
No doubt NSLog is your friend, I use it frequently to print messages to the console during development. Actually, I use a variation of the NSLog that prints messages to the console sans date, time and object information, you can read about my approach here: Yet Another Debug Output (NSLog Replacement) In this tip I’ll [...]
Storing CGPoint, CGSize and CGRect in Collections with NSValue
In an earlier post CGRect, CGSize and CGPoint Functions I demonstrated a number of geometry structures available for representing a point (CGPoint – x and y coordinates), size (CGSize – height and width) and rectangles (CGRect – combination of both). Unfortunately, you cannot directly store any of the above in a collection, for example an [...]
Get Application Icon Name
In a previous post, Get Application Name, I wrote a line of code to get the application name from the app bundle. The line of code below is a slight modification that shows how to get the name that will appear on the iPhone below the icon: [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleDisplayName"]; The CFBundleDisplayName value corresponds [...]


