本节书摘来自异步社区《iPad开发从入门到精通》一书中的第6章,第6.2节系统主界面,作者 杨春泽,更多章节内容可以访问云栖社区“异步社区”公众号查看

6.2 系统主界面
iPad开发从入门到精通
本章实例的的源码保存在“:daima6Bus”,默认的系统主界面是线路查询视图,在线路查询视图CBus_LineView.xib顶部设置了一个查询表单,在下方列表显示系统内的公交线路。线路查询视图的UI界面如图6-1所示。


6.2.1 线路查询视图
实现文件CBus_LineViewController.h的代码如下所示。

#import <UIKit/UIKit.h>
@interface CBus_LineViewController : UIViewController <UITableViewDelegate,
UITableViewDataSource,UISearchDisplayDelegate, UISearchBarDelegate>{UITableView    *busLineTableView;NSMutableArray  *filteredListContent;
}
@property(nonatomic, retain) IBOutlet UITableView   *busLineTableView;
@property(nonatomic, retain) NSMutableArray *filteredListContent;
@end
文件CBus_LineViewController.m是文件CBus_LineViewController.h的实现,功能是载入设置的视图界面,显示一个搜索表单,并在表单下方列表显示30条公交线路信息,并且可以根据用户输入的搜索关键字来显示搜索结果。文件CBus_LineViewController.m的具体实现代码如下所示。#import "CBus_LineViewController.h"
#import "CBus_LineDetailViewController.h"
#import "CDataContainer.h"@implementation CBus_LineViewController@synthesize busLineTableView,filteredListContent;// 通过viewdidload的额外设置后加载视图
- (void)viewDidLoad {[super viewDidLoad];self.filteredListContent = [NSMutableArray arrayWithCapacity:[[CDataContainer Instance].lineNameArray count]];
}
#pragma mark -
#pragma mark View lifecycle
- (void)viewWillAppear:(BOOL)animated {[super viewWillAppear:animated];[self.busLineTableView reloadData];NSLog(@"-----Nav------%@",self.navigationController.viewControllers);NSUserDefaults *userDefault = [NSUserDefaults standardUserDefaults];NSInteger styleNum = [userDefault integerForKey:@"styleType"];switch (styleNum) {case 0:{[UIApplication sharedApplication].statusBarStyle = UIStatusBarStyleDefault;self.navigationController.navigationBar.barStyle = UIBarStyleDefault;self.searchDisplayController.searchBar.barStyle = UIBarStyleDefault;break;}case 1:{[UIApplication sharedApplication].statusBarStyle = UIStatusBarStyle BlackOpaque;self.navigationController.navigationBar.barStyle = UIBarStyleBlackOpaque;self.searchDisplayController.searchBar.barStyle = UIBarStyleBlackOpaque;break;}}[self.busLineTableView reloadData];
}- (void)viewDidAppear:(BOOL)animated {
[super viewDidAppear:animated];
}
#pragma mark -
#pragma mark Table view data source
- (NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section{return @"公交线路";
}
- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section{return 30;
}
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {// Return the number of sectionsreturn 1;
}- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {// 返回行数if(tableView == self.searchDisplayController.searchResultsTableView){return [filteredListContent count];}else {return [[CDataContainer Instance].lineNameArray count];}
}
// 自定义表格单元的外观
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {static NSString *CellIdentifier = @"Cell";  UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];if (cell == nil) {cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:CellIdentifier] autorelease];}  cell.selectionStyle = UITableViewCellSelectionStyleGray;// 配置单元…if (tableView == self.searchDisplayController.searchResultsTableView){[[CDataContainer Instance] GetLineStationFromTableSequence:[[CDataContainer Instance].lineNameArray indexOfObject:
[filteredListContent objectAtIndex:indexPath.row]]];NSString *beginStr = [[CDataContainer Instance].stationNameArray objectAtIndex:
[[CDataContainer Instance] GetBusLineSequence ByIndex:0]-1];NSString *endStr = [[CDataContainer Instance].stationNameArray objectAtIndex:              [[CDataContainer Instance] GetBusLineSequence
ByIndex:[[CDataContainer Instance].sequenceNumArray count]-1]-1];NSString *detailStr = [[NSString alloc] initWithFormat:@"%@-->%@",beginStr,endStr];cell.detailTextLabel.font = [UIFont systemFontOfSize:12];cell.detailTextLabel.text = detailStr;[detailStr release];cell.textLabel.text = [filteredListContent objectAtIndex:indexPath.row];}else{[[CDataContainer Instance] GetLineStationFromTableSequence:indexPath.row];NSString *beginStr = [[CDataContainer Instance].stationNameArray objectAtIndex:               [[CDataContainer Instance] GetBusLineSequence ByIndex:0]-1];NSString *endStr = [[CDataContainer Instance].stationNameArray objectAtIndex:
GetBusLineSequenceByIndex:[[CDataContainer Instance].sequenceNumArray count]-1]-1];      NSString *detailStr = [[NSString alloc] initWithFormat:@"%@-->%@",beginStr, endStr];cell.detailTextLabel.font = [UIFont systemFontOfSize:12];cell.detailTextLabel.text = detailStr;[detailStr release];cell.textLabel.text = [[CDataContainer Instance].lineNameArray objectAtIndex: indexPath.row];}cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;cell.imageView.image = [UIImage imageNamed:@"bus_table_line.png"];return cell;
}
#pragma mark -
#pragma mark Table view delegate
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{// 创造和推动另一个视图控制器CBus_LineDetailViewController *detailViewController = [[CBus_LineDetailViewController alloc] initWithNibName:@"CBus_LineDetailView" bundle:nil];// 选定的对象到新视图控制器if (tableView == self.searchDisplayController.searchResultsTableView){    detailViewController.currentLineName = [filteredListContent objectAtIndex: indexPath.row];detailViewController.currentLineIndex = [[CDataContainer Instance].lineName Array indexOfObject:[filteredListContent objectAtIndex:indexPath.row]];}else{detailViewController.currentLineName = [[CDataContainer Instance].lineName Array objectAtIndex:indexPath.row];detailViewController.currentLineIndex = indexPath.row;}[self.navigationController pushViewController:detailViewController animated:YES];[detailViewController release];
}
#pragma mark -
#pragma mark Content Filtering
- (void)filterContentForSearchText:(NSString*)searchText scope:(NSString*)scope{/*基于搜索文本和范围更新过滤阵列*/// 清除过滤数组[self.filteredListContent removeAllObjects]; /*主要搜索与列表类型相匹配的范围,其名字要匹配比赛查找的文字;添加与项目匹配的过滤阵列*/for (int i = 0; i < [[CDataContainer Instance].lineNameArray count]; i++){NSString * searchInfo = [[CDataContainer Instance].lineNameArray objectAtIndex:i];NSComparisonResult result = [searchInfo compare:searchText       options:(NSCaseInsensitiveSearch|NSDiacriticInsensitiveSearch)range:NSMakeRange(0, [searchText length])];if (result == NSOrderedSame){[self.filteredListContent addObject:searchInfo];}}
}
#pragma mark -
#pragma mark UISearchDisplayController Delegate Methods
- (BOOL)searchDisplayController:(UISearchDisplayController *)controller shouldReload TableForSearchString:(NSString *)searchString{[self filterContentForSearchText:searchString scope:[[self.searchDisplayController.searchBar scopeButtonTitles] objectAtIndex:[self. searchDisplayController.searchBar selectedScopeButtonIndex]]];
// 重新加载返回的搜索结果return YES;
}
- (BOOL)searchDisplayController:(UISearchDisplayController *)controller shouldReload TableForSearchScope:(NSInteger)searchOption{[self filterContentForSearchText:[self.searchDisplayController.searchBar text]scope:[[self.searchDisplayController.searchBar scopeButtonTitles] objectAtIndex:
searchOption]];// Return YES to cause the search result table view to be reloadedreturn YES;
}
// Override to allow orientations other than the default portrait orientation
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrien tation{// Return YES for supported orientationsreturn (interfaceOrientation == UIInterfaceOrientationPortrait);
}
- (void)didReceiveMemoryWarning {// Releases the view if it doesn't have a superview[super didReceiveMemoryWarning];self.busLineTableView = nil;
}
- (void)viewDidUnload {[super viewDidUnload];// Release any retained subviews of the main view// e.g. self.myOutlet = nil;
}
- (void)dealloc {[busLineTableView release];[filteredListContent release];[super dealloc];
}
@end

执行效果如图6-2所示。


6.2.2 线路详情模块
本模块的功能是显示某一条线路的详细信息,在上方显示线路名、票价、首班时间和末班时间,在下方列表显示各个站点。线路详情视图CBus_LineDetailView.xib的UI界面如图6-3所示。


实现文件 CBus_LineDetailViewController.h的代码如下所示。

#import <UIKit/UIKit.h>
enum ERunType{EUpLineType,EDownLineType,ENoneLineType
};
@interface CBus_LineDetailViewController : UIViewController <UITableViewDelegate, UITableViewDataSource>{UITableView    *busLineDetailTableView;//当前查询线路的indexNSInteger    currentLineIndex;NSString    *currentLineName;NSInteger    runType;NSMutableArray  *upLineArray;NSMutableArray  *downLineArray;}
@property(nonatomic, retain) IBOutlet UITableView *busLineDetailTableView;
@property(nonatomic, retain)  NSString *currentLineName;
@property(nonatomic)      NSInteger currentLineIndex;
-(void)AddLineToFavorite;
@end
文件CBus_LineDetailViewController.m是CBus_LineDetailViewController.h的实现,功能是显示某条线路的详细信息,它不但列表显示了此线路中的各个站点,而且实现了收藏功能。文件CBus_LineDetailViewController.m的具体实现代码如下所示。#import "CBus_LineDetailViewController.h"
#import "CBus_StationDetailViewController.h"
#import "CBus_LineDetailLineViewController.h"
#import "CDataContainer.h"
@implementation CBus_LineDetailViewController
@synthesize busLineDetailTableView,currentLineName;
@synthesize currentLineIndex;
// 载入界面
- (void)viewDidLoad {[super viewDidLoad];  self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithBar ButtonSystemItem:UIBarButtonSystemItemAddtarget:selfaction:@selector(AddLineToFavorite)];[[CDataContainer Instance] GetLineStationFromTableSequence:currentLineIndex];
}
#pragma mark -
#pragma mark View lifecycle
- (void)viewWillAppear:(BOOL)animated{[super viewWillAppear:animated];[self.busLineDetailTableView reloadData];NSUserDefaults *userDefault = [NSUserDefaults standardUserDefaults];NSInteger styleNum = [userDefault integerForKey:@"styleType"];switch (styleNum) {case 0:{[UIApplication sharedApplication].statusBarStyle = UIStatusBarStyleDefault;self.navigationController.navigationBar.barStyle = UIBarStyleDefault;self.searchDisplayController.searchBar.barStyle = UIBarStyleDefault;break;}case 1:{[UIApplication sharedApplication].statusBarStyle = UIStatusBarStyle BlackOpaque;self.navigationController.navigationBar.barStyle = UIBarStyleBlackOpaque;self.searchDisplayController.searchBar.barStyle = UIBarStyleBlackOpaque;break;}}  [[CDataContainer Instance] GetLineStationFromTableSequence:currentLineIndex];[self.busLineDetailTableView reloadData];  NSLog(@"-----Nav----%@",self.navigationController.viewControllers);}
- (void)viewDidDisappear:(BOOL)animated {[super viewDidDisappear:animated];
}
-(void)AddLineToFavorite
{NSLog(@"-------addLineToFavorite---------%@---%d",currentLineName,currentLineIndex);for(NSString *lineName in [CDataContainer Instance].favoriteLineNameArray){if ([lineName isEqualToString:currentLineName]) {UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"收藏"message:[NSString stringWithFormat:@"%@ 已收藏",currentLineName]delegate:selfcancel ButtonTitle:@"确定"otherButtonTitles:nil];[alert show];[alert release];return;}}  [[CDataContainer Instance] InsertFavoriteInfoToDatabase:0 AddName:currentLineName AddIndex:currentLineIndexAddNameEnd:nilAddIndexEnd:0];UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"收藏" message:[NSStringstringWithFormat:@"收藏 %@ 成功",currentLineName]delegate:selfcancelButtonTitle:@"确定" otherButtonTitles:nil];[alert show];[alert release];
}#pragma mark -
#pragma mark Table view data source
- (NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section{return currentLineName;
}
- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section{return 30;
}
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {// Return the number of sectionsreturn 1;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{// 返回行数.return [[CDataContainer Instance].sequenceNumArray count];
}
//自定义表格单元的外观视图
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
static NSString *CellIdentifier = @"Cell";  UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];if (cell == nil) {cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:CellIdentifier] autorelease];}  cell.selectionStyle = UITableViewCellSelectionStyleGray;cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;// 配置单元cell.textLabel.text = [[CDataContainer Instance].stationNameArray objectAtIndex: [[CDataContainer Instance] GetBusLineSequenceByIndex:indexPath.row]-1];cell.imageView.image = [UIImage imageNamed:@"bus_table_stat.png"];return cell;
}
#pragma mark -
#pragma mark Table view delegate
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {// 创造另一个视图控制器CBus_LineDetailLineViewController *detailViewController = [[CBus_LineDetailLine ViewController alloc] initWithNibName:@"CBus_LineDetailLineView" bundle:nil];detailViewController.currentStationName = [[CDataContainer Instance].stationNameArray objectAtIndex:[[CDataContainer Instance] GetBusLineSequenceByIndex:indexPath.row]-1];detailViewController.currentStationIndex = [[CDataContainer Instance].stationNameArray indexOfObject:detailViewController.currentStationName]+1;[self.navigationController pushViewController:detailViewController animated:YES];[detailViewController release];
}
-(void)tableView:(UITableView *)tableView accessoryButtonTappedForRowWithIndexPath:(NSIndexPath *)indexPath{
}
// 显示默认线路的图片
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrien tation {// Return YES for supported orientationsreturn (interfaceOrientation == UIInterfaceOrientationPortrait);
}
- (void)didReceiveMemoryWarning {//如果没有视图则释放它[super didReceiveMemoryWarning];self.busLineDetailTableView = nil;
}
- (void)viewDidUnload {[super viewDidUnload];// 释放任何保留的主视图// e.g. self.myOutlet = nil;
}
- (void)dealloc {[busLineDetailTableView release];[super dealloc];
}
@end

执行效果如图6-4所示。


6.2.3 线路中某站详情
本模块的功能是显示某一条线路中某个站的详细信息,显示通过这个站的所有线路。此模块的视图CBus_LineDetailLineView.xib的UI界面如图6-5所示。


实现文件 CBus_LineDetailLineViewController.h的代码如下所示。

#import <UIKit/UIKit.h>
@interface CBus_LineDetailLineViewController : UIViewController <UITableViewDelegate, UITableViewDataSource>{UITableView     *busStationDetailView;  NSInteger      currentStationIndex;NSString      *currentStationName;NSInteger      beginStationIndex;NSString       *beginStationName;NSInteger      endStationIndex;NSString       *endStationName;BOOL         isStatToStat;NSMutableArray  *beginStationLineArray;NSMutableArray  *endStationLineArray;NSMutableArray  *StatToStatLineArray;
}
@property(nonatomic, retain) IBOutlet   UITableView  *busStationDetailView;
@property(nonatomic, retain)   NSString     *currentStationName;
@property(nonatomic)        NSInteger     currentStationIndex;
@property(nonatomic, retain)   NSString     *beginStationName;
@property(nonatomic)        NSInteger     beginStationIndex;
@property(nonatomic, retain)   NSString     *endStationName;
@property(nonatomic)        NSInteger     endStationIndex;
@property(nonatomic)        BOOL         isStatToStat;
@property(nonatomic, retain)   NSMutableArray  *beginStationLineArray;
@property(nonatomic, retain)   NSMutableArray  *endStationLineArray;
@property(nonatomic, retain)   NSMutableArray  *StatToStatLineArray;
- (BOOL)findTwoStationInOneLine;
- (BOOL)findTwoStationInTwoLine;@end
文件CBus_LineDetailLineViewController.m是文件CBus_LineDetailLineViewController.h的实现,具体代码如下所示。#import "CBus_LineDetailLineViewController.h"
#import "CBus_LineDetailViewController.h"
#import "CDataContainer.h"
@implementation CBus_LineDetailLineViewController
@synthesize busStationDetailView;
@synthesize currentStationName,currentStationIndex;
@synthesize beginStationName,beginStationIndex,endStationName,endStationIndex;
@synthesize isStatToStat;
@synthesize beginStationLineArray, endStationLineArray, StatToStatLineArray;
// 初始化视图
- (void)viewDidLoad{[super viewDidLoad];  self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithBar ButtonSystemItem:UIBarButtonSystemItemAddtarget:self
action:@selector(AddStationToFavorite)];if (isStatToStat){NSLog(@"---------isStatToStat-------");[[CDataContainer Instance] GetStationLineFromTableSequence:beginStationIndex];beginStationLineArray = [NSMutableArray arrayWithArray:[CDataContainer
Instance].stationLineArray];NSLog(@"---------beginStationLineArray-------%@",beginStationLineArray);[[CDataContainer Instance] GetStationLineFromTableSequence:endStationIndex];endStationLineArray = [NSMutableArray arrayWithArray:[CDataContainer
Instance].stationLineArray];NSLog(@"---------endStationLineArray-------%@",endStationLineArray);if ([self findTwoStationInOneLine]){return;}else if([self findTwoStationInTwoLine]){return;}}else {NSLog(@"---------isStat-------");[[CDataContainer Instance] GetStationLineFromTableSequence:currentStationIndex];}
}
- (BOOL)findTwoStationInOneLine{NSLog(@"-------findTwoStationInOneLine------");if (StatToStatLineArray == nil){StatToStatLineArray = [[NSMutableArray alloc] init];}for (NSString *beginStationStr in beginStationLineArray){for(NSString *endStationStr in endStationLineArray){if ([beginStationStr isEqualToString:endStationStr]){[StatToStatLineArray addObject:beginStationStr];NSLog(@"-----------StatToStatLineArray--------%@",StatToStatLineArray);}}}if (StatToStatLineArray){return YES;}return NO;
}
- (BOOL)findTwoStationInTwoLine{return NO;
}#pragma mark -
#pragma mark View lifecycle- (void)viewWillAppear:(BOOL)animated {[super viewWillAppear:animated];[self.busStationDetailView reloadData];NSLog(@"-----Nav----%@",self.navigationController.viewControllers);NSUserDefaults *userDefault = [NSUserDefaults standardUserDefaults];NSInteger styleNum = [userDefault integerForKey:@"styleType"];  switch (styleNum){case 0:{[UIApplication sharedApplication].statusBarStyle = UIStatusBarStyleDefault;self.navigationController.navigationBar.barStyle = UIBarStyleDefault;self.searchDisplayController.searchBar.barStyle = UIBarStyleDefault;break;}case 1:{[UIApplication sharedApplication].statusBarStyle = UIStatusBarStyle BlackOpaque;self.navigationController.navigationBar.barStyle = UIBarStyleBlackOpaque;self.searchDisplayController.searchBar.barStyle = UIBarStyleBlackOpaque;break;}}
}
- (void)viewDidDisappear:(BOOL)animated {[super viewDidDisappear:animated];
}-(void)AddStationToFavorite{NSLog(@"-----AddStationToFavorite-----%@----%d",currentStationName,currentStationIndex);  for(NSString *lineName in [CDataContainer Instance].favoriteStationNameArray){if ([lineName isEqualToString:currentStationName]){UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"收藏" message:[NSString stringWithFormat:@"%@ 已收藏",currentStationName]delegate:selfcancelButtonTitle:@"确定"otherButtonTitles:nil];[alert show];[alert release];return;}}[[CDataContainer Instance] InsertFavoriteInfoToDatabase:1 AddName:currentStation Name AddIndex:currentStationIndex AddNameEnd:nil AddIndexEnd:0];UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"收藏"message:[NSString stringWithFormat:@"收藏 %@ 成功",current StationName]
delegate:self cancelButtonTitle:@"确定" otherButtonTitles:nil];[alert show];[alert release];
}
#pragma mark -
#pragma mark Table view data source
- (NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section{if (isStatToStat){return [[NSString alloc] initWithFormat:@"%@——>%@",beginStationName,endStationName];}else{return currentStationName;}  return nil;
}
- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section{return 30;
}
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {// Return the number of sectionsreturn 1;
}- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{// Return the number of rows in the sectionif (isStatToStat){return [StatToStatLineArray count];}else{return [[CDataContainer Instance].stationLineArray count];}return 0;
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{static NSString *CellIdentifier = @"Cell";UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];if (cell == nil){cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:CellIdentifier] autorelease];}  cell.selectionStyle = UITableViewCellSelectionStyleGray;cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;if (isStatToStat){cell.textLabel.text = [[CDataContainer Instance].lineNameArray objectAtIndex:[[StatToStatLineArray objectAtIndex:indexPath.row] intValue]/2-1];}else{[[CDataContainer Instance] GetLineStationFromTableSequence:[[CDataContainer Instance].lineNameArray indexOfObject:[[CDataContainer Instance].lineNameArray objectAtIndex:[[CDataContainer Instance] GetBusStationLine ByIndex:indexPath.row]-1]]];NSString *beginStr = [[CDataContainer Instance].stationNameArray
objectAtIndex:[[CDataContainer Instance] GetBusLineSequenceByIndex:0]-1];NSString *endStr = [[CDataContainer Instance].stationNameArray objectAtIndex:[[CDataContainer Instance] GetBusLineSequence ByIndex:[[CDataContainer Instance].sequenceNumArray count]-1]-1];  NSString *detailStr = [[NSString alloc] initWithFormat:@"%@-->%@",beginStr, endStr];cell.detailTextLabel.font = [UIFont systemFontOfSize:12];cell.detailTextLabel.text = detailStr;[detailStr release];cell.textLabel.text = [[CDataContainer Instance].lineNameArray objectAtIndex:[[CDataContainer Instance] GetBusStation LineByIndex:
indexPath.row]-1];}cell.imageView.image = [UIImage imageNamed:@"bus_table_line.png"];return cell;
}
#pragma mark -
#pragma mark Table view delegate
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {// Navigation logic may go here. Create and push another view controller.CBus_LineDetailViewController *lineDetailViewController = [self.navigation
Controller.viewControllers objectAtIndex:1];  lineDetailViewController.currentLineName = [[CDataContainer Instance].
lineNameArray objectAtIndex:[[CDataContainer Instance] GetBusStationLineByIndex: indexPath.row]-1];lineDetailViewController.currentLineIndex = [[CDataContainer Instance]
.lineNameArray indexOfObject:lineDetailViewController.currentLineName];
[self.navigationController popViewControllerAnimated:YES];
}// Override to allow orientations other than the default portrait orientation- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrien tion {// Return YES for supported orientationsreturn (interfaceOrientation == UIInterfaceOrientationPortrait);}- (void)didReceiveMemoryWarning {// Releases the view if it doesn't have a superview[super didReceiveMemoryWarning];// Release any cached data, images, etc. that aren't in use
}
- (void)viewDidUnload {[super viewDidUnload];// Release any retained subviews of the main view.// e.g. self.myOutlet = nil;
}
- (void)dealloc {[busStationDetailView release];[super dealloc];
}
@end

《iPad开发从入门到精通》——6.2节系统主界面相关推荐

  1. 《iPad开发从入门到精通》——6.6节系统设置

    本节书摘来自异步社区<iPad开发从入门到精通>一书中的第6章,第6.6节系统设置,作者 杨春泽,更多章节内容可以访问云栖社区"异步社区"公众号查看 6.6 系统设置 ...

  2. 《iPad开发从入门到精通》——6.4节收藏历史

    本节书摘来自异步社区<iPad开发从入门到精通>一书中的第6章,第6.4节收藏历史,作者 杨春泽,更多章节内容可以访问云栖社区"异步社区"公众号查看 6.4 收藏历史 ...

  3. 《iPad开发从入门到精通》——6.5节地图信息

    本节书摘来自异步社区<iPad开发从入门到精通>一书中的第6章,第6.5节地图信息,作者 杨春泽,更多章节内容可以访问云栖社区"异步社区"公众号查看 6.5 地图信息 ...

  4. 《iPad开发从入门到精通》——6.3节站站查询

    本节书摘来自异步社区<iPad开发从入门到精通>一书中的第6章,第6.3节站站查询,作者 杨春泽,更多章节内容可以访问云栖社区"异步社区"公众号查看 6.3 站站查询 ...

  5. 《iOS移动开发从入门到精通》图书连载一:如果你也想开发一款自己的APP,可以看一下这篇文

    前言:互联网+时代给自己多一个选择的机会,尝试开发一款属于自己的APP,绝对是件激动人心的事情!<iOS移动开发从入门到精通>已经上市并和大家见面.从今天起,我会将把图书的部分内容以连载的 ...

  6. 《Java 开发从入门到精通》—— 2.2 编写第一段Java程序

    本节书摘来异步社区<Java 开发从入门到精通>一书中的第2章,第2.2节,作者: 扶松柏 , 陈小玉,更多章节内容可以访问云栖社区"异步社区"公众号查看. 2.2 编 ...

  7. 《Visual C++ 开发从入门到精通》——2.7 变量

    本节书摘来自异步社区出版社<Visual C++ 开发从入门到精通>一书中的第2章,第2.7节,作者: 王东华 , 李樱,更多章节内容可以访问云栖社区"异步社区"公众号 ...

  8. 《ASP.NET 开发从入门到精通》----2.3 编译和部署ASP.NET程序

    本节书摘来自异步社区<ASP.NET 开发从入门到精通>一书中的第2章,第2.3节,著 张明星 ,责任编辑 张 涛, 更多章节内容可以访问云栖社区"异步社区"公众号查看 ...

  9. 《51单片机应用开发从入门到精通》——2.2 跑马灯实例

    本节书摘来自异步社区<51单片机应用开发从入门到精通>一书中的第2章,第2.2节,作者 张华杰,更多章节内容可以访问云栖社区"异步社区"公众号查看. 2.2 跑马灯实例 ...

最新文章

  1. Beaglebone Black教程项目1闪烁板载LED
  2. TCP/IP详解--第十二章
  3. linux中find命令列举,Linux中常见find命令的使用
  4. Quartz框架学习(1)—核心层次结构
  5. DNS详解: A记录,子域名,CNAME别名,PTR,MX,TXT,SRV,TTL
  6. java netty post_API调用Netty长链接执行发送消息(在线数、用户列表)
  7. 计算机数学基础试题,计算机数学基础(A)综合练习
  8. 使用apache.commons.fileupload 进行文件上传
  9. 16元日薪,从阿里云雇佣一个专家阿里云中小企业AI产品码栈解析
  10. 牛顿迭代法的图像推导思路以及代码
  11. 揭穿内存厂家“谎言”,实测内存带宽真实表现
  12. java跨域问题Response to preflight request doesn‘t pass access control check: No ‘Access-Control-Allow-Or
  13. 结算系统功能详解-上篇
  14. [网络性能测试学习笔记] 测试AX3 Pro WiFi6无线路由器的系统转发能力(硬件转发交换能力L23吞吐量,L47应用层能力-最大可支持设备用户数,并发连接数等)
  15. Oracle 中的Userenv() 达梦中如何处理?
  16. 转载:深入研究-webkit-overflow-scrolling:touch及ios滚动
  17. 计算机导论模板,计算机导论论文提纲范文模板 计算机导论论文大纲怎样写
  18. 【高级UI】【026】手动为RecyclerView添加橡皮筋拉伸回弹效果
  19. pytest之Monkeypatching(猴子补丁)
  20. 衡石可视化:从 eCharts 到 namjagbarwa

热门文章

  1. Ubuntu14.04环境下配置TFTP服务器
  2. Codeforces Round #237 (Div. 2)
  3. cognos report上钻下钻报表处理方法(2)
  4. 图像视频处理中Win7 32位+VS2010+OpenCV2.3.1的配置过程
  5. leetcode字符串练习--整数反转
  6. Linux学习笔记之权限与命令之间的关系(重要)及文件与目录知识总结
  7. java 嵌套类implement_有关 C++ 嵌套类
  8. odbc数据库access丢失_有关使用access数据库,odbc中碰到的一些问题。
  9. mysql用来干嘛的_CPU占用又爆了?MySQL到底在干什么
  10. 不采用服务器虚拟化的优缺点,为什么要进行虚拟化部署?虚拟化的缺点是什么?...