Praktikum Entwicklung von Mediensystemen mit
Wintersemester 2013/2014 Christian Weiß, Dr. Alexander De Luca
Mittwoch, 23. Oktober 13
Praktikum Entwicklung von Mediensystemen mit Wintersemester - - PowerPoint PPT Presentation
Praktikum Entwicklung von Mediensystemen mit Wintersemester 2013/2014 Christian Wei, Dr. Alexander De Luca Mittwoch, 23. Oktober 13 Today Table View Navigation Controller Passing Data Between Scenes Assignment 2 iOS PEM - WS
Mittwoch, 23. Oktober 13
iOS PEM - WS 2013/14
2
Mittwoch, 23. Oktober 13
iOS PEM - WS 2013/14
3 Top Bar Table View Detail View Back button
Mittwoch, 23. Oktober 13
iOS PEM - WS 2013/14
4
Mittwoch, 23. Oktober 13
iOS PEM - WS 2013/14
5
Mittwoch, 23. Oktober 13
iOS PEM - WS 2013/14
@interface ViewController : UITableViewController<UITableViewDelegate, UITableViewDataSource> @property(strong, nonatomic) NSArray* tableEntries; self.tableEntries = @[@"Blur", @"Beatles", @"Stone Roses", @"Oasis", @"Velvet Underground"];
6
Mittwoch, 23. Oktober 13
iOS PEM - WS 2013/14
7
// number of section in table
return 1; } // number of rows in our section
return [self.tableEntries count]; } // fill table rows with content
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"Cell" forIndexPath:indexPath]; cell.textLabel.text = [self.tableEntries objectAtIndex:indexPath.row]; return cell; }
Mittwoch, 23. Oktober 13
iOS PEM - WS 2013/14
8
// handle user interaction (i.e. row selection)
{ UIAlertView *alert = [[UIAlertView alloc] initWithTitle:[self.tableEntries objectAtIndex:indexPath.row] message:nil delegate:nil cancelButtonTitle:@"OK"
[alert show]; }
Mittwoch, 23. Oktober 13
iOS PEM - WS 2013/14
9
@interface MasterViewController : UITableViewController @interface DetailViewController : UIViewController
Mittwoch, 23. Oktober 13
iOS PEM - WS 2013/14
10
UIBarButtonItem *addButton = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemAdd target:self action:@selector(insertNewObject:)]; self.navigationItem.rightBarButtonItem = addButton;
Mittwoch, 23. Oktober 13
iOS PEM - WS 2013/14
11
{ if ([[segue identifier] isEqualToString:@"showDetail"]) { NSIndexPath *indexPath = [self.tableView indexPathForSelectedRow]; NSDate *object = _objects[indexPath.row]; [[segue destinationViewController] setDetailItem:object]; } }
{ // Update the text label }
Mittwoch, 23. Oktober 13
iOS PEM - WS 2013/14
12
MyModalViewController FirstViewController
Mittwoch, 23. Oktober 13
iOS PEM - WS 2013/14
13
@protocol MyModalViewControllerDelegate
@end @interface MyModalViewController : UIViewController @property (nonatomic, strong) id <MyModalViewControllerDelegate> delegate;
@end
[self.delegate myModalViewControllerDidCancel:self]; }
[self.delegate myModalViewControllerDidSave:self]; } MyModalViewController.h MyModalViewController.h MyModalViewController.m
Mittwoch, 23. Oktober 13
iOS PEM - WS 2013/14
14
#import "MyModalViewController.h” @interface FirstViewController : UIViewController <MyModalViewControllerDelegate> @end FirstViewController.h
if ([[segue identifier] isEqualToString:@”FirstViewController_To_MyModelViewController"]) { MyModalViewController *myModalViewController = [segue destinationViewController]; myModalViewController.delegate = self; } } FirstViewController.m
[controller dismissModalViewControllerAnimated:YES]; }
[controller dismissModalViewControllerAnimated:YES]; } FirstViewController.m
Mittwoch, 23. Oktober 13
iOS PEM - WS 2013/14
15
#import "AppDelegate.h" AppDelegate *appDelegate = (AppDelegate*) [UIApplication sharedApplication].delegate; NSArray *data = appDelegate.data;
Mittwoch, 23. Oktober 13
iOS PEM - WS 2013/14
16
Mittwoch, 23. Oktober 13