Last active
December 17, 2015 14:28
-
-
Save sdbeng/5624163 to your computer and use it in GitHub Desktop.
Universal iPhone/iPad App showing a general schedule agenda of events. When the 4th row is selected, it shows a second list of workshop sessions. Each list should show the Detail view for their own events/sessions.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@interface DetailfromConcurViewController : UIViewController <UISplitViewControllerDelegate> | |
@property (strong, nonatomic) id detailItems; | |
@property (weak, nonatomic) IBOutlet UILabel *nameText; | |
@property (weak, nonatomic) IBOutlet UILabel *timeText; | |
@property (weak, nonatomic) IBOutlet UILabel *locationText; | |
@property (weak, nonatomic) IBOutlet UILabel *speakersText; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#import <UIKit/UIKit.h> | |
@interface DetailViewController : UIViewController <UISplitViewControllerDelegate> | |
@property (strong, nonatomic) id detailItem; | |
@property (weak, nonatomic) IBOutlet UILabel *nameText; | |
@property (weak, nonatomic) IBOutlet UILabel *timeText; | |
@property (weak, nonatomic) IBOutlet UILabel *locationText; | |
@property (weak, nonatomic) IBOutlet UILabel *speakersText; | |
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// MasterConcurrentViewController.m | |
// | |
// | |
// Created by admin 33 on 5/20/13. | |
// Copyright (c) 2013 sdbwebsolutions. All rights reserved. | |
// | |
#import "MasterConcurrentViewController.h" | |
#import "DetailfromConcurViewController.h" | |
@interface MasterConcurrentViewController () | |
@end | |
@implementation MasterConcurrentViewController | |
- (void)awakeFromNib | |
{ | |
if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPad) { | |
self.clearsSelectionOnViewWillAppear = NO; | |
self.contentSizeForViewInPopover = CGSizeMake(320.0, 600.0); | |
} | |
[super awakeFromNib]; | |
} | |
- (id)initWithCoder:(NSCoder *)aCoder { | |
self = [super initWithCoder:aCoder]; | |
if (self) { | |
// Customize the table | |
// The className to query on | |
self.parseClassName = @"ConcurrentClass"; | |
// The key of the PFObject to display in the label of the default cell style | |
self.textKey = @"name"; | |
// Uncomment the following line to specify the key of a PFFile on the PFObject to display in the imageView of the default cell style | |
//self.imageKey = @"photo"; | |
// Whether the built-in pull-to-refresh is enabled | |
self.pullToRefreshEnabled = YES; | |
// Whether the built-in pagination is enabled | |
self.paginationEnabled = NO; | |
// The number of objects to show per page | |
self.objectsPerPage = 25; | |
} | |
return self; | |
} | |
- (void)viewDidLoad | |
{ | |
[super viewDidLoad]; | |
self.detailfromConcurViewController = (DetailfromConcurViewController *)[[self.splitViewController.viewControllers lastObject] topViewController]; | |
} | |
- (void)didReceiveMemoryWarning | |
{ | |
[super didReceiveMemoryWarning]; | |
// Dispose of any resources that can be recreated. | |
} | |
- (IBAction)cancelAndDismiss:(id)sender { | |
NSLog(@"cancel button pressed!"); | |
[self dismissViewControllerAnimated:YES completion:^{ | |
NSLog(@"dismissing master 2"); | |
}]; | |
} | |
#pragma mark - View lifecycle | |
- (void)viewDidUnload | |
{ | |
[super viewDidUnload]; | |
// Release any retained subviews of the main view. | |
// e.g. self.myOutlet = nil; | |
} | |
- (void)viewWillAppear:(BOOL)animated | |
{ | |
[super viewWillAppear:animated]; | |
} | |
- (void)viewDidAppear:(BOOL)animated | |
{ | |
[super viewDidAppear:animated]; | |
} | |
- (void)viewWillDisappear:(BOOL)animated | |
{ | |
[super viewWillDisappear:animated]; | |
} | |
- (void)viewDidDisappear:(BOOL)animated | |
{ | |
[super viewDidDisappear:animated]; | |
} | |
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation | |
{ | |
// Return YES for supported orientations | |
return (interfaceOrientation == UIInterfaceOrientationPortrait); | |
} | |
#pragma mark - Parse | |
- (void)objectsDidLoad:(NSError *)error { | |
[super objectsDidLoad:error]; | |
// This method is called every time objects are loaded from Parse via the PFQuery | |
} | |
- (void)objectsWillLoad { | |
[super objectsWillLoad]; | |
// This method is called before a PFQuery is fired to get more objects | |
} | |
// Override to customize what kind of query to perform on the class. The default is to query for | |
// all objects ordered by createdAt descending. | |
- (PFQuery *)queryForTable { | |
PFQuery *query = [PFQuery queryWithClassName:self.parseClassName]; | |
// If no objects are loaded in memory, we look to the cache first to fill the table | |
// and then subsequently do a query against the network. | |
if ([self.objects count] == 0) { | |
query.cachePolicy = kPFCachePolicyCacheThenNetwork; | |
} | |
[query orderByAscending:@"name"]; | |
return query; | |
} | |
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender { | |
if ([segue.identifier isEqualToString:@"concurrentSegue"]) { | |
NSLog(@"passing by concurrent segue"); | |
DetailfromConcurViewController *detailConcurViewController = [segue destinationViewController]; | |
NSInteger row = [[self tableView].indexPathForSelectedRow row]; | |
detailConcurViewController.detailItems = [self.objects objectAtIndex:row]; | |
} | |
} | |
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath object:(PFObject *)object { | |
static NSString *CellIdentifier = @"concurrentCell"; | |
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier]; | |
if (cell == nil) { | |
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:CellIdentifier]; | |
} | |
// Configure the cell | |
cell.textLabel.text = [object objectForKey:@"name"]; | |
cell.detailTextLabel.text = [object objectForKey:@"time"]; | |
return cell; | |
} | |
-(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath | |
{ | |
return 65; | |
} | |
#pragma mark - Table view delegate | |
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath | |
{ | |
[super tableView:tableView didSelectRowAtIndexPath:indexPath]; | |
NSLog(@"executing didSelectRowAtIndexPath"); | |
[self performSegueWithIdentifier:@"concurrentSegue" sender:self]; | |
} | |
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// MasterViewController.m | |
// | |
// | |
// Created by admin 33 on 5/14/13. | |
// Copyright (c) 2013 sdbwebsolutions. All rights reserved. | |
// | |
#import <QuartzCore/QuartzCore.h> | |
#import "MasterViewController.h" | |
#import "DetailViewController.h" | |
#import "MasterCell.h" | |
#import "MasterConcurrentViewController.h" | |
@interface MasterViewController (){ | |
NSMutableArray *_objects; | |
NSArray *_scheduleData; | |
NSArray *_programSections; | |
} | |
@end | |
@implementation MasterViewController | |
- (void)awakeFromNib | |
{ | |
if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPad) { | |
self.clearsSelectionOnViewWillAppear = NO; | |
self.contentSizeForViewInPopover = CGSizeMake(320.0, 600.0); | |
} | |
[super awakeFromNib]; | |
} | |
-(void)createProgramData { | |
NSMutableArray *firstDay;//Wed | |
NSMutableArray *secondDay;//Thurs | |
NSMutableArray *thirdDay;//Fri | |
NSMutableArray *fourthDay;//Sat | |
_programSections = @[@"Wed,June 19,2013",@"Thurs,June 19,2013",@"Fri,June 19,2013",@"Sat,June 19,2013"]; | |
firstDay = [[NSMutableArray alloc] init]; | |
secondDay = [[NSMutableArray alloc] init]; | |
thirdDay = [[NSMutableArray alloc] init]; | |
fourthDay = [[NSMutableArray alloc] init]; | |
//Wed | |
[firstDay addObject:@{@"name":@"Registration", | |
@"time":@"11:00AM - 7:00PM", | |
@"location":@"Hallway", | |
@"speakers":@"test speaker day 1"}]; | |
[firstDay addObject:@{@"name":@"New Program Institute", | |
@"time":@"1:00PM - 3:30PM", | |
@"location":@"more info see program manual", | |
@"speakers":@"more info see program manual"}]; | |
//Thurs | |
[secondDay addObject:@{@"name":@"Registration", | |
@"time":@"7:00AM - 7:00PM", | |
@"location":@"Hallway", | |
@"speakers":@"-"}]; | |
[secondDay addObject:@{@"name":@"Continental Breakfast", | |
@"time":@"7:30AM - 8:30AM", | |
@"location":@"Grand Ballroom", | |
@"speakers":@"test speaker day 2"}]; | |
[secondDay addObject:@{@"name":@"Vendors and Exhibitors", | |
@"time":@"7:30AM - 8:30AM", | |
@"location":@"Grand Ballroom", | |
@"speakers":@"test speaker day 2"}]; | |
[secondDay addObject:@{@"name":@"Opening Session", | |
@"time":@"7:30AM - 8:30AM", | |
@"location":@"Grand Ballroom", | |
@"speakers":@"test speaker day 2"}]; | |
[secondDay addObject:@{@"name":@"Concurrent Sessions", | |
@"time":@"10:30AM - 12:00AM", | |
@"location":@"see Second master VC", | |
@"speakers":@"list of conc"}]; | |
[secondDay addObject:@{@"name":@"Award Luncheon & Exhibits", | |
@"time":@"7:30AM - 8:30AM", | |
@"location":@"Grand Ballroom", | |
@"speakers":@"test speaker day 2"}]; | |
[secondDay addObject:@{@"name":@"Concurrent Afternoon Sessions", | |
@"time":@"1:30AM - 3:00AM", | |
@"location":@"Grand Ballroom", | |
@"speakers":@"test speaker day 2"}]; | |
[secondDay addObject:@{@"name":@"Table Sessions Tertulia", | |
@"time":@"7:30AM - 8:30AM", | |
@"location":@"Grand Ballroom", | |
@"speakers":@"test speaker day 2"}]; | |
[secondDay addObject:@{@"name":@"Family Night", | |
@"time":@"7:30AM - 8:30AM", | |
@"location":@"Grand Ballroom", | |
@"speakers":@"test speaker day 2"}]; | |
//Fri | |
[thirdDay addObject:@{@"name":@"Registration", | |
@"time":@"7:00AM - 7:00PM", | |
@"location":@"Hallway", | |
@"speakers":@"-"}]; | |
[thirdDay addObject:@{@"name":@"Continental Breakfast", | |
@"time":@"7:30AM - 8:30AM", | |
@"location":@"Grand Ballroom", | |
@"speakers":@"test speaker day 3"}]; | |
//Sat | |
[fourthDay addObject:@{@"name":@"Registration", | |
@"time":@"7:00AM - 9:00AM", | |
@"location":@"Hallway", | |
@"speakers":@"test speaker day 3"}]; | |
[fourthDay addObject:@{@"name":@"Continental Breakfast", | |
@"time":@"7:30AM - 8:30AM", | |
@"location":@"Grand Ballroom", | |
@"speakers":@"test speaker day 4"}]; | |
_scheduleData = @[firstDay,secondDay,thirdDay,fourthDay]; | |
} | |
- (id)initWithStyle:(UITableViewStyle)style | |
{ | |
self = [super initWithStyle:style]; | |
if (self) { | |
// Custom initialization | |
} | |
return self; | |
} | |
- (void)viewDidLoad | |
{ | |
[super viewDidLoad]; | |
// Uncomment the following line to preserve selection between presentations. | |
// self.clearsSelectionOnViewWillAppear = NO; | |
// Uncomment the following line to display an Edit button in the navigation bar for this view controller. | |
// self.navigationItem.rightBarButtonItem = self.editButtonItem; | |
self.detailViewController = (DetailViewController *)[[self.splitViewController.viewControllers lastObject] topViewController]; | |
[self createProgramData]; | |
[[self tableView] setBackgroundView: | |
[[UIImageView alloc] initWithImage:[UIImage imageNamed:@"bg_sand.png"]]]; | |
} | |
- (void)didReceiveMemoryWarning | |
{ | |
[super didReceiveMemoryWarning]; | |
// Dispose of any resources that can be recreated. | |
} | |
#pragma mark - Table view data source | |
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView | |
{ | |
// Return the number of sections. | |
return [_programSections count]; | |
} | |
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section | |
{ | |
// Return the number of rows in the section. | |
return [_scheduleData[section] count]; | |
} | |
- (NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section { | |
return _programSections[section]; | |
} | |
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath | |
{ | |
static NSString *CellIdentifier = @"programCell"; | |
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier forIndexPath:indexPath]; | |
// Configure the cell... | |
cell.textLabel.text= | |
_scheduleData[indexPath.section][indexPath.row][@"name"]; | |
return cell; | |
} | |
#pragma mark - Table view delegate | |
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath | |
{ | |
if (indexPath.section == 0) { | |
self.detailViewController.detailItem=_scheduleData[indexPath.section][indexPath.row]; | |
} | |
else if (indexPath.section == 1){ | |
if (indexPath.row == 4) { | |
NSLog(@"selected concurrent sessions row 4"); | |
[self performSegueWithIdentifier:@"concurrentSegue" sender:self]; | |
} | |
else { | |
self.detailViewController.detailItem=_scheduleData[indexPath.section][indexPath.row]; | |
} | |
} | |
else if(indexPath.section == 2){ | |
NSLog(@"selected section 2 -any row"); | |
self.detailViewController.detailItem=_scheduleData[indexPath.section][indexPath.row]; | |
} | |
else{ | |
NSLog(@"Selected section 3 - any row"); | |
self.detailViewController.detailItem=_scheduleData[indexPath.section][indexPath.row]; | |
} | |
//self.detailViewController.detailItem=_scheduleData[indexPath.section][indexPath.row]; | |
} | |
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender | |
{ | |
if ([[segue identifier] isEqualToString:@"showDetailSegue"]) { | |
DetailViewController *destinationViewController = [[segue destinationViewController] visibleViewController];//warning here | |
// UINavigationController *nvc = [segue destinationViewController]; | |
// UINavigationController *nc = (UINavigationController *)segue.destinationViewController; | |
NSIndexPath *indexPath = [self.tableView indexPathForSelectedRow]; | |
destinationViewController.detailItem = _scheduleData[indexPath.section][indexPath.row]; | |
} | |
} | |
-(IBAction)unwindfromConcurTvc:(UIStoryboardSegue*)sender{ | |
NSLog(@"unwindbacktoHomeMaster");//not working | |
} | |
@end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment