Tab Bar Controller in Objective-C – Example (Video)
Learn how to work with a Tab Bar Controller in Objective-C and manage each of its views independently, with a video tutorial and example code.
To download the project for this post, click HERE.
In this tutorial you will see how to work with a Tab Bar Controller, and how to work independently with each of the views that make up this Tab Bar Controller. In this video tutorial we will build the following app. The third view of this tutorial corresponds to the following tutorial: NSTimer in Objective-C -Example- (Video).
Here is the video of the finished project:
Below are the methods we used to get the date and time in the example app:
Code to get the current date:
// Get today's date NSDate *hoy = [NSDate dateWithTimeIntervalSinceNow:0]; // Format it and store it in the NSString fecha so we can print it NSDateFormatter *dateFormat = [[NSDateFormatter alloc] init]; [dateFormat setDateFormat:@"dd-MMMM-yyy"]; NSString *fecha = [dateFormat stringFromDate:hoy];
Code to get the time. To make it update every second, you should use a timer that calls this method every half second (more or less):
-(void) setHora{
// Get today's date
NSDate *hoy = [NSDate dateWithTimeIntervalSinceNow:0];
// Calculate hours, minutes and seconds
NSCalendar *gregorian = [[NSCalendar alloc] initWithCalendarIdentifier:NSGregorianCalendar];
NSDateComponents *dateComponents = [gregorian components:(NSHourCalendarUnit | NSMinuteCalendarUnit | NSSecondCalendarUnit) fromDate:hoy];
NSInteger horas = [dateComponents hour];
NSInteger minutos = [dateComponents minute];
NSInteger segundos2 = [dateComponents second];
NSString *hora = [NSString stringWithFormat:@"%02i:%02i:%02i",horas, minutos, segundos2];
}
“Tab Bar Controller in Objective-C – Example (Video)” by Ricardo Moya at jarroba.com, licensed under Creative Commons Attribution-NonCommercial-ShareAlike 3.0. Registered at Safe Creative.

You may also like
UITableView in Objective-C: Example (Video)
Learn how to build dynamic tables with UITableView on iPhone in Objective-C, with a video tutorial, a UINavigationBar and a downloadable project.
Collection View (Grids) in Objective-C: Example (Video)
Learn how to build dynamic Collection Views (UICollectionView) and grids on iPhone with Objective-C in this step-by-step video tutorial and example project.


Leave a comment