Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #import "ViewC_Stuff.h"
- #import "Map.h"
- #import "Campus_TourAppDelegate.h"
- #import "CustomCells2.h"
- #import "Map.h"
- @implementation ViewC_Stuff
- @synthesize sectionView, rowView, info, hours, number,mapLocater, viewtitle, more_Park, height, table, newMapView, c_labs_mapNum;
- - (id)initWithStyle:(UITableViewStyle)style {
- // Override initWithStyle: if you create the controller programmatically and want to perform customization that is not appropriate for viewDidLoad.
- if (self = [super initWithStyle:style]) {
- }
- return self;
- }
- - (void)setupArrays{
- if(sectionView == 0){
- if(rowView == 0){
- self.info = [NSArray arrayWithObjects:
- @"Willis Library",
- @"Archives",
- @"Circulation Department",
- @"Willis 24 Hr GACL",
- @"Digital Projects Lab",
- @"Government Documents Service Desk",
- @"General Reference Desk",
- @"Interlibrary Loan Hours",
- @"Microforms Service Desk",
- @"Music Library / Audio Center",
- @"Photocopy Office",
- @"Rare Book and Texana Collections",
- @"Reserves/Current Periodicals Room",nil];
- self.hours = [NSArray arrayWithObjects:
- @"Sunday: 1:00 pm-2:00 am\nMonday - Thursday: 7:30 am-2:00 am\nFriday: 7:30 am-Midnight\nSaturday: 9:00 am-Midnight",
- @"Monday - Friday:8:00 am-5:00 pm",
- @"Sunday: 1:00 pm-2:00 am\nMonday - Thursday: 7:30 am-2:00 am\nFriday: 7:30 am-Midnight\nSaturday: 9:00 am-Midnight",
- @"Willis 24 Hr GACL\n24 Hours 7 Days a Week",
- @"Monday - Friday: 9:00 am-5:00 pm\nSaturday & Sunday:Closed",
- @"Monday - Thursday: 9:00 am-9:00 pm\nFriday: 11:00 am-4:00 pm\nSaturday: 11:00 am-4:00 pm",
- @"Sunday: 1:00 pm-11:00 pm\nMonday - Thursday: 8:00 am-11:00 pm\nFriday: 8:00 am-6:00 pm\nSaturday: 9:00 am-6:00 pm",
- @"Sunday: Closed\nMonday - Friday: 8:00 am-6:00 am\nSaturday: Closed",
- @"Monday - Thursday: 9:00 am-10:00 pm\nFriday & Saturday: 9:00 am-6:00 pm\nSunday: 1:00 pm-6:00 pm",
- @"Sunday: 1:00 pm-2:00 am\nMonday - Thursday: 7:30 am-2:00 am\nFriday: 7:30 am-Midnight\nSaturday: 9:00 am-Midnight",
- @"Monday - Friday: 1:30 pm-6:30 pm\nSaturday: Closed\nSunday:Closed",
- @"Monday - Friday: 8:00 am-Noon\nMonday - Friday: 1:00 pm-5:00 pm\nSaturday & Sunday: Closed",
- @"Sunday: 1:00 pm-2:00 am\nMonday - Thursday: 7:30 am-2:00 am\nFriday: 7:30 am:Midnight\nSaturday: 9:00 am-Midnight", nil];
- }
- if(rowView == 1){
- self.info = [NSArray arrayWithObjects:@"Media Library",@"Science and Technology Library",@"Technical Services/Preservation",@"Research Park Library Circulation",
- @"Research Park Library Reference",nil];
- self.hours = [NSArray arrayWithObjects:@"Sunday:4:00 pm-9:00 pm\nMonday - Thursday:7:45 am-10:00 pm\nFriday:7:45 am-6:00 pm\nSaturday:Noon-5:00 pm",
- @"Sunday:1:00 pm-Midnight\nMonday - Thursday:7:30 am-Midnight\nFriday:7:30 am-9:00 pm\nSaturday:9:00 am-9:00 pm",
- @"Monday - Friday:8:00 am-5:30 pm\nSaturday:Closed\nSunday:Closed",
- @"Sunday:Closed\nMonday - Thursday:9:00 am-9:45 pm\nFriday:9:00 am-4:45 pm\nSaturday:Closed",
- @"Monday - Thursday:9:00 am-10:00 pm\nFriday:9:00 am-5:00 pm\nSaturday:Closed\nSunday:Closed",nil];
- self.c_labs_mapNum = [NSArray arrayWithObjects:[NSNumber numberWithInt:11], [NSNumber numberWithInt:33],[NSNumber numberWithInt:0],
- [NSNumber numberWithInt:0], [NSNumber numberWithInt:0], nil];
- }
- }
- if(sectionView == 1){
- self.info = [NSArray arrayWithObjects:@"Bruce Cafeteria", @"Champs Cafeteria", @"Clark Grill:", @"Kerr Cafeteria",@"Mean Greens",
- @"West Cafeteria",@"University Union", nil];
- self.more_Park = [NSArray arrayWithObjects:@"Vegetarian Bar",@"BBQ Bar\nDeli Bar:",@"Baked Potato Bar\nSandwich Bar\nMexican Bar",
- @"Baked Potato Bar\nCajun Bar\nSabroso",@"Panini Bar\nGrill:",@"Panini Bar\nPizza Bar",
- @"Park Place Mkt.\nJazzman's Cart\nCafe á là Cart\nEinstein Bros. Bagels\nCampus Chat\nGrill 155\nChick-fil-A\nTaco Bell\nBruschettas\nThe Corner Store\nFreshens\nSubconnection\nJazzman's Café",nil];
- self.hours = [NSArray arrayWithObjects:@"Lunch: 10:30 am - 3:00 pm\nDeli Bar: 3:00 pm - 4:30 pm\nDinner: 4:30 pm - 8:00 pm\nFriday Dinner: 4:30 pm - 7:00 pm",
- @"Lunch: 10:30 am - 2:30 pm\nGrill: 2:30 pm - 5:00pm\nDinner: 5:00 pm - 9:00 pm\nFriday Dinner: 5:00 pm - 7:00 pm",
- @"5:00 pm - 12:00 am",
- @"Grill: 11:00 am - 4:30\nDinner: 4:30 pm - 7:00 pm\nFriday Dinner: 4:30 pm - 7:00 pm",
- @"Lunch: 10:30 am - 2:30 pm\nGrill: 2:30 pm - 4:30 pm\nDinner: 4:30pm - 7:00 pm\nFriday Dinner:4:30 pm - 7:00 pm",
- @"Lunch: 10:30 am - 2:00 pm\nGrill: 2:00 pm - 4:30 pm\nFriday Dinner: 4:30 pm - 7:00 pm",
- @"check this out",nil];
- self.c_labs_mapNum = [NSArray arrayWithObjects:[NSNumber numberWithInt:7], [NSNumber numberWithInt:84],[NSNumber numberWithInt:12],
- [NSNumber numberWithInt:37], [NSNumber numberWithInt:42], [NSNumber numberWithInt:86],
- [NSNumber numberWithInt:84], nil];
- }
- }
- - (void)viewWillAppear:(BOOL)animated {
- // NSLog(@"sectionview is %d", sectionView);
- // NSLog(@"title is%@", viewtitle);
- self.title = self.viewtitle;
- [self setupArrays];
- [table reloadData];
- }
- // Implement viewDidLoad to do additional setup after loading the view.
- - (void)viewDidLoad {
- [super viewDidLoad];
- }
- - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
- return info.count;
- NSLog(@"%d", info.count);
- }
- - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
- NSInteger temp;
- if(sectionView == 3){
- if (section == 0 ||section == 1 || section ==2 || section ==3 || section == 5){
- temp = 3;
- }else{
- temp = 2;
- }
- }else if(sectionView == 2){
- if (section == 6 || section ==9 || section ==10){
- temp = 4;
- }else{
- temp =5 ;
- }
- }else if(sectionView == 0){
- if (section ==3 || section == 4){
- temp = 2;
- }else{
- temp =3 ;
- }
- }else{
- temp = 4;
- }
- return temp;
- }
- - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
- static NSString *CellIdentifier = @"Cell";
- CustomCells2 *cell = (CustomCells2 *)[tableView dequeueReusableCellWithIdentifier:CellIdentifier];
- if (cell == nil) {
- cell = [[[CustomCells2 alloc] initWithFrame:CGRectZero reuseIdentifier:CellIdentifier] autorelease];
- }
- if(sectionView == 0){
- if(indexPath.row == 0){
- [cell setData:[info objectAtIndex:indexPath.section]];
- cell.selectionStyle = UITableViewCellSelectionStyleNone;
- }
- if(indexPath.row == 1){
- [cell setData:[hours objectAtIndex:indexPath.section]];
- cell.selectionStyle = UITableViewCellSelectionStyleNone;
- }
- if(indexPath.row == 2){
- [cell setData:@"Locate on Map"];
- }
- }
- if(sectionView == 1){
- if(indexPath.row == 0){
- [cell setData:[info objectAtIndex:indexPath.section]];
- cell.selectionStyle = UITableViewCellSelectionStyleNone;
- }
- if(indexPath.row == 1){
- [cell setData:[hours objectAtIndex:indexPath.section]];
- cell.selectionStyle = UITableViewCellSelectionStyleNone;
- }
- if(indexPath.row == 2){
- [cell setData:[more_Park objectAtIndex:indexPath.section]];
- cell.selectionStyle = UITableViewCellSelectionStyleNone;
- }
- if(indexPath.row == 3){
- [cell setData:@"Locate on Map"];
- }
- }
- if(sectionView == 2){
- if(indexPath.row == 0){
- [cell setData:[info objectAtIndex:indexPath.section]];
- cell.selectionStyle = UITableViewCellSelectionStyleNone;
- }
- if(indexPath.row == 1){
- [cell setData:[hours objectAtIndex:indexPath.section]];
- cell.selectionStyle = UITableViewCellSelectionStyleNone;
- }
- if(indexPath.row == 2){
- [cell setData:[NSString stringWithFormat:@"Room Number: %@",[more_Park objectAtIndex:indexPath.section]]];
- cell.selectionStyle = UITableViewCellSelectionStyleNone;
- }
- if(indexPath.row == 3){
- [cell setData:[number objectAtIndex:indexPath.section]];
- }
- if(indexPath.row == 4){
- [cell setData:@"Locate on Map"];
- }
- }
- if(sectionView == 3){
- if(indexPath.row == 0){
- [cell setData:[info objectAtIndex:indexPath.section]];
- cell.selectionStyle = UITableViewCellSelectionStyleNone;
- }
- if(indexPath.row == 1){
- [cell setData:[hours objectAtIndex:indexPath.section]];
- cell.selectionStyle = UITableViewCellSelectionStyleNone;
- }
- if(indexPath.row == 2){
- [cell setData:@"Locate on Map"];
- }
- }
- // Configure the cell
- return cell;
- }
- - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
- if(sectionView == 3){
- if(indexPath.row == 0) {
- NSString *text = [info objectAtIndex:indexPath.section];
- UIFont *font = [UIFont systemFontOfSize:16];
- CGSize constraint = CGSizeMake(300,4000);
- CGSize size = [text sizeWithFont:font constrainedToSize:constraint lineBreakMode:UILineBreakModeWordWrap];
- return size.height+30;
- }else if(indexPath.row == 1) {
- NSString *text = [hours objectAtIndex:indexPath.section];
- UIFont *font = [UIFont systemFontOfSize:16];
- CGSize constraint = CGSizeMake(300,4000);
- CGSize size = [text sizeWithFont:font constrainedToSize:constraint lineBreakMode:UILineBreakModeWordWrap];
- return size.height+30;
- }else{
- return 50;
- }
- }else if(sectionView == 2){
- if(indexPath.row == 0) {
- NSString *text = [info objectAtIndex:indexPath.section];
- UIFont *font = [UIFont systemFontOfSize:16];
- CGSize constraint = CGSizeMake(300,4000);
- CGSize size = [text sizeWithFont:font constrainedToSize:constraint lineBreakMode:UILineBreakModeWordWrap];
- return size.height+30;
- }else if(indexPath.row == 1) {
- NSString *text = [hours objectAtIndex:indexPath.section];
- UIFont *font = [UIFont systemFontOfSize:16];
- CGSize constraint = CGSizeMake(300,4000);
- CGSize size = [text sizeWithFont:font constrainedToSize:constraint lineBreakMode:UILineBreakModeWordWrap];
- return size.height+30;
- }else{
- return 50;
- }
- }else if(sectionView == 1){
- if(indexPath.row == 0){
- NSString *text = [info objectAtIndex:indexPath.section];
- UIFont *font = [UIFont systemFontOfSize:16];
- CGSize constraint = CGSizeMake(300,4000);
- CGSize size = [text sizeWithFont:font constrainedToSize:constraint lineBreakMode:UILineBreakModeWordWrap];
- return size.height+30;
- }else if(indexPath.row == 1){
- NSString *text = [hours objectAtIndex:indexPath.section];
- UIFont *font = [UIFont systemFontOfSize:16];
- CGSize constraint = CGSizeMake(300,4000);
- CGSize size = [text sizeWithFont:font constrainedToSize:constraint lineBreakMode:UILineBreakModeWordWrap];
- return size.height+30;
- }else if(indexPath.row == 2){
- NSString *text = [more_Park objectAtIndex:indexPath.section];
- UIFont *font = [UIFont systemFontOfSize:16];
- CGSize constraint = CGSizeMake(300,4000);
- CGSize size = [text sizeWithFont:font constrainedToSize:constraint lineBreakMode:UILineBreakModeWordWrap];
- return size.height+30;
- }
- return 50;
- }else{
- if(indexPath.row == 0) {
- NSString *text = [info objectAtIndex:indexPath.section];
- UIFont *font = [UIFont systemFontOfSize:16];
- CGSize constraint = CGSizeMake(300,4000);
- CGSize size = [text sizeWithFont:font constrainedToSize:constraint lineBreakMode:UILineBreakModeWordWrap];
- return size.height+30;
- }else if(indexPath.row == 1) {
- NSString *text = [hours objectAtIndex:indexPath.section];
- UIFont *font = [UIFont systemFontOfSize:16];
- CGSize constraint = CGSizeMake(300,4000);
- CGSize size = [text sizeWithFont:font constrainedToSize:constraint lineBreakMode:UILineBreakModeWordWrap];
- return size.height+30;
- }else{
- return 50;
- }
- }
- }
- - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
- Campus_TourAppDelegate *appdelegate = (Campus_TourAppDelegate *)[[UIApplication sharedApplication] delegate];//create a delegate object
- NSLog(@"sectionvew %d rowview %d", sectionView, rowView);
- if (newMapView == nil){
- Map *nView =[[Map alloc] initWithNibName:@"Map" bundle:nil];
- self.newMapView = nView;
- [nView release];
- }
- /////parking lots
- if(sectionView == 3 && indexPath.row == 2){
- if(indexPath.section == 0){
- newMapView.load_view = 2;
- }
- if(indexPath.section == 1){
- newMapView.load_view = 3;
- }
- if(indexPath.section == 2){
- newMapView.load_view = 5;
- }
- if(indexPath.section == 3){
- newMapView.load_view = 4;
- }
- if(indexPath.section == 5){
- newMapView.load_view = 6;
- }
- [self.navigationController pushViewController:newMapView animated:YES];
- }
- //////////cafeterias////////
- if(sectionView == 1 && indexPath.row == 3){
- newMapView.building = [[c_labs_mapNum objectAtIndex:indexPath.section] intValue];
- appdelegate.first = NO;
- newMapView.load_view = 0;
- [self.navigationController pushViewController:newMapView animated:YES];
- }
- //////////computer labs////////
- ////call people
- if(sectionView ==2 && indexPath.row == 3){
- // NSURL *url = [NSURL URLWithString:[number objectAtIndex:indexPath.section]];
- // [[UIApplication sharedApplication] openURL:url];
- NSString *temp = [NSString stringWithFormat:@"tel:%@", [number objectAtIndex:indexPath.section]];
- NSURL *phoneNumberURL = [NSURL URLWithString:temp];
- [[UIApplication sharedApplication] openURL:phoneNumberURL];
- }
- ////find on map
- if(sectionView == 2 && indexPath.row == 4){
- newMapView.building = [[c_labs_mapNum objectAtIndex:indexPath.section] intValue];
- appdelegate.first = NO;
- newMapView.load_view = 0;
- [self.navigationController pushViewController:newMapView animated:YES];
- }
- //////////libraries
- /*
- if(sectionView == 0 && rowView == 0){
- appdelegate.building = [[c_labs_mapNum objectAtIndex:indexPath.section] intValue];
- appdelegate.isNew = NO;
- newMapView.load_view = 0;
- [self.navigationController pushViewController:newMapView animated:YES];
- }*/
- if(sectionView == 0 && rowView == 1){
- newMapView.building = [[c_labs_mapNum objectAtIndex:indexPath.section] intValue];
- // NSLog(@"app building %d", appdelegate.building);
- appdelegate.first = NO;
- newMapView.load_view = 0;
- [self.navigationController pushViewController:newMapView animated:YES];
- }
- }
- - (void)didReceiveMemoryWarning {
- NSLog(@"memory warning viewc_stuff.m");
- [super didReceiveMemoryWarning];
- }
- - (void)dealloc {
- [number release];
- [c_labs_mapNum release];
- [table release];
- [info release];
- [hours release];
- [more_Park release];
- [newMapView release];
- [viewtitle release];
- [super dealloc];
- }
- @end
Add Comment
Please, Sign In to add comment