<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:georss='http://www.georss.org/georss' xmlns:gd='http://schemas.google.com/g/2005' xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-7756992915224554856</id><updated>2012-02-16T15:32:37.228-05:00</updated><category term='Numeric'/><category term='NSDayCalendarUnit'/><category term='expand'/><category term='web request'/><category term='asynchronous'/><category term='hex'/><category term='NSDate'/><category term='custom button'/><category term='NSMonthCalendarUnit'/><category term='gray'/><category term='alignment'/><category term='NSURL'/><category term='linker error'/><category term='shrink'/><category term='NSScanner'/><category term='NSDateComponents'/><category term='UIViewController'/><category term='NSNotification'/><category term='horizontal'/><category term='UIPickerView'/><category term='UIImage'/><category term='background'/><category term='macro'/><category term='UIColor'/><category term='programmatically'/><category term='NSCalendar'/><category term='uiview'/><category term='UILabel'/><category term='UITextField'/><category term='UINavigationController'/><category term='dynamic size'/><category term='NSGregorianCalendar'/><category term='loadView'/><category term='UIButton'/><category term='UINavigationBar'/><category term='vertical'/><category term='UITextFieldDelegate'/><category term='UIPickerViewDelegate'/><category term='arc4random'/><category term='random number'/><category term='rgb'/><category term='number pad'/><category term='categories'/><category term='NSLog'/><category term='UITableView'/><category term='scroll'/><category term='iPad'/><category term='disable'/><category term='NSURLConnection'/><category term='error'/><category term='prevent'/><title type='text'>Cocoa-Matic</title><subtitle type='html'>The goal is to build up a useful repository of objective-c code focusing on iOS implementations.  Feel free to use what you need and, of course, suggest better, more efficient approaches.</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://cocoamatic.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7756992915224554856/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://cocoamatic.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>tk</name><uri>http://www.blogger.com/profile/06390051897876600373</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>17</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-7756992915224554856.post-2143928231513703776</id><published>2012-01-12T13:04:00.001-05:00</published><updated>2012-01-12T13:08:29.163-05:00</updated><title type='text'>SQLite import from .csv file</title><content type='html'>Here are the quick and easy steps to import the contents of a .csv file into your SQLite3 database.&lt;br /&gt;&lt;br /&gt;Open the db via the command line:&lt;br /&gt;&lt;pre class="brush: cocoa"&gt;sqlite3 myDatabaseName&lt;/pre&gt;&lt;br /&gt;Enter the following commands:&lt;br /&gt;&lt;pre class="brush: cocoa"&gt;.separator ","&lt;br /&gt;.import myFile.csv tblMyTable&lt;/pre&gt;&lt;br /&gt;&lt;div&gt;&lt;br /&gt;And that's it. &amp;nbsp;If your .csv file has a different separator character, just replace the comma with your character.&lt;/div&gt;&lt;ol&gt;&lt;/ol&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7756992915224554856-2143928231513703776?l=cocoamatic.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://cocoamatic.blogspot.com/feeds/2143928231513703776/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://cocoamatic.blogspot.com/2012/01/sqlite-import-from-csv-file.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7756992915224554856/posts/default/2143928231513703776'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7756992915224554856/posts/default/2143928231513703776'/><link rel='alternate' type='text/html' href='http://cocoamatic.blogspot.com/2012/01/sqlite-import-from-csv-file.html' title='SQLite import from .csv file'/><author><name>tk</name><uri>http://www.blogger.com/profile/06390051897876600373</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7756992915224554856.post-663792304158484478</id><published>2011-01-26T17:28:00.000-05:00</published><updated>2011-01-26T17:28:14.889-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='linker error'/><category scheme='http://www.blogger.com/atom/ns#' term='error'/><title type='text'>XCode Linker error: Symbol(s) not found</title><content type='html'>Came across a weird error today:&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;Objc-class-ref-to-[ClassName] in MainController.o&lt;br /&gt;Symbol(s) not found&lt;br /&gt;Collect2: Id returned 1 exit status&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;For some reason the reference to the class in question is not listed under Compile Sources.  Thankfully, it's an easy fix.&lt;br /&gt;&lt;br /&gt;1. Under Groups &amp; Files, expand Targets&lt;br /&gt;2. Expand the compile target&lt;br /&gt;3. Expand Compile Sources (xx)&lt;br /&gt;4. Check to see if all of your .m files are listed.  If not, drag the missing files in.  &lt;br /&gt;5. Recompile and run.&lt;br /&gt;&lt;br /&gt;So, not sure why this happens, but luckily there's an easy fix.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7756992915224554856-663792304158484478?l=cocoamatic.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://cocoamatic.blogspot.com/feeds/663792304158484478/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://cocoamatic.blogspot.com/2011/01/xcode-linker-error-symbols-not-found.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7756992915224554856/posts/default/663792304158484478'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7756992915224554856/posts/default/663792304158484478'/><link rel='alternate' type='text/html' href='http://cocoamatic.blogspot.com/2011/01/xcode-linker-error-symbols-not-found.html' title='XCode Linker error: Symbol(s) not found'/><author><name>tk</name><uri>http://www.blogger.com/profile/06390051897876600373</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7756992915224554856.post-6353489870314150829</id><published>2011-01-26T15:24:00.000-05:00</published><updated>2011-01-26T15:24:51.707-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='vertical'/><category scheme='http://www.blogger.com/atom/ns#' term='horizontal'/><category scheme='http://www.blogger.com/atom/ns#' term='UITextField'/><category scheme='http://www.blogger.com/atom/ns#' term='alignment'/><title type='text'>UITextField horizontal and vertical alignment</title><content type='html'>Horizontal alignment in a UITextField was quick and easy to find:&lt;br /&gt;&lt;pre class="brush: cocoa"&gt;myTextField.textAlignment = UITextAlignmentLeft;&lt;br /&gt;myTextField.textAlignment = UITextAlignmentCenter;&lt;br /&gt;myTextField.textAlignment = UITextAlignmentRight;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;Vertical alignment in a UITextField is equally as easy, just a little harder to find:&lt;br /&gt;&lt;pre class="brush: cocoa"&gt;myTextField.contentVerticalAlignment = UIControlContentVerticalAlignmentCenter;&lt;br /&gt;myTextField.contentVerticalAlignment = UIControlContentVerticalAlignmentTop;&lt;br /&gt;myTextField.contentVerticalAlignment = UIControlContentVerticalAlignmentBottom;&lt;br /&gt;myTextField.contentVerticalAlignment = UIControlContentVerticalAlignmentFill;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;Enjoy!&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7756992915224554856-6353489870314150829?l=cocoamatic.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://cocoamatic.blogspot.com/feeds/6353489870314150829/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://cocoamatic.blogspot.com/2011/01/uitextfield-horizontal-and-vertical.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7756992915224554856/posts/default/6353489870314150829'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7756992915224554856/posts/default/6353489870314150829'/><link rel='alternate' type='text/html' href='http://cocoamatic.blogspot.com/2011/01/uitextfield-horizontal-and-vertical.html' title='UITextField horizontal and vertical alignment'/><author><name>tk</name><uri>http://www.blogger.com/profile/06390051897876600373</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7756992915224554856.post-3054156180727899730</id><published>2011-01-12T17:04:00.003-05:00</published><updated>2011-01-12T17:11:59.120-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='UIImage'/><category scheme='http://www.blogger.com/atom/ns#' term='UINavigationController'/><category scheme='http://www.blogger.com/atom/ns#' term='categories'/><category scheme='http://www.blogger.com/atom/ns#' term='UINavigationBar'/><title type='text'>Replace UINavigationBar background with image</title><content type='html'>Sometimes you want to show off some creativity in your apps.  One of the easiest ways to do that is by changing the look of the UINavigationBar.  Modifying the color is one way and is a trivial task in Interface Builder.  What about replacing it entirely with an image?  Turns out that's not too difficult either.  Here's how...&lt;br /&gt;&lt;br /&gt;We're going to use Categories.  What are Categories?&lt;br /&gt;&lt;i&gt;&lt;b&gt;From &lt;a href="http://cocoadevcentral.com/d/learn_objectivec/" target="_new"&gt;CocoaDevCentral.com&lt;/a&gt;: &lt;/b&gt;Categories are one of the most useful features of Objective-C. Essentially, a category allows you to add methods to an existing class without subclassing it or needing to know any of the details of how it's implemented.&lt;br /&gt;&lt;br /&gt;This is particularly useful because you can add methods to built-in objects. If you want to add a method to all instances of NSString in your application, you just add a category. There's no need to get everything to use a custom subclass. &lt;/i&gt;&lt;br /&gt;&lt;br /&gt;&lt;a name='more'&gt;&lt;/a&gt;&lt;br /&gt;&lt;h3&gt;Step 1&lt;/h3&gt;Create a new "Objective-C class" file. I named mine: UINavigationBar-Utility.&lt;br /&gt;&lt;br /&gt;&lt;h3&gt;Step 2&lt;/h3&gt;The header (.h) file should read as follows:&lt;br /&gt;&lt;pre class="brush: cocoa"&gt;@interface UINavigationBar (Utility)&lt;br /&gt;&lt;br /&gt;- (void)drawRect:(CGRect)rect;&lt;br /&gt;&lt;br /&gt;@end&lt;br /&gt;&lt;/pre&gt;*The word "Utility" in parentheses can be any word you choose.&lt;br /&gt;&lt;br /&gt;&lt;h3&gt;Step 3&lt;/h3&gt;The class (.m) file should read as follows:&lt;br /&gt;&lt;pre class="brush: cocoa"&gt;@implementation UINavigationBar (Utility)&lt;br /&gt;&lt;br /&gt;- (void)drawRect:(CGRect)rect {&lt;br /&gt;     UIImage *imgPortrait = [UIImage imageNamed: @"navbar768_1.png"];&lt;br /&gt;     UIImage *imgLandscape = [UIImage imageNamed: @"navbar1024_1.png"]; &lt;br /&gt;     if (imgPortrait != NULL &amp;&amp; imgLandscape != NULL) {&lt;br /&gt;          if(self.frame.size.width == 1024) {&lt;br /&gt;               [imgLandscape drawInRect:CGRectMake(0, 0, self.frame.size.width, self.frame.size.height)];&lt;br /&gt;          } else {&lt;br /&gt;               [imgPortrait drawInRect:CGRectMake(0, 0, self.frame.size.width, self.frame.size.height)];&lt;br /&gt;          }&lt;br /&gt;     } else {&lt;br /&gt;          // Draw UINavigation bar yourself&lt;br /&gt;          CGContextRef context = UIGraphicsGetCurrentContext();&lt;br /&gt;          UIColor *color = [UIColor blueColor];&lt;br /&gt;          CGContextSetFillColor(context, CGColorGetComponents([color CGColor]));&lt;br /&gt;          CGContextFillRect(context, rect);&lt;br /&gt;          self.tintColor = color;&lt;br /&gt;     }&lt;br /&gt;}&lt;br /&gt;@end&lt;br /&gt;&lt;/pre&gt;Basically, we override UINavigationBar's drawRect function.  The first part attempts to set a background image, if available.  (It also provides a separate image for portrait and landscape modes, which is what the nested if/else accomplishes.)  If the images don't exist, we provide the else to simply color the bar blue.&lt;br /&gt;&lt;br /&gt;So, there it is.  Pretty simple to add some interesting customization to your app.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7756992915224554856-3054156180727899730?l=cocoamatic.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://cocoamatic.blogspot.com/feeds/3054156180727899730/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://cocoamatic.blogspot.com/2011/01/replace-uinavigationbar-background-with.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7756992915224554856/posts/default/3054156180727899730'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7756992915224554856/posts/default/3054156180727899730'/><link rel='alternate' type='text/html' href='http://cocoamatic.blogspot.com/2011/01/replace-uinavigationbar-background-with.html' title='Replace UINavigationBar background with image'/><author><name>tk</name><uri>http://www.blogger.com/profile/06390051897876600373</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7756992915224554856.post-7094043142350228715</id><published>2010-09-01T17:05:00.001-04:00</published><updated>2010-09-01T17:06:06.592-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='NSCalendar'/><category scheme='http://www.blogger.com/atom/ns#' term='NSDayCalendarUnit'/><category scheme='http://www.blogger.com/atom/ns#' term='NSMonthCalendarUnit'/><category scheme='http://www.blogger.com/atom/ns#' term='NSDate'/><category scheme='http://www.blogger.com/atom/ns#' term='NSDateComponents'/><category scheme='http://www.blogger.com/atom/ns#' term='NSGregorianCalendar'/><title type='text'>NSDate number of days between two dates</title><content type='html'>Date objects in programming are typically both extremely common and notoriously tricky due to the many different syntaxes involved.  These rules apply to iPhone development.  In one application I created, I needed the number of days between 2 dates in several instances.  As there is no simple NSDate2 - NSDate1 function built-in to return the number of days apart, I wrote a function to accomplish the task.  Here it is...&lt;br /&gt;&lt;a name='more'&gt;&lt;/a&gt;&lt;br /&gt;&lt;pre class="brush: cocoa"&gt;- (int)daysBetweenDates:(NSDate *)dt1:(NSDate *)dt2 {&lt;br /&gt; int numDays;&lt;br /&gt; NSCalendar *gregorian = [[NSCalendar alloc] initWithCalendarIdentifier:NSGregorianCalendar];&lt;br /&gt; NSUInteger unitFlags = NSMonthCalendarUnit | NSDayCalendarUnit;&lt;br /&gt; NSDateComponents *components = [gregorian components:unitFlags fromDate:dt1 toDate:dt2 options:0];&lt;br /&gt; numDays = [components day];&lt;br /&gt; [gregorian release];&lt;br /&gt; return numDays;&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;Line 3: I first get a reference to the calendar.  (The date objects don't mean much with a calendar reference.)&lt;br /&gt;&lt;br /&gt;Line 4: I set the flags of the date parts that I care about for this task.  (Note, in this case I don't use NSMonthCalendarUnit, but show it as an example of how to declare multiple flags.)&lt;br /&gt;&lt;br /&gt;Line 5: This does the work of determining how many units (days, months, whatever is chosen on Line 4) separate the two dates.&lt;br /&gt;&lt;br /&gt;Line 6: Get the component I'm looking for--days in this case.&lt;br /&gt;&lt;br /&gt;Hope you'll find this to be a useful addition to your Cocoa toolbox.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7756992915224554856-7094043142350228715?l=cocoamatic.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://cocoamatic.blogspot.com/feeds/7094043142350228715/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://cocoamatic.blogspot.com/2010/09/nsdate-number-of-days-between-two-dates.html#comment-form' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7756992915224554856/posts/default/7094043142350228715'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7756992915224554856/posts/default/7094043142350228715'/><link rel='alternate' type='text/html' href='http://cocoamatic.blogspot.com/2010/09/nsdate-number-of-days-between-two-dates.html' title='NSDate number of days between two dates'/><author><name>tk</name><uri>http://www.blogger.com/profile/06390051897876600373</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7756992915224554856.post-3053917171929291347</id><published>2010-08-20T00:47:00.003-04:00</published><updated>2010-08-20T00:59:19.603-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='programmatically'/><category scheme='http://www.blogger.com/atom/ns#' term='UIPickerViewDelegate'/><category scheme='http://www.blogger.com/atom/ns#' term='UIPickerView'/><title type='text'>Create UIPickerView programmatically</title><content type='html'>The UIPickerView is one of the input controls in iOS for displaying and selecting a list of data.  Most tutorials implement this control in Interface Builder, which is fine, but I like to have more control and do most everything in code.  There are several components to doing this 100% programmatically, which I will demonstrate below...&lt;br /&gt;&lt;br /&gt;The first thing we have to do is include the &lt;b&gt;UIPickerViewDelegate&lt;/b&gt; in the interface of our class .h file.&lt;br /&gt;&lt;pre class="brush: cocoa"&gt;@interface myViewController : UIViewController&amp;lt;UIPickerViewDelegate&amp;gt;&lt;br /&gt;&lt;/pre&gt;&lt;a name='more'&gt;&lt;/a&gt;&lt;br /&gt;Next, actually create the UIPickerView by setting the frame, setting the delegate, making the selection highlight visible and adding it to the main view.&lt;br /&gt;&lt;pre class="brush: cocoa"&gt;UIPickerView *myPickerView = [[UIPickerView alloc] initWithFrame:CGRectMake(0, 200, 320, 200)];&lt;br /&gt;myPickerView.delegate = self;&lt;br /&gt;myPickerView.showsSelectionIndicator = YES;&lt;br /&gt;[self.view addSubview:myPickerView];&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;Finally, we have to implement the delegate methods to control the look and functionality.&lt;br /&gt;&lt;pre class="brush: cocoa"&gt;- (void)pickerView:(UIPickerView *)pickerView didSelectRow: (NSInteger)row inComponent:(NSInteger)component {&lt;br /&gt;    // Handle the selection&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;// tell the picker how many rows are available for a given component&lt;br /&gt;- (NSInteger)pickerView:(UIPickerView *)pickerView numberOfRowsInComponent:(NSInteger)component {&lt;br /&gt;    NSUInteger numRows = 5;&lt;br /&gt;&lt;br /&gt;    return numRows;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;// tell the picker how many components it will have&lt;br /&gt;- (NSInteger)numberOfComponentsInPickerView:(UIPickerView *)pickerView {&lt;br /&gt; return 1;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;// tell the picker the title for a given component&lt;br /&gt;- (NSString *)pickerView:(UIPickerView *)pickerView titleForRow:(NSInteger)row forComponent:(NSInteger)component {&lt;br /&gt;    NSString *title;&lt;br /&gt;    title = [@"" stringByAppendingFormat:@"%d",row];&lt;br /&gt;&lt;br /&gt;    return title;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;// tell the picker the width of each row for a given component&lt;br /&gt;- (CGFloat)pickerView:(UIPickerView *)pickerView widthForComponent:(NSInteger)component {&lt;br /&gt; int sectionWidth = 300;&lt;br /&gt;&lt;br /&gt; return sectionWidth;&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7756992915224554856-3053917171929291347?l=cocoamatic.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://cocoamatic.blogspot.com/feeds/3053917171929291347/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://cocoamatic.blogspot.com/2010/08/create-uipickerview-programmatically.html#comment-form' title='4 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7756992915224554856/posts/default/3053917171929291347'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7756992915224554856/posts/default/3053917171929291347'/><link rel='alternate' type='text/html' href='http://cocoamatic.blogspot.com/2010/08/create-uipickerview-programmatically.html' title='Create UIPickerView programmatically'/><author><name>tk</name><uri>http://www.blogger.com/profile/06390051897876600373</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>4</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7756992915224554856.post-2388096274687428620</id><published>2010-08-18T15:23:00.000-04:00</published><updated>2010-08-18T15:23:23.753-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='scroll'/><category scheme='http://www.blogger.com/atom/ns#' term='prevent'/><category scheme='http://www.blogger.com/atom/ns#' term='UITableView'/><category scheme='http://www.blogger.com/atom/ns#' term='disable'/><title type='text'>Prevent UITableView from scrolling</title><content type='html'>Quick tip:&lt;br/&gt;&lt;br /&gt;UITableView elements enable vertical scrolling by default.  The following code disables the scroll:&lt;br /&gt;&lt;pre class="brush: cocoa"&gt;myTableView.scrollEnabled = NO;&lt;br /&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7756992915224554856-2388096274687428620?l=cocoamatic.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://cocoamatic.blogspot.com/feeds/2388096274687428620/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://cocoamatic.blogspot.com/2010/08/prevent-uitableview-from-scrolling.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7756992915224554856/posts/default/2388096274687428620'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7756992915224554856/posts/default/2388096274687428620'/><link rel='alternate' type='text/html' href='http://cocoamatic.blogspot.com/2010/08/prevent-uitableview-from-scrolling.html' title='Prevent UITableView from scrolling'/><author><name>tk</name><uri>http://www.blogger.com/profile/06390051897876600373</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7756992915224554856.post-3660810251705729861</id><published>2010-08-17T11:25:00.002-04:00</published><updated>2010-08-17T11:27:43.100-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='random number'/><category scheme='http://www.blogger.com/atom/ns#' term='arc4random'/><title type='text'>Random Number in Cocoa and Objective-c</title><content type='html'>Generating a random number is fairly simple using &lt;i&gt;arc4random()&lt;/i&gt;.  Say you want a random integer between 10 (min) and 1000 (max).  Here's how to do it:&lt;br /&gt;&lt;br /&gt;&lt;pre class="brush: cocoa"&gt;int max = 1000;&lt;br /&gt;int min = 10;&lt;br /&gt;int value = (arc4random() % max) + min;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;Also, no need to do any seeding with this method.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7756992915224554856-3660810251705729861?l=cocoamatic.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://cocoamatic.blogspot.com/feeds/3660810251705729861/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://cocoamatic.blogspot.com/2010/08/random-number-in-cocoaobjective-c.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7756992915224554856/posts/default/3660810251705729861'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7756992915224554856/posts/default/3660810251705729861'/><link rel='alternate' type='text/html' href='http://cocoamatic.blogspot.com/2010/08/random-number-in-cocoaobjective-c.html' title='Random Number in Cocoa and Objective-c'/><author><name>tk</name><uri>http://www.blogger.com/profile/06390051897876600373</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7756992915224554856.post-3660505929050772912</id><published>2010-08-13T13:50:00.002-04:00</published><updated>2010-08-16T13:28:14.675-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='iPad'/><category scheme='http://www.blogger.com/atom/ns#' term='UITableView'/><category scheme='http://www.blogger.com/atom/ns#' term='background'/><category scheme='http://www.blogger.com/atom/ns#' term='gray'/><title type='text'>Unwanted UITableView gray background on iPad</title><content type='html'>I came across something weird when developing an iPad app.  I have a UITableView that does not encompass the entire screen and I have it set to grouping mode so it has nice looking rounded corners.  For some reason when this is displayed, the background of the UITableView is light gray.  It seems to be ignoring the &lt;i&gt;backgroundColor&lt;/i&gt; property.  &lt;br /&gt;&lt;br /&gt;So, here's the fix:&lt;br /&gt;&lt;a name='more'&gt;&lt;/a&gt;&lt;br /&gt;Set the &lt;i&gt;backgroundView&lt;/i&gt; to nil.&lt;br /&gt;&lt;pre class="brush: cocoa"&gt;if ([self.tableView respondsToSelector:@selector(backgroundView)]) {&lt;br /&gt;     self.tableView.backgroundView = nil;&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;Note, it's always a good idea to make sure the object responds to the selector, so that's what the check is all about.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7756992915224554856-3660505929050772912?l=cocoamatic.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://cocoamatic.blogspot.com/feeds/3660505929050772912/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://cocoamatic.blogspot.com/2010/08/unwanted-uitableview-gray-background-on.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7756992915224554856/posts/default/3660505929050772912'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7756992915224554856/posts/default/3660505929050772912'/><link rel='alternate' type='text/html' href='http://cocoamatic.blogspot.com/2010/08/unwanted-uitableview-gray-background-on.html' title='Unwanted UITableView gray background on iPad'/><author><name>tk</name><uri>http://www.blogger.com/profile/06390051897876600373</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7756992915224554856.post-759517761910422324</id><published>2010-08-13T00:31:00.002-04:00</published><updated>2010-08-13T00:34:28.848-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='NSURLConnection'/><category scheme='http://www.blogger.com/atom/ns#' term='NSURL'/><category scheme='http://www.blogger.com/atom/ns#' term='web request'/><category scheme='http://www.blogger.com/atom/ns#' term='asynchronous'/><category scheme='http://www.blogger.com/atom/ns#' term='NSNotification'/><title type='text'>Asynchronous data request class</title><content type='html'>A very handly class I've built is &lt;b&gt;asyncDataRequest&lt;/b&gt;.  This provides for an easy way to make and receive calls to web data feeds.  All you have to do is include the class reference in your .m file, make the request and create a notification responder to receive and parse that data response.&lt;br /&gt;&lt;br /&gt;First, we'll look at &lt;b&gt;asyncDataRequest.h&lt;/b&gt;:&lt;br /&gt;&lt;pre class="brush: cocoa"&gt;@interface asyncDataRequest : NSObject {&lt;br /&gt; NSMutableData *responseData;&lt;br /&gt; id delegate;&lt;br /&gt; NSString *notificationName;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;@property(nonatomic,retain) NSMutableData *responseData;&lt;br /&gt;@property(nonatomic,assign) id delegate;&lt;br /&gt;@property(nonatomic,retain) NSString *notificationName;&lt;br /&gt;&lt;br /&gt;- (void)setDelegate:(id)newDelegate;&lt;br /&gt;- (void)connection:(NSURLConnection *)connection didReceiveResponse: (NSURLResponse *)response;&lt;br /&gt;- (void)connection:(NSURLConnection *)connection didReceiveData:(NSData *)data;&lt;br /&gt;- (void)connection:(NSURLConnection *)connection didFailWithError: (NSError *)error;&lt;br /&gt;- (void)connectionDidFinishLoading: (NSURLConnection *)connection;&lt;br /&gt;&lt;br /&gt;@end&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;a name='more'&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;The code for &lt;b&gt;asyncDataRequest.m&lt;/b&gt; is:&lt;br /&gt;&lt;pre class="brush: cocoa"&gt;#import "asyncDataRequest.h"&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;@implementation asyncDataRequest&lt;br /&gt;@synthesize responseData, delegate, notificationName;&lt;br /&gt;- (id)delegate {&lt;br /&gt; return delegate;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;- (void)setDelegate:(id)newDelegate {&lt;br /&gt; delegate = newDelegate;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;- (void)connection:(NSURLConnection *)connection didReceiveResponse: (NSURLResponse *)response {&lt;br /&gt; [self.responseData setLength:0];&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;- (void)connection:(NSURLConnection *)connection didReceiveData:(NSData *)data {&lt;br /&gt; // Process the downloaded chunk of data.&lt;br /&gt; [self.responseData appendData:data];&lt;br /&gt; spLog(@"data: %i", [self.responseData length]);&lt;br /&gt; &lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;- (void) connectionDidFinishLoading: (NSURLConnection *)connection {&lt;br /&gt; spLog(@"finished");&lt;br /&gt; &lt;br /&gt; NSString *asyncReturn = [[NSString alloc] initWithData:self.responseData encoding:NSUTF8StringEncoding];&lt;br /&gt; if(asyncReturn != NULL) {&lt;br /&gt;  spLog(@"asyncReturn: %@", asyncReturn);&lt;br /&gt;  if([asyncReturn isEqualToString:@"FALSE"] || [asyncReturn hasPrefix:@"ERROR"] || asyncReturn == nil || [[asyncReturn stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]] hasPrefix:@"&amp;lt;"] &amp;&amp; ![[asyncReturn stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]] hasPrefix:@"&amp;lt;form"]) {&lt;br /&gt;   NSMutableDictionary *dict = [[NSMutableDictionary alloc] init];&lt;br /&gt;   [dict setObject:[NSNumber numberWithBool:YES] forKey:@"isError"];&lt;br /&gt;   [dict setObject:[NSString stringWithString:@""] forKey:@"response"];&lt;br /&gt;   [[NSNotificationCenter defaultCenter] postNotificationName:self.notificationName object:self userInfo:dict];&lt;br /&gt;   [dict release];&lt;br /&gt;  } else {&lt;br /&gt;   NSMutableDictionary *dict = [[NSMutableDictionary alloc] init];&lt;br /&gt;   [dict setObject:[NSNumber numberWithBool:NO] forKey:@"isError"];&lt;br /&gt;   [dict setObject:[NSString stringWithString:asyncReturn] forKey:@"response"];&lt;br /&gt;   [[NSNotificationCenter defaultCenter] postNotificationName:self.notificationName object:self userInfo:dict];&lt;br /&gt;   [dict release];&lt;br /&gt;  }&lt;br /&gt; }&lt;br /&gt; [asyncReturn release];&lt;br /&gt; [UIApplication sharedApplication].networkActivityIndicatorVisible = NO;&lt;br /&gt; &lt;br /&gt; NSURLCache *sharedCache = [[NSURLCache alloc] initWithMemoryCapacity:0 diskCapacity:0 diskPath:nil];&lt;br /&gt; [NSURLCache setSharedURLCache:sharedCache];&lt;br /&gt; [sharedCache release];&lt;br /&gt; &lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;- (void) connection:(NSURLConnection *)connection didFailWithError: (NSError *)error {&lt;br /&gt; spLog(@"error");&lt;br /&gt; [UIApplication sharedApplication].networkActivityIndicatorVisible = NO;&lt;br /&gt; NSMutableDictionary *dict = [[NSMutableDictionary alloc] init];&lt;br /&gt; [dict setObject:[NSNumber numberWithBool:YES] forKey:@"isError"];&lt;br /&gt; [dict setObject:[NSString stringWithString:@""] forKey:@"response"];&lt;br /&gt; [[NSNotificationCenter defaultCenter] postNotificationName:self.notificationName object:self userInfo:dict];&lt;br /&gt; [dict release];&lt;br /&gt; &lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;- (void)dealloc {&lt;br /&gt; [self.responseData release];&lt;br /&gt; [self.notificationName release];&lt;br /&gt; [super dealloc];&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;@end&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;In order to implement this method:&lt;br /&gt;&lt;pre class="brush: cocoa"&gt;NSURL *sURL = [[NSURL alloc] initWithString:urlString];&lt;br /&gt;  &lt;br /&gt;NSURLRequest *request = [[NSURLRequest alloc] initWithURL:sURL];&lt;br /&gt;//create delegate instance&lt;br /&gt;asyncDataRequest *adr = [[asyncDataRequest alloc] init];&lt;br /&gt;adr.notificationName = @"ASYNC_RESPONSE_NOTIFICATION";&lt;br /&gt;[adr setDelegate:self];&lt;br /&gt;  &lt;br /&gt;NSURLConnection *connectionADR = [[NSURLConnection alloc] initWithRequest:request delegate:adr];&lt;br /&gt;if(connectionADR) {&lt;br /&gt; adr.responseData = [[NSMutableData data] retain];&lt;br /&gt; [UIApplication sharedApplication].networkActivityIndicatorVisible = YES;&lt;br /&gt;} else {&lt;br /&gt; //connection error&lt;br /&gt; spLog(@"connection error");&lt;br /&gt;}&lt;br /&gt;[connectionADR release];&lt;br /&gt;[adr release];&lt;br /&gt;[sURL release];&lt;br /&gt;[request release];&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;You'll also need a notification handler (since this asynchronous after all).&lt;br /&gt;&lt;pre class="brush: cocoa"&gt;// Add the notification observer in viewDidLoad&lt;br /&gt;[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(returnFromAsyncNotification:) name:@"ASYNC_RESPONSE_NOTIFICATION" object:nil];&lt;br /&gt;&lt;br /&gt;- (void)returnFromAsyncNotification:(NSNotification *)notify {&lt;br /&gt; id ndict = [notify userInfo];&lt;br /&gt; BOOL isError = [[ndict objectForKey:@"isError"] boolValue];&lt;br /&gt; NSString *strResponse = [ndict objectForKey:@"response"];&lt;br /&gt; spLog(@"strResponse: %@", strResponse);&lt;br /&gt; if(isError) {&lt;br /&gt;  // Handle connection error&lt;br /&gt; } else {&lt;br /&gt;  // Do something with returned data string, strResponse&lt;br /&gt; }&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;And there you have it.  Enjoy!&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7756992915224554856-759517761910422324?l=cocoamatic.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://cocoamatic.blogspot.com/feeds/759517761910422324/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://cocoamatic.blogspot.com/2010/08/asynchronous-data-request-class.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7756992915224554856/posts/default/759517761910422324'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7756992915224554856/posts/default/759517761910422324'/><link rel='alternate' type='text/html' href='http://cocoamatic.blogspot.com/2010/08/asynchronous-data-request-class.html' title='Asynchronous data request class'/><author><name>tk</name><uri>http://www.blogger.com/profile/06390051897876600373</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7756992915224554856.post-3078414317148361584</id><published>2010-08-12T14:19:00.000-04:00</published><updated>2010-08-12T14:19:36.376-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='UIImage'/><category scheme='http://www.blogger.com/atom/ns#' term='UIButton'/><category scheme='http://www.blogger.com/atom/ns#' term='custom button'/><title type='text'>UIButton with custom UIImage</title><content type='html'>Most developers want to steer clear of the default buttons provided in Cocoa because they're just not that attractive.  The following code shows how to programmatically create an image button and define an action for when the button is pressed. &lt;br /&gt;&lt;pre class="brush: cocoa"&gt;// Create button and set frame&lt;br /&gt;UIButton *myButton = [[UIButton alloc] initWithFrame:CGRectMake(0, 0, 100, 50)];&lt;br /&gt;// Set button image, in this case "my_image.png"&lt;br /&gt;[myButton setImage:[UIImage imageWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"my_image" ofType:@"png"]] forState:UIControlStateNormal];&lt;br /&gt;// Call buttonWasPressed function when button is touched&lt;br /&gt;[myButton addTarget:self action:@selector(buttonWasPressed) forControlEvents:UIControlEventTouchUpInside];&lt;br /&gt;// Add the button to view&lt;br /&gt;[self.view addSubview:myButton];&lt;br /&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7756992915224554856-3078414317148361584?l=cocoamatic.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://cocoamatic.blogspot.com/feeds/3078414317148361584/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://cocoamatic.blogspot.com/2010/08/uibutton-with-custom-uiimage.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7756992915224554856/posts/default/3078414317148361584'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7756992915224554856/posts/default/3078414317148361584'/><link rel='alternate' type='text/html' href='http://cocoamatic.blogspot.com/2010/08/uibutton-with-custom-uiimage.html' title='UIButton with custom UIImage'/><author><name>tk</name><uri>http://www.blogger.com/profile/06390051897876600373</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7756992915224554856.post-5414367158134657262</id><published>2010-08-05T12:34:00.002-04:00</published><updated>2010-08-05T12:38:20.949-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='dynamic size'/><category scheme='http://www.blogger.com/atom/ns#' term='UILabel'/><category scheme='http://www.blogger.com/atom/ns#' term='expand'/><category scheme='http://www.blogger.com/atom/ns#' term='shrink'/><title type='text'>UILabel dynamic sizing based on string</title><content type='html'>Here's how to create a UILabel that dynamically resizes to fit the NSString that is loaded into it:&lt;br /&gt;&lt;pre class="brush: cocoa"&gt;UILabel *tmpTitleLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, 300, 20)];&lt;br /&gt;self.titleLabel = tmpTitleLabel;&lt;br /&gt;[tmpTitleLabel release];&lt;br /&gt;self.titleLabel.textColor = [UIColor blackColor];&lt;br /&gt;self.titleLabel.font = [UIFont boldSystemFontOfSize:16];&lt;br /&gt;self.titleLabel.numberOfLines = 0;&lt;br /&gt;self.titleLabel.lineBreakMode = UILineBreakModeWordWrap;&lt;br /&gt;self.titleLabel.text = self.myTitleString;&lt;br /&gt; &lt;br /&gt;//Calculate the expected size based on the font and linebreak mode of label&lt;br /&gt;CGSize maximumLabelSize = CGSizeMake(300,9999);&lt;br /&gt;CGSize expectedLabelSize = [self.myTitleString sizeWithFont:self.titleLabel.font constrainedToSize:maximumLabelSize lineBreakMode:self.titleLabel.lineBreakMode];&lt;br /&gt; &lt;br /&gt;//Adjust the label the the new height&lt;br /&gt;CGRect newFrame = self.titleLabel.frame;&lt;br /&gt;newFrame.size.height = expectedLabelSize.height;&lt;br /&gt;self.titleLabel.frame = newFrame;&lt;br /&gt;&lt;/pre&gt;And here's the explanation of what's going on with this code:&lt;br /&gt;&lt;a name='more'&gt;&lt;/a&gt;&lt;br /&gt;Lines 1-3: Declare your UILabel using initWithFrame. At this point the size doesn't matter so use any frame size.&lt;br /&gt;&lt;br /&gt;Lines 4-7: Sets the display properties for the UILabel.&lt;br /&gt;&lt;br /&gt;Line 8: Set the string.  In this case &lt;b&gt;self.myTitleString&lt;/b&gt; is an NSString.&lt;br /&gt;&lt;br /&gt;Line 11: Determine the maximum size for your label.  In this case, I'm constraining to 300px wide, with an unlimited height.&lt;br /&gt;&lt;br /&gt;Line 12: This is what creates the new size based on the string.&lt;br /&gt;&lt;br /&gt;Lines 15-17: Sets the newly calculated frame for self.titleLabel.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7756992915224554856-5414367158134657262?l=cocoamatic.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://cocoamatic.blogspot.com/feeds/5414367158134657262/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://cocoamatic.blogspot.com/2010/08/uilabel-dynamic-sizing-based-on-string.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7756992915224554856/posts/default/5414367158134657262'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7756992915224554856/posts/default/5414367158134657262'/><link rel='alternate' type='text/html' href='http://cocoamatic.blogspot.com/2010/08/uilabel-dynamic-sizing-based-on-string.html' title='UILabel dynamic sizing based on string'/><author><name>tk</name><uri>http://www.blogger.com/profile/06390051897876600373</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7756992915224554856.post-4353077210637245532</id><published>2010-08-04T09:07:00.001-04:00</published><updated>2010-08-04T09:08:29.210-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='NSLog'/><title type='text'>Better NSLog implementation</title><content type='html'>NSLog is an invaluable tool for developers who are looking to debug and/or troubleshoot code.  It outputs to the debugger console during the application runtime.  Before I show a better way to use the NSLog function, let's go over the basics with an example:&lt;br /&gt;&lt;br /&gt;&lt;pre class="brush: cocoa"&gt;int myInt = 100;&lt;br /&gt;NSLog(@"The value of myInt: %i", myInt);&lt;br /&gt;&lt;/pre&gt;This will output: &lt;br /&gt;&lt;i&gt;The value of myInt: 100&lt;/i&gt;&lt;br /&gt;&lt;br /&gt;Depending on what type of value you're trying to print, you'll have to use different Format Specifiers (%i in the previous example). Here's a list of common Format Specifiers:&lt;br /&gt;&lt;a name='more'&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;table&gt;&lt;tr&gt;     &lt;th&gt;Specifier&lt;/th&gt;     &lt;th&gt;Description&lt;/th&gt;   &lt;/tr&gt;&lt;tr&gt;     &lt;td&gt;%@&lt;/td&gt;     &lt;td&gt;Cocoa object with -description property&lt;/td&gt;   &lt;/tr&gt;&lt;tr&gt;     &lt;td&gt;%d, %i&lt;/td&gt;     &lt;td&gt;Signed integer&lt;/td&gt;   &lt;/tr&gt;&lt;tr&gt;     &lt;td&gt;%u&lt;/td&gt;     &lt;td&gt;Unsigned integer&lt;/td&gt;   &lt;/tr&gt;&lt;tr&gt;     &lt;td&gt;%f&lt;/td&gt;     &lt;td&gt;Double or Float&lt;/td&gt;   &lt;/tr&gt;&lt;tr&gt;     &lt;td&gt;%p&lt;/td&gt;     &lt;td&gt;Pointer&lt;/td&gt;   &lt;/tr&gt;&lt;tr&gt;     &lt;td&gt;%s&lt;/td&gt;     &lt;td&gt;C String&lt;/td&gt;   &lt;/tr&gt;&lt;tr&gt;     &lt;td&gt;%c&lt;/td&gt;     &lt;td&gt;Character&lt;/td&gt;   &lt;/tr&gt;&lt;tr&gt;     &lt;td&gt;%ll&lt;/td&gt;     &lt;td&gt;Long Long&lt;/td&gt;   &lt;/tr&gt;&lt;tr&gt;     &lt;td&gt;%Lf&lt;/td&gt;     &lt;td&gt;Long Double&lt;/td&gt;   &lt;/tr&gt;&lt;tr&gt;     &lt;td&gt;%llu&lt;/td&gt;     &lt;td&gt;Unsigned Long Long&lt;/td&gt;   &lt;/tr&gt;&lt;tr&gt;     &lt;td&gt;%x&lt;/td&gt;     &lt;td&gt;Hexadecimal&lt;/td&gt;   &lt;/tr&gt;&lt;tr&gt;     &lt;td&gt;%o&lt;/td&gt;     &lt;td&gt;Octal&lt;/td&gt;   &lt;/tr&gt;&lt;/table&gt;&lt;br /&gt;Now for the "Better NSLog" implementation, which I'm defining as &lt;b&gt;spLog&lt;/b&gt; (choose any non-keyword, doesn't matter).&lt;br /&gt;&lt;pre class="brush: cocoa"&gt;#if DEBUG&lt;br /&gt;# define spLog(fmt, ...) NSLog((@"%s [Line %d] " fmt), __PRETTY_FUNCTION__, __LINE__, ##__VA_ARGS__);&lt;br /&gt;#else&lt;br /&gt;# define spLog(...)&lt;br /&gt;#endif&lt;br /&gt;&lt;/pre&gt;This little macro takes NSLog a step further, by including the function name (in which the log call resides) and the line number, as well as whatever you were NSLogging in the first place.  It is called in the same way NSLog is called.  So the only difference from the first example would be:&lt;br /&gt;&lt;pre class="brush: cocoa"&gt;int myInt = 100;&lt;br /&gt;spLog(@"The value of myInt: %i", myInt);&lt;br /&gt;&lt;/pre&gt;This output would be:&lt;br /&gt;&lt;i&gt;-[myViewController myFunction:] [Line 56] The value of myInt: 100&lt;/i&gt;&lt;br /&gt;&lt;br /&gt;So just include the macro in a header file and you're good to go.  When you're debugging, the more information you get, the better and this is a quick way to get it.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7756992915224554856-4353077210637245532?l=cocoamatic.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://cocoamatic.blogspot.com/feeds/4353077210637245532/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://cocoamatic.blogspot.com/2010/08/better-nslog-implementation.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7756992915224554856/posts/default/4353077210637245532'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7756992915224554856/posts/default/4353077210637245532'/><link rel='alternate' type='text/html' href='http://cocoamatic.blogspot.com/2010/08/better-nslog-implementation.html' title='Better NSLog implementation'/><author><name>tk</name><uri>http://www.blogger.com/profile/06390051897876600373</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7756992915224554856.post-750710938147761138</id><published>2010-08-03T12:52:00.001-04:00</published><updated>2010-08-04T08:35:18.186-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='NSScanner'/><category scheme='http://www.blogger.com/atom/ns#' term='UITextFieldDelegate'/><category scheme='http://www.blogger.com/atom/ns#' term='UITextField'/><category scheme='http://www.blogger.com/atom/ns#' term='Numeric'/><title type='text'>UITextField: Only allow numeric entry using NSScanner</title><content type='html'>Have a UITextField and want to prevent the user from entering anything but numbers (and decimal point)?  This quick function utilizing the UITextFieldDelegate will do the trick.  &lt;br /&gt;&lt;br /&gt;&lt;pre class="brush: cocoa"&gt;- (BOOL)textField:(UITextField *)textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string {&lt;br /&gt;&lt;br /&gt; NSString *resultingString = [textField.text stringByReplacingCharactersInRange: range withString: string];&lt;br /&gt; &lt;br /&gt; // This allows backspace&lt;br /&gt; if ([resultingString length] == 0) {&lt;br /&gt;  return true;&lt;br /&gt; }&lt;br /&gt;&lt;br /&gt; double holder;&lt;br /&gt; NSScanner *scan = [NSScanner scannerWithString: resultingString];&lt;br /&gt; &lt;br /&gt; return [scan scanDouble: &amp;holder] &amp;&amp; [scan isAtEnd];&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;a name='more'&gt;&lt;/a&gt;&lt;br /&gt;If you want an integer instead of a double, change line 10 from&lt;br /&gt;&lt;pre class="brush: cocoa"&gt;double holder;&lt;/pre&gt;to&lt;br /&gt;&lt;pre class="brush: cocoa"&gt;NSInteger holder;&lt;/pre&gt;and change line 13 from&lt;br /&gt;&lt;pre class="brush: cocoa"&gt;return [scan scanDouble: &amp;holder] &amp;&amp; [scan isAtEnd];&lt;/pre&gt;to&lt;br /&gt;&lt;pre class="brush: cocoa"&gt;return [scan scanInteger: &amp;holder] &amp;&amp; [scan isAtEnd];&lt;/pre&gt;&lt;br /&gt;Remember, in order for this method to be called, you have to reference the delegate class in your header file and set the delegate property of the UITextField to self.&lt;br /&gt;&lt;br /&gt;&lt;pre class="brush: cocoa"&gt;@interface MyViewController : UIViewController&amp;lt;UITextFieldDelegate&amp;gt; { }&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;pre class="brush: cocoa"&gt;self.myTextField.delegate = self;&lt;br /&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7756992915224554856-750710938147761138?l=cocoamatic.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://cocoamatic.blogspot.com/feeds/750710938147761138/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://cocoamatic.blogspot.com/2010/08/uitextfield-only-allow-numeric-entry.html#comment-form' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7756992915224554856/posts/default/750710938147761138'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7756992915224554856/posts/default/750710938147761138'/><link rel='alternate' type='text/html' href='http://cocoamatic.blogspot.com/2010/08/uitextfield-only-allow-numeric-entry.html' title='UITextField: Only allow numeric entry using NSScanner'/><author><name>tk</name><uri>http://www.blogger.com/profile/06390051897876600373</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7756992915224554856.post-7265262543705828903</id><published>2010-07-30T16:30:00.002-04:00</published><updated>2010-08-04T08:33:50.291-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='UIColor'/><category scheme='http://www.blogger.com/atom/ns#' term='rgb'/><category scheme='http://www.blogger.com/atom/ns#' term='macro'/><category scheme='http://www.blogger.com/atom/ns#' term='hex'/><title type='text'>UIColor macro with hex values</title><content type='html'>Cocoa has several colors built into the UIColor class.  For example:&lt;br /&gt;&lt;pre class="brush: cocoa"&gt;[UIColor redColor];&lt;br /&gt;[UIColor darkGrayColor];&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;This is great, but what if you want one of the thousands of colors not found in the pre-defined list?  There's an easy way to do that:&lt;br /&gt;&lt;pre class="brush: cocoa"&gt;[UIColor colorWithRed:0.5 green:0.5 blue:0.5 alpha:1.0];&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;Perfect. But what if you just have a list of hex color codes?  Wouldn't it be nice if you didn't have to convert each of the color components in the hex code to its corresponding RGB decimal value? Here's where a simple and very useful macro comes into play. Just place the code below in a header file and you're done.  (They're identical except that UIColorFromRGB always sets the alpha value to 1.0, whereas UIColorFromRGBWithAlpha allows you to set the alpha value.)&lt;br /&gt;&lt;a name='more'&gt;&lt;/a&gt;&lt;br /&gt;&lt;pre class="brush: cocoa"&gt;//RGB color macro&lt;br /&gt;#define UIColorFromRGB(rgbValue) [UIColor \&lt;br /&gt;colorWithRed:((float)((rgbValue &amp; 0xFF0000) &gt;&gt; 16))/255.0 \&lt;br /&gt;green:((float)((rgbValue &amp; 0xFF00) &gt;&gt; 8))/255.0 \&lt;br /&gt;blue:((float)(rgbValue &amp; 0xFF))/255.0 alpha:1.0]&lt;br /&gt;&lt;br /&gt;//RGB color macro with alpha&lt;br /&gt;#define UIColorFromRGBWithAlpha(rgbValue,a) [UIColor \&lt;br /&gt;colorWithRed:((float)((rgbValue &amp; 0xFF0000) &gt;&gt; 16))/255.0 \&lt;br /&gt;green:((float)((rgbValue &amp; 0xFF00) &gt;&gt; 8))/255.0 \&lt;br /&gt;blue:((float)(rgbValue &amp; 0xFF))/255.0 alpha:a]&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;Here's how to call the macros:&lt;br /&gt;&lt;pre class="brush: cocoa"&gt;self.view.backgroundColor = UIColorFromRGB(0xCECECE);&lt;br /&gt;self.view.backgroundColor = UIColorFromRGBWithAlpha(0xCECECE, 0.8);&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;This is a good one to keep in your toolbox. Hope it's as useful for you as it is for me.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7756992915224554856-7265262543705828903?l=cocoamatic.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://cocoamatic.blogspot.com/feeds/7265262543705828903/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://cocoamatic.blogspot.com/2010/07/uicolor-macro-with-hex-values.html#comment-form' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7756992915224554856/posts/default/7265262543705828903'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7756992915224554856/posts/default/7265262543705828903'/><link rel='alternate' type='text/html' href='http://cocoamatic.blogspot.com/2010/07/uicolor-macro-with-hex-values.html' title='UIColor macro with hex values'/><author><name>tk</name><uri>http://www.blogger.com/profile/06390051897876600373</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7756992915224554856.post-3676833310951490906</id><published>2010-07-30T12:14:00.000-04:00</published><updated>2010-07-30T15:13:03.503-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='loadView'/><category scheme='http://www.blogger.com/atom/ns#' term='uiview'/><category scheme='http://www.blogger.com/atom/ns#' term='UIViewController'/><category scheme='http://www.blogger.com/atom/ns#' term='programmatically'/><title type='text'>Creating UIViews programmatically</title><content type='html'>If you want to create a new UIViewController object without using a Nib file in Interface Builder, you must use the loadView method.  It's rather simple, but key to doing things programmatically.&lt;br /&gt;&lt;pre class="brush: cocoa"&gt;- (void)loadView {&lt;br /&gt; CGRect viewFrame;&lt;br /&gt; viewFrame = CGRectMake(0, 0, MASTER_WIDTH, MASTER_HEIGHT);&lt;br /&gt; self.view = [[[UIView alloc] initWithFrame:viewFrame] autorelease];&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;(Note: &lt;b&gt;MASTER_WIDTH&lt;/b&gt; and &lt;b&gt;MASTER_HEIGHT&lt;/b&gt; are simply constants defining the width and height of the screen.)&lt;br /&gt;&lt;br /&gt;Once your view is created, you are free to implement, as usual, viewDidLoad, viewWillAppear, viewDidAppear, etc.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7756992915224554856-3676833310951490906?l=cocoamatic.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://cocoamatic.blogspot.com/feeds/3676833310951490906/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://cocoamatic.blogspot.com/2010/07/creating-uiviews-programmatically.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7756992915224554856/posts/default/3676833310951490906'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7756992915224554856/posts/default/3676833310951490906'/><link rel='alternate' type='text/html' href='http://cocoamatic.blogspot.com/2010/07/creating-uiviews-programmatically.html' title='Creating UIViews programmatically'/><author><name>tk</name><uri>http://www.blogger.com/profile/06390051897876600373</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7756992915224554856.post-1164218821140933678</id><published>2009-08-13T15:04:00.000-04:00</published><updated>2009-08-13T15:12:20.580-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='number pad'/><category scheme='http://www.blogger.com/atom/ns#' term='custom button'/><title type='text'>Add decimal point to number pad</title><content type='html'>Add this to viewDidLoad:&lt;div&gt;&lt;br /&gt;&lt;div&gt;&lt;p  style="margin: 0.0px 0.0px 0.0px 0.0px; font: 10.0px Monaco; color:#5c2699;"&gt;&lt;span style="color:#000000;"&gt;&lt;/span&gt;&lt;/p&gt;&lt;/div&gt;&lt;div&gt;&lt;p  style="margin: 0.0px 0.0px 0.0px 0.0px; font: 10.0px Monaco; color:#5c2699;"&gt;&lt;span style="color:#000000;"&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;blockquote&gt;&lt;p  style="margin: 0.0px 0.0px 0.0px 0.0px; font: 10.0px Monaco; color:#5c2699;"&gt;&lt;span style="color:#000000;"&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;	&lt;/span&gt;[[&lt;/span&gt;NSNotificationCenter&lt;span style="color:#000000;"&gt; &lt;/span&gt;&lt;span style="color:#2e0d6e;"&gt;defaultCenter&lt;/span&gt;&lt;span style="color:#000000;"&gt;] &lt;/span&gt;&lt;span style="color:#2e0d6e;"&gt;addObserver&lt;/span&gt;&lt;span style="color:#000000;"&gt;:&lt;/span&gt;&lt;span style="color:#aa0d91;"&gt;self&lt;/span&gt;&lt;span style="color:#000000;"&gt; &lt;/span&gt;&lt;span style="color:#2e0d6e;"&gt;selector&lt;/span&gt;&lt;span style="color:#000000;"&gt;:&lt;/span&gt;&lt;span style="color:#aa0d91;"&gt;@selector&lt;/span&gt;&lt;span style="color:#000000;"&gt;(&lt;/span&gt;&lt;span style="color:#26474b;"&gt;keyboardDidShowWeight&lt;/span&gt;&lt;span style="color:#000000;"&gt;:) &lt;/span&gt;&lt;span style="color:#2e0d6e;"&gt;name&lt;/span&gt;&lt;span style="color:#000000;"&gt;:&lt;/span&gt;UIKeyboardDidShowNotification&lt;span style="color:#000000;"&gt; &lt;/span&gt;&lt;span style="color:#2e0d6e;"&gt;object&lt;/span&gt;&lt;span style="color:#000000;"&gt;:&lt;/span&gt;&lt;span style="color:#aa0d91;"&gt;nil&lt;/span&gt;&lt;span style="color:#000000;"&gt;];&lt;/span&gt;&lt;/p&gt; &lt;p  style="margin: 0.0px 0.0px 0.0px 0.0px; font: 10.0px Monaco; color:#5c2699;"&gt;&lt;span style="color:#000000;"&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;	&lt;/span&gt;[[&lt;/span&gt;NSNotificationCenter&lt;span style="color:#000000;"&gt; &lt;/span&gt;&lt;span style="color:#2e0d6e;"&gt;defaultCenter&lt;/span&gt;&lt;span style="color:#000000;"&gt;] &lt;/span&gt;&lt;span style="color:#2e0d6e;"&gt;addObserver&lt;/span&gt;&lt;span style="color:#000000;"&gt;:&lt;/span&gt;&lt;span style="color:#aa0d91;"&gt;self&lt;/span&gt;&lt;span style="color:#000000;"&gt; &lt;/span&gt;&lt;span style="color:#2e0d6e;"&gt;selector&lt;/span&gt;&lt;span style="color:#000000;"&gt;:&lt;/span&gt;&lt;span style="color:#aa0d91;"&gt;@selector&lt;/span&gt;&lt;span style="color:#000000;"&gt;(&lt;/span&gt;&lt;span style="color:#26474b;"&gt;keyboardWillShowWeight&lt;/span&gt;&lt;span style="color:#000000;"&gt;:) &lt;/span&gt;&lt;span style="color:#2e0d6e;"&gt;name&lt;/span&gt;&lt;span style="color:#000000;"&gt;:&lt;/span&gt;UIKeyboardWillShowNotification&lt;span style="color:#000000;"&gt; &lt;/span&gt;&lt;span style="color:#2e0d6e;"&gt;object&lt;/span&gt;&lt;span style="color:#000000;"&gt;:&lt;/span&gt;&lt;span style="color:#aa0d91;"&gt;nil&lt;/span&gt;&lt;span style="color:#000000;"&gt;];&lt;/span&gt;&lt;/p&gt; &lt;p  style="margin: 0.0px 0.0px 0.0px 0.0px; font: 10.0px Monaco; color:#5c2699;"&gt;&lt;span style="color:#000000;"&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;	&lt;/span&gt;[[&lt;/span&gt;NSNotificationCenter&lt;span style="color:#000000;"&gt; &lt;/span&gt;&lt;span style="color:#2e0d6e;"&gt;defaultCenter&lt;/span&gt;&lt;span style="color:#000000;"&gt;] &lt;/span&gt;&lt;span style="color:#2e0d6e;"&gt;addObserver&lt;/span&gt;&lt;span style="color:#000000;"&gt;:&lt;/span&gt;&lt;span style="color:#aa0d91;"&gt;self&lt;/span&gt;&lt;span style="color:#000000;"&gt; &lt;/span&gt;&lt;span style="color:#2e0d6e;"&gt;selector&lt;/span&gt;&lt;span style="color:#000000;"&gt;:&lt;/span&gt;&lt;span style="color:#aa0d91;"&gt;@selector&lt;/span&gt;&lt;span style="color:#000000;"&gt;(keyboardDidHideWeight:) &lt;/span&gt;&lt;span style="color:#2e0d6e;"&gt;name&lt;/span&gt;&lt;span style="color:#000000;"&gt;:&lt;/span&gt;UIKeyboardDidHideNotification&lt;span style="color:#000000;"&gt; &lt;/span&gt;&lt;span style="color:#2e0d6e;"&gt;object&lt;/span&gt;&lt;span style="color:#000000;"&gt;:&lt;/span&gt;&lt;span style="color:#aa0d91;"&gt;nil&lt;/span&gt;&lt;span style="color:#000000;"&gt;];&lt;/span&gt;&lt;/p&gt;&lt;/blockquote&gt;&lt;p  style="margin: 0.0px 0.0px 0.0px 0.0px; font: 10.0px Monaco; color:#5c2699;"&gt;&lt;span style="color:#000000;"&gt;&lt;/span&gt;&lt;/p&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Add these methods:&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 10.0px Monaco"&gt;&lt;/p&gt;&lt;blockquote&gt;&lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 10.0px Monaco"&gt;- (&lt;span style="color:#aa0d91;"&gt;void&lt;/span&gt;)addDecimalPoint:(&lt;span style="color:#aa0d91;"&gt;id&lt;/span&gt;)sender {&lt;/p&gt; &lt;p  style="margin: 0.0px 0.0px 0.0px 0.0px; font: 10.0px Monaco; color:#c41a16;"&gt;&lt;span style="color:#000000;"&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;	&lt;/span&gt;&lt;/span&gt;&lt;span style="color:#2e0d6e;"&gt;NSLog&lt;/span&gt;&lt;span style="color:#000000;"&gt;(&lt;/span&gt;@"decimal point pressed"&lt;span style="color:#000000;"&gt;);&lt;/span&gt;&lt;/p&gt; &lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 10.0px Monaco"&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;	&lt;/span&gt;&lt;span style="color:#aa0d91;"&gt;BOOL&lt;/span&gt; allowDecimal = &lt;span style="color:#aa0d91;"&gt;YES&lt;/span&gt;;&lt;/p&gt; &lt;p  style="margin: 0.0px 0.0px 0.0px 0.0px; font: 10.0px Monaco; color:#5c2699;"&gt;&lt;span style="color:#000000;"&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;	&lt;/span&gt;&lt;/span&gt;unichar&lt;span style="color:#000000;"&gt; c;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 10.0px Monaco"&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;	&lt;/span&gt;&lt;span style="color:#5c2699;"&gt;unichar&lt;/span&gt; d = &lt;span style="color:#1c00cf;"&gt;'.'&lt;/span&gt;;&lt;/p&gt; &lt;p  style="margin: 0.0px 0.0px 0.0px 0.0px; font: 10.0px Monaco; color:#3f6e74;"&gt;&lt;span style="color:#000000;"&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;	&lt;/span&gt;&lt;/span&gt;&lt;span style="color:#aa0d91;"&gt;for&lt;/span&gt;&lt;span style="color:#000000;"&gt;(&lt;/span&gt;&lt;span style="color:#aa0d91;"&gt;int&lt;/span&gt;&lt;span style="color:#000000;"&gt; i=&lt;/span&gt;&lt;span style="color:#1c00cf;"&gt;0&lt;/span&gt;&lt;span style="color:#000000;"&gt;;i&lt;[&lt;/span&gt;todayWeighInTextField&lt;span style="color:#000000;"&gt;.&lt;/span&gt;&lt;span style="color:#5c2699;"&gt;text&lt;/span&gt;&lt;span style="color:#000000;"&gt; &lt;/span&gt;&lt;span style="color:#2e0d6e;"&gt;length&lt;/span&gt;&lt;span style="color:#000000;"&gt;];i++) {&lt;/span&gt;&lt;/p&gt; &lt;p  style="margin: 0.0px 0.0px 0.0px 0.0px; font: 10.0px Monaco; color:#3f6e74;"&gt;&lt;span style="color:#000000;"&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;		&lt;/span&gt;c = [&lt;/span&gt;todayWeighInTextField&lt;span style="color:#000000;"&gt;.&lt;/span&gt;&lt;span style="color:#5c2699;"&gt;text&lt;/span&gt;&lt;span style="color:#000000;"&gt; &lt;/span&gt;&lt;span style="color:#2e0d6e;"&gt;characterAtIndex&lt;/span&gt;&lt;span style="color:#000000;"&gt;:i];&lt;/span&gt;&lt;/p&gt; &lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 10.0px Monaco"&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;		&lt;/span&gt;&lt;span style="color:#aa0d91;"&gt;if&lt;/span&gt;(c == d) allowDecimal = &lt;span style="color:#aa0d91;"&gt;NO&lt;/span&gt;;&lt;/p&gt; &lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 10.0px Monaco"&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;	&lt;/span&gt;}&lt;/p&gt; &lt;p  style="margin: 0.0px 0.0px 0.0px 0.0px; font: 10.0px Monaco; color:#3f6e74;"&gt;&lt;span style="color:#000000;"&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;	&lt;/span&gt;&lt;/span&gt;&lt;span style="color:#aa0d91;"&gt;if&lt;/span&gt;&lt;span style="color:#000000;"&gt;(allowDecimal) &lt;/span&gt;todayWeighInTextField&lt;span style="color:#000000;"&gt;.&lt;/span&gt;&lt;span style="color:#5c2699;"&gt;text&lt;/span&gt;&lt;span style="color:#000000;"&gt; = [&lt;/span&gt;todayWeighInTextField&lt;span style="color:#000000;"&gt;.&lt;/span&gt;&lt;span style="color:#5c2699;"&gt;text&lt;/span&gt;&lt;span style="color:#000000;"&gt; &lt;/span&gt;&lt;span style="color:#2e0d6e;"&gt;stringByAppendingString&lt;/span&gt;&lt;span style="color:#000000;"&gt;:&lt;/span&gt;&lt;span style="color:#c41a16;"&gt;@"."&lt;/span&gt;&lt;span style="color:#000000;"&gt;];&lt;/span&gt;&lt;/p&gt; &lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 10.0px Monaco"&gt;}&lt;/p&gt; &lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 10.0px Monaco; min-height: 14.0px"&gt;&lt;br /&gt;&lt;/p&gt; &lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 10.0px Monaco"&gt;- (&lt;span style="color:#aa0d91;"&gt;void&lt;/span&gt;)keyboardDidShowWeight:(&lt;span style="color:#5c2699;"&gt;NSNotification&lt;/span&gt; *)note {&lt;/p&gt; &lt;p  style="margin: 0.0px 0.0px 0.0px 0.0px; font: 10.0px Monaco; color:#3f6e74;"&gt;&lt;span style="color:#000000;"&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;	&lt;/span&gt;[&lt;/span&gt;&lt;span style="color:#aa0d91;"&gt;self&lt;/span&gt;&lt;span style="color:#000000;"&gt;.&lt;/span&gt;keyboardToolbar&lt;span style="color:#000000;"&gt; &lt;/span&gt;&lt;span style="color:#2e0d6e;"&gt;setHidden&lt;/span&gt;&lt;span style="color:#000000;"&gt;:&lt;/span&gt;&lt;span style="color:#aa0d91;"&gt;NO&lt;/span&gt;&lt;span style="color:#000000;"&gt;];&lt;/span&gt;&lt;/p&gt; &lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 10.0px Monaco"&gt;}&lt;/p&gt; &lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 10.0px Monaco; min-height: 14.0px"&gt;&lt;br /&gt;&lt;/p&gt; &lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 10.0px Monaco"&gt;- (&lt;span style="color:#aa0d91;"&gt;void&lt;/span&gt;)keyboardWillShowWeight:(&lt;span style="color:#5c2699;"&gt;NSNotification&lt;/span&gt; *)note {&lt;/p&gt; &lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 10.0px Monaco"&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;	&lt;/span&gt;&lt;span style="color:#5c2699;"&gt;UIWindow&lt;/span&gt; *tmpWindow;&lt;/p&gt; &lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 10.0px Monaco"&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;	&lt;/span&gt;&lt;span style="color:#5c2699;"&gt;UIViewController&lt;/span&gt; *mainViewController = &lt;span style="color:#aa0d91;"&gt;self&lt;/span&gt;;&lt;/p&gt; &lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 10.0px Monaco"&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;	&lt;/span&gt;&lt;span style="color:#5c2699;"&gt;UIView&lt;/span&gt; *keyboard;&lt;/p&gt; &lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 10.0px Monaco; min-height: 14.0px"&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;	&lt;/span&gt;&lt;/p&gt; &lt;p  style="margin: 0.0px 0.0px 0.0px 0.0px; font: 10.0px Monaco; color:#2e0d6e;"&gt;&lt;span style="color:#000000;"&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;	&lt;/span&gt;&lt;/span&gt;&lt;span style="color:#aa0d91;"&gt;for&lt;/span&gt;&lt;span style="color:#000000;"&gt;(&lt;/span&gt;&lt;span style="color:#aa0d91;"&gt;int&lt;/span&gt;&lt;span style="color:#000000;"&gt; i=&lt;/span&gt;&lt;span style="color:#1c00cf;"&gt;0&lt;/span&gt;&lt;span style="color:#000000;"&gt;;i&lt;[[[&lt;/span&gt;&lt;span style="color:#5c2699;"&gt;UIApplication&lt;/span&gt;&lt;span style="color:#000000;"&gt; &lt;/span&gt;sharedApplication&lt;span style="color:#000000;"&gt;] &lt;/span&gt;windows&lt;span style="color:#000000;"&gt;] &lt;/span&gt;count&lt;span style="color:#000000;"&gt;];i++) {&lt;/span&gt;&lt;/p&gt; &lt;p  style="margin: 0.0px 0.0px 0.0px 0.0px; font: 10.0px Monaco; color:#2e0d6e;"&gt;&lt;span style="color:#000000;"&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;		&lt;/span&gt;tmpWindow = [[[&lt;/span&gt;&lt;span style="color:#5c2699;"&gt;UIApplication&lt;/span&gt;&lt;span style="color:#000000;"&gt; &lt;/span&gt;sharedApplication&lt;span style="color:#000000;"&gt;] &lt;/span&gt;windows&lt;span style="color:#000000;"&gt;] &lt;/span&gt;objectAtIndex&lt;span style="color:#000000;"&gt;:i];&lt;/span&gt;&lt;/p&gt; &lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 10.0px Monaco"&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;		&lt;/span&gt;&lt;span style="color:#aa0d91;"&gt;for&lt;/span&gt;(&lt;span style="color:#aa0d91;"&gt;int&lt;/span&gt; j=&lt;span style="color:#1c00cf;"&gt;0&lt;/span&gt;;j&lt;[tmpWindow.subviews &lt;span style="color:#2e0d6e;"&gt;count&lt;/span&gt;];j++) {&lt;/p&gt; &lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 10.0px Monaco"&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;			&lt;/span&gt;keyboard = [tmpWindow.subviews &lt;span style="color:#2e0d6e;"&gt;objectAtIndex&lt;/span&gt;:j];&lt;/p&gt; &lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 10.0px Monaco"&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;			&lt;/span&gt;&lt;span style="color:#aa0d91;"&gt;if&lt;/span&gt;([[keyboard &lt;span style="color:#2e0d6e;"&gt;description&lt;/span&gt;] &lt;span style="color:#2e0d6e;"&gt;hasPrefix&lt;/span&gt;:&lt;span style="color:#c41a16;"&gt;@"&lt;uikeyboard"&gt;&lt;/uikeyboard"&gt;&lt;/span&gt;] == &lt;span style="color:#aa0d91;"&gt;YES&lt;/span&gt;) {&lt;/p&gt; &lt;p  style="margin: 0.0px 0.0px 0.0px 0.0px; font: 10.0px Monaco; color:#2e0d6e;"&gt;&lt;span style="color:#000000;"&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;				&lt;/span&gt;&lt;/span&gt;&lt;span style="color:#5c2699;"&gt;UIButton&lt;/span&gt;&lt;span style="color:#000000;"&gt; *&lt;/span&gt;&lt;span style="color:#3f6e74;"&gt;decimalPointBtn&lt;/span&gt;&lt;span style="color:#000000;"&gt; = [&lt;/span&gt;&lt;span style="color:#5c2699;"&gt;UIButton&lt;/span&gt;&lt;span style="color:#000000;"&gt; &lt;/span&gt;buttonWithType&lt;span style="color:#000000;"&gt;:&lt;/span&gt;UIButtonTypeRoundedRect&lt;span style="color:#000000;"&gt;];&lt;/span&gt;&lt;/p&gt; &lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 10.0px Monaco"&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;				&lt;/span&gt;decimalPointBtn.frame = &lt;span style="color:#2e0d6e;"&gt;CGRectMake&lt;/span&gt;(&lt;span style="color:#1c00cf;"&gt;0&lt;/span&gt;, &lt;span style="color:#1c00cf;"&gt;164&lt;/span&gt;, &lt;span style="color:#1c00cf;"&gt;106&lt;/span&gt;, &lt;span style="color:#1c00cf;"&gt;53&lt;/span&gt;);&lt;/p&gt; &lt;p  style="margin: 0.0px 0.0px 0.0px 0.0px; font: 10.0px Monaco; color:#2e0d6e;"&gt;&lt;span style="color:#000000;"&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;				&lt;/span&gt;[decimalPointBtn &lt;/span&gt;setImage&lt;span style="color:#000000;"&gt;:[&lt;/span&gt;&lt;span style="color:#5c2699;"&gt;UIImage&lt;/span&gt;&lt;span style="color:#000000;"&gt; &lt;/span&gt;imageNamed&lt;span style="color:#000000;"&gt;:&lt;/span&gt;&lt;span style="color:#c41a16;"&gt;@"decimalPointNormal.png"&lt;/span&gt;&lt;span style="color:#000000;"&gt;] &lt;/span&gt;forState&lt;span style="color:#000000;"&gt;:&lt;/span&gt;UIControlStateNormal&lt;span style="color:#000000;"&gt;];&lt;/span&gt;&lt;/p&gt; &lt;p  style="margin: 0.0px 0.0px 0.0px 0.0px; font: 10.0px Monaco; color:#2e0d6e;"&gt;&lt;span style="color:#000000;"&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;				&lt;/span&gt;[decimalPointBtn &lt;/span&gt;setImage&lt;span style="color:#000000;"&gt;:[&lt;/span&gt;&lt;span style="color:#5c2699;"&gt;UIImage&lt;/span&gt;&lt;span style="color:#000000;"&gt; &lt;/span&gt;imageNamed&lt;span style="color:#000000;"&gt;:&lt;/span&gt;&lt;span style="color:#c41a16;"&gt;@"decimalPointPressed.png"&lt;/span&gt;&lt;span style="color:#000000;"&gt;] &lt;/span&gt;forState&lt;span style="color:#000000;"&gt;:&lt;/span&gt;UIControlStateHighlighted&lt;span style="color:#000000;"&gt;];&lt;/span&gt;&lt;/p&gt; &lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 10.0px Monaco; min-height: 14.0px"&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;				&lt;/span&gt;&lt;/p&gt; &lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 10.0px Monaco"&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;				&lt;/span&gt;[keyboard &lt;span style="color:#2e0d6e;"&gt;addSubview&lt;/span&gt;:decimalPointBtn];&lt;/p&gt; &lt;p  style="margin: 0.0px 0.0px 0.0px 0.0px; font: 10.0px Monaco; color:#2e0d6e;"&gt;&lt;span style="color:#000000;"&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;				&lt;/span&gt;[decimalPointBtn &lt;/span&gt;addTarget&lt;span style="color:#000000;"&gt;:mainViewController &lt;/span&gt;action&lt;span style="color:#000000;"&gt;:&lt;/span&gt;&lt;span style="color:#aa0d91;"&gt;@selector&lt;/span&gt;&lt;span style="color:#000000;"&gt;(&lt;/span&gt;&lt;span style="color:#26474b;"&gt;addDecimalPoint&lt;/span&gt;&lt;span style="color:#000000;"&gt;:) &lt;/span&gt;forControlEvents&lt;span style="color:#000000;"&gt;:&lt;/span&gt;UIControlEventTouchUpInside&lt;span style="color:#000000;"&gt;];&lt;/span&gt;&lt;/p&gt; &lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 10.0px Monaco; min-height: 14.0px"&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;				&lt;/span&gt;&lt;/p&gt; &lt;p  style="margin: 0.0px 0.0px 0.0px 0.0px; font: 10.0px Monaco; color:#aa0d91;"&gt;&lt;span style="color:#000000;"&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;				&lt;/span&gt;&lt;/span&gt;return&lt;span style="color:#000000;"&gt;;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 10.0px Monaco"&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;			&lt;/span&gt;}&lt;/p&gt; &lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 10.0px Monaco"&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;		&lt;/span&gt;}&lt;/p&gt; &lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 10.0px Monaco"&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;	&lt;/span&gt;}&lt;/p&gt; &lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 10.0px Monaco"&gt;}&lt;/p&gt; &lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 10.0px Monaco; min-height: 14.0px"&gt;&lt;br /&gt;&lt;/p&gt; &lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 10.0px Monaco"&gt;- (&lt;span style="color:#aa0d91;"&gt;void&lt;/span&gt;)keyboardDidHideWeight:(&lt;span style="color:#5c2699;"&gt;NSNotification&lt;/span&gt; *)note {&lt;/p&gt; &lt;p  style="margin: 0.0px 0.0px 0.0px 0.0px; font: 10.0px Monaco; color:#2e0d6e;"&gt;&lt;span style="color:#000000;"&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;	&lt;/span&gt;[[&lt;/span&gt;&lt;span style="color:#5c2699;"&gt;NSNotificationCenter&lt;/span&gt;&lt;span style="color:#000000;"&gt; &lt;/span&gt;defaultCenter&lt;span style="color:#000000;"&gt;] &lt;/span&gt;removeObserver&lt;span style="color:#000000;"&gt;:&lt;/span&gt;&lt;span style="color:#aa0d91;"&gt;self&lt;/span&gt;&lt;span style="color:#000000;"&gt;];&lt;/span&gt;&lt;/p&gt; &lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 10.0px Monaco"&gt;}&lt;/p&gt;&lt;/blockquote&gt;&lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 10.0px Monaco"&gt;&lt;/p&gt;&lt;div&gt;&lt;span class="Apple-style-span"   style="font-family:Monaco, fantasy;font-size:85%;"&gt;&lt;span class="Apple-style-span"  style="font-size:10px;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7756992915224554856-1164218821140933678?l=cocoamatic.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://cocoamatic.blogspot.com/feeds/1164218821140933678/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://cocoamatic.blogspot.com/2009/08/add-decimal-point-to-number-pad.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7756992915224554856/posts/default/1164218821140933678'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7756992915224554856/posts/default/1164218821140933678'/><link rel='alternate' type='text/html' href='http://cocoamatic.blogspot.com/2009/08/add-decimal-point-to-number-pad.html' title='Add decimal point to number pad'/><author><name>tk</name><uri>http://www.blogger.com/profile/06390051897876600373</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry></feed>
