Saturday, September 12, 2015

iOS recommended list of tutorials

1. TableViewController

1.1 TableViewCell customization


Topics:
TableViewController, TableViewCell

Example:
TableViewStory - Present a list of car models and open detail of each one

Details:
1. Add TableViewController from object library in storyboard
2. Create UITableViewController and UITableViewCell Subclasses
3. Configure storyboard objects to connect  to the new classes
4. Declare Cell Reuse Identifier
5. Design Cell (with any objects -content or action- you like)
6. Connect the content objects through outlets and the buttons through actions to the code (Ctrl-drag)
7. Create datasource and add or modify related datasource access methods

1.2 TableView navigation with storyboards and segues

Implementing iOS 7 TableView Navigation using Storyboards in Xcode 5 - Techotopia

Topics:
TableViewController, Navigation Controller, Segues

Example:
TableViewStory - Present a list of car models and open detail of each one

Details:
1. Add Navigation controller before TableViewController
2. Add code below to pass information to the detail view. The destination controller in segue points to the directly next controller. Please note that if we had a navigation controller in the middle then in order to access the next embeded controller we should access the 0 row in the array of controllers of NC
    





// In a story board-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
{
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
    if ([[segue identifier] isEqualToString:@"ShowCarDetails"])
    {
        CarDetailViewController *detailViewController =
        [segue destinationViewController];
        
        NSIndexPath *myIndexPath = [self.tableView
                                    indexPathForSelectedRow];
        
        long row = [myIndexPath row];
        
        detailViewController.carDetailModel = @[_carMakes[row],
                                                _carModels[row], _carImages[row]];
    }


}



An excellent navigation controller in depth introduction that also utilizes and demonstrates preferences list and NSBundle.

Topics:
navigation Controller, TableViewController, TableViewCell, NSBundle

Example:
Library - Present a list of car models and open detail of each one

Details:
Code below to show use of NSBundle

- (void)viewDidLoad {
    [super viewDidLoad];
     
    NSString *filePath = [[NSBundle mainBundle] pathForResource:@"Books" ofType:@"plist"];
    self.authors = [NSArray arrayWithContentsOfFile:filePath];
    NSLog(@"authors > %@", self.authors);
}



No comments:

Post a Comment