《iPad开发从入门到精通》——6.3节站站查询-阿里云开发者社区

开发者社区> 异步社区> 正文

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

简介:
+关注继续查看

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

6.3 站站查询
iPad开发从入门到精通
本模块的功能是提供站站查询功能,只需输入起始站和目的站的名称,就可以快速查询到符合要求的公交线路了。在本节的内容中,将详细讲解站站查询模块的具体实现流程。

6.3.1 站站查询主视图
站站查询主视图CBus_StatToStatView.xib的UI界面如图6-6所示,在上方显示搜索表单,下方列表显示了30条线路。


1cf818d75462ab0774f4d1fb8ba11403e52a42e0

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

#import <UIKit/UIKit.h>
#define kBeginStationComponent 0
#define kEndStationComponent 1
enum EStationType{
  EBeginStationType,
  EEndStationType,
  ENoneStationType
};
@interface CBus_StatToStatViewController : UIViewController <UITableViewDelegate,  
UITableViewDataSource,
          UISearchDisplayDelegate, UISearchBarDelegate, UIPickerView Delegate, UIPickerViewDataSource>{
  UITableView    *busStatToStatTableView;
  UISearchBar    *currentSearchBar;
  UISearchBar    *beginSearchBar;
  UISearchBar    *endSearchBar;  
  UIPickerView  *stationPickView;
  NSInteger     currentBeginIndex;
  NSInteger     currentEndIndex;  
  NSInteger     stationType;  
  NSMutableArray  *beginFilteredListContent;
  NSMutableArray  *endFilteredListContent;
  NSString    *ifSelectedPickerString;
  NSString    *ifSelectedPickEndString;
  BOOL       isSearchBegin;
  BOOL       isSearchEndBegin;
  BOOL       isJumpToStat;
  UIBarButtonItem  *returnKeyBordBtn;
}
@property (nonatomic, retain) IBOutlet UITableView    *busStatToStatTableView;
@property (nonatomic, retain) IBOutlet UISearchBar    *beginSearchBar;
@property (nonatomic, retain) IBOutlet UISearchBar    *endSearchBar;
@property (nonatomic, retain) IBOutlet UIPickerView    *stationPickView;
@property(nonatomic, retain)      NSMutableArray  *beginFilteredListContent;
@property(nonatomic, retain)      NSMutableArray  *endFilteredListContent;
@property(nonatomic) BOOL   isJumpToStat;
- (void)filterContentForSearchText:(NSString*)searchText;

@end
文件CBus_StatToStatViewController.m是文件CBus_StatToStatViewController.h的实现,功能是显示搜索表单,根据用户输入的起始站点和终点站信息,列表显示符合搜索条件的线路。

#import "CBus_StatToStatViewController.h"
#import "CBus_LineDetailViewController.h"
#import "CBus_StationDetailViewController.h"
#import "CDataContainer.h"
@implementation CBus_StatToStatViewController
@synthesize busStatToStatTableView,beginFilteredListContent,endFilteredListContent;
@synthesize beginSearchBar, endSearchBar, stationPickView;
@synthesize isJumpToStat;
// 界面初始化
- (void)viewDidLoad {
  [super viewDidLoad];

  returnKeyBordBtn = [[UIBarButtonItem alloc] initWithTitle:@"收起键盘"  style:UIBarButtonItemStylePlain 
target:self
action:@selector(HideKeyBoard:)];

  self.navigationItem.rightBarButtonItem = nil;// 输入键盘;

  self.beginFilteredListContent = [NSMutableArray arrayWithArray:[CDataContainer Instance].stationNameArray];
  self.endFilteredListContent = [NSMutableArray arrayWithArray:[CDataContainer Instance].stationNameArray];

  isSearchBegin = NO;
  isSearchEndBegin = NO;
  isJumpToStat = NO;

  ifSelectedPickerString = [[NSString alloc] init];
  ifSelectedPickEndString = [[NSString alloc] init];
}
#pragma mark -
#pragma mark View lifecycle
//根据设置的样式显示
- (void)viewWillAppear:(BOOL)animated{
  [super viewWillAppear:animated];
  [self.busStatToStatTableView reloadData];

  NSUserDefaults *userDefault = [NSUserDefaults standardUserDefaults];
  NSInteger styleNum = [userDefault integerForKey:@"styleType"];

  switch (styleNum){
    case 0:{
      [UIApplication sharedApplication].statusBarStyle = UIStatusBarStyle Default;
      self.navigationController.navigationBar.barStyle = UIBarStyleDefault;
      self.beginSearchBar.barStyle = UIBarStyleDefault;
      self.endSearchBar.barStyle = UIBarStyleDefault;
      break;
    }
    case 1:{
      [UIApplication sharedApplication].statusBarStyle = UIStatusBarStyle BlackOpaque;
      self.navigationController.navigationBar.barStyle = UIBarStyleBlackOpaque;
      self.beginSearchBar.barStyle = UIBarStyleBlackOpaque;
      self.endSearchBar.barStyle = UIBarStyleBlackOpaque;
      break;
    }
  }

  self.navigationItem.rightBarButtonItem = nil;

  stationType = ENoneStationType;

  [stationPickView reloadAllComponents];

  if(isJumpToStat){
    CBus_StationDetailViewController *detailViewController = [[CBus_Station DetailViewController alloc] initWithNibName:@"CBus_StationDetailView" bundle:nil];
    detailViewController.currentStationName = [[CDataContainer   
Instance].stationNameArray objectAtIndex:currentBeginIndex];
    detailViewController.currentStationIndex = currentBeginIndex+1;
    [self.navigationController pushViewController:detailViewController animated:YES];
    [detailViewController release];
    isJumpToStat = NO;
  }  
}
- (void)viewDidAppear:(BOOL)animated{
  [super viewDidAppear:animated];
}
- (void)viewWillDisappear:(BOOL)animated{
  [super viewWillDisappear:animated];
}
- (void)viewDidDisappear:(BOOL)animated{
  [super viewDidDisappear:animated];

  beginSearchBar.text = @"";
  endSearchBar.text = @"";
}
 // 默认图片
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation) 
interfaceOrientation{
 // Return YES for supported orientations
  return (interfaceOrientation == UIInterfaceOrientationPortrait);
}

-(IBAction)HideKeyBoard:(id)sender{
  NSLog(@"------HideKeyBoard------");
  self.navigationItem.rightBarButtonItem = nil;

  beginSearchBar.text = @"";
  endSearchBar.text = @"";

  stationPickView.hidden = YES;
  [currentSearchBar resignFirstResponder];
}
#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 1;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
  return [[CDataContainer Instance].stationNameArray count];
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
  static NSString *CellIdentifier = @"Cell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
    cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease];
  }  
  cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
  cell.selectionStyle = UITableViewCellSelectionStyleGray;
  // Configure the cell
  cell.textLabel.text = [[CDataContainer Instance].stationNameArray objectAtIndex: indexPath.row];
  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_StationDetailViewController *detailViewController = [[CBus_StationDetail ViewController alloc] initWithNibName:@"CBus_StationDetailView" bundle:nil];
  detailViewController.currentStationName = [[CDataContainer Instance].stationName Array objectAtIndex:indexPath.row];
  detailViewController.currentStationIndex = indexPath.row+1;
  [self.navigationController pushViewController:detailViewController animated:YES];
  [detailViewController release];
}
-(void)tableView:(UITableView *)tableView accessoryButtonTappedForRowWithIndexPath:  
(NSIndexPath *)indexPath
{
}
#pragma mark -
#pragma mark Picker view data source
- (NSInteger)numberOfComponentsInPickerView:(UIPickerView *)pickerView{
  return 2;
}
- (NSInteger)pickerView:(UIPickerView *)pickerView numberOfRowsInComponent:(NSInteger) component{
  if (component == kBeginStationComponent){
    if ([beginSearchBar.text isEqualToString:@""]){
      return [[CDataContainer Instance].stationNameArray count];
    }
    if (stationType == EBeginStationType){
      return[beginFilteredListContent count];
    }
    else{
      return [[CDataContainer Instance].stationNameArray count];
    }
  }
  else if(component == kEndStationComponent){
    if ([endSearchBar.text isEqualToString:@""]){
      return [[CDataContainer Instance].stationNameArray count];
    }
    if (stationType == EEndStationType){
      return[endFilteredListContent count];
    }
    else {
      return [[CDataContainer Instance].stationNameArray count];
    }
  }  
  return 0;
}
- (NSString *)pickerView:(UIPickerView *)pickerView titleForRow:(NSInteger)row 
forComponent:(NSInteger)component{
  if (component == kBeginStationComponent){
    if ([beginSearchBar.text isEqualToString:@""]){
      return [[CDataContainer Instance].stationNameArray objectAtIndex:row];
    }
    if (stationType == EBeginStationType){
      return[beginFilteredListContent objectAtIndex:row];
    }
    else {
      return [[CDataContainer Instance].stationNameArray objectAtIndex:row];
    }
  }
  else if(component == kEndStationComponent){
    if ([endSearchBar.text isEqualToString:@""]){
      return [[CDataContainer Instance].stationNameArray objectAtIndex:row];
    }
    if (stationType == EEndStationType){
      return[endFilteredListContent objectAtIndex:row];
    }
    else {
      return [[CDataContainer Instance].stationNameArray objectAtIndex:row];
    }
  }

  return nil;
}
- (void)pickerView:(UIPickerView *)pickerView didSelectRow:(NSInteger)row inComponent: (NSInteger)component{
  if (component == kBeginStationComponent){
    currentBeginIndex = row;

    if ([beginSearchBar.text isEqualToString:@""]){
      isSearchBegin = NO;
      ifSelectedPickerString = [[CDataContainer Instance].stationNameArray objectAtIndex:row];
      beginSearchBar.text = [[CDataContainer Instance].stationNameArray objectAtIndex:row];
    }
    else if (stationType == EBeginStationType){
      ifSelectedPickerString = [beginFilteredListContent objectAtIndex:row];
      beginSearchBar.text = [beginFilteredListContent objectAtIndex:row];
    }
    else {
      ifSelectedPickerString = [[CDataContainer Instance].stationNameArray objectAtIndex:row];
      beginSearchBar.text = [[CDataContainer Instance].stationNameArray objectAtIndex:row];
    }
  }
  else if(component == kEndStationComponent){
    currentEndIndex = row;

    if ([endSearchBar.text isEqualToString:@""]){
      isSearchEndBegin = NO;
      ifSelectedPickEndString = [[CDataContainer Instance].stationNameArray objectAtIndex:row];
      endSearchBar.text = [[CDataContainer Instance].stationNameArray object AtIndex:row];
    }
    else if (stationType == EEndStationType){
      ifSelectedPickEndString = [endFilteredListContent objectAtIndex:row];
      endSearchBar.text = [endFilteredListContent objectAtIndex:row];
    }
    else{
      ifSelectedPickEndString = [[CDataContainer Instance].stationNameArray objectAtIndex:row];
      endSearchBar.text = [[CDataContainer Instance].stationNameArray object AtIndex:row];
    }
  }
}
#pragma mark -
#pragma mark SearchBarText delegate
- (void)searchBarTextDidBeginEditing:(UISearchBar *)searchBar{
  NSLog(@"------searchBarTextDidBeginEditing---");
  stationPickView.hidden = NO;
  self.navigationItem.rightBarButtonItem = returnKeyBordBtn;
  currentSearchBar = searchBar;

  if (currentSearchBar == beginSearchBar){
    NSLog(@"---------Type------EBeginStationType");
    stationType = EBeginStationType;
  }
  else{
    NSLog(@"---------Type------EEndStationType");
    stationType = EEndStationType;
  }
}
- (void)searchBarTextDidEndEditing:(UISearchBar *)searchBar{
  NSLog(@"------searchBarTextDidEndEditing---");
}
- (void)searchBar:(UISearchBar *)searchBar textDidChange:(NSString *)searchText{
  NSLog(@"--------SearchBar_text Changed--------");
  if(searchBar == beginSearchBar)
  {
    if ([ifSelectedPickerString isEqualToString:searchText]){
      return;
    }
    if (stationType == EBeginStationType){
      isSearchBegin = YES;
      [self filterContentForSearchText:searchText];
      [stationPickView reloadAllComponents];
    }
  }
  else if(searchBar == endSearchBar){
    if ([ifSelectedPickEndString isEqualToString:searchText]){
      return;
    }
    if (stationType == EEndStationType){
      isSearchEndBegin = YES;
      [self filterContentForSearchText:searchText];
      [stationPickView reloadAllComponents];
    }
  }
}
- (void)searchBarSearchButtonClicked:(UISearchBar *)searchBar{
  NSLog(@"------searchBarSearchButtonClicked---");  
  CBus_StationDetailViewController *detailViewController = [[CBus_StationDetail ViewController alloc] initWithNibName:@"CBus_StationDetailView" bundle:nil];

  if ((![beginSearchBar.text isEqualToString:@""])&&(![endSearchBar.text isEqual ToString:@""])){
    NSLog(@"------站站查询------");
    if (isSearchBegin){
      detailViewController.beginStationName = [beginFilteredListContent   
objectAtIndex:currentBeginIndex];
      detailViewController.beginStationIndex = [[CDataContainer Instance]. stationNameArray indexOfObject:[beginFilteredListContent objectAtIndex:currentBeginIndex]]+1;
    }
    else {
      detailViewController.beginStationName = [[CDataContainer Instance].  
stationNameArray objectAtIndex:currentBeginIndex];
      detailViewController.beginStationIndex = currentBeginIndex+1;
    }    
    if (isSearchEndBegin){
      detailViewController.endStationName = [endFilteredListContent object  
AtIndex:currentEndIndex];
      detailViewController.endStationIndex = [[CDataContainer Instance].  
stationNameArray indexOfObject:[endFilteredListContent objectAtIndex:currentEndIndex]]+1;
    }
    else {
      detailViewController.endStationName = [[CDataContainer Instance].  
stationNameArray objectAtIndex:currentEndIndex];
      detailViewController.endStationIndex = currentEndIndex+1;
    }    
    detailViewController.isStatToStat = YES;
  }
  else if (stationType == EBeginStationType){
    NSLog(@"------始站查询------");
    if (isSearchBegin){
      detailViewController.currentStationName = [beginFilteredListContent objectAtIndex:currentBeginIndex];
      detailViewController.currentStationIndex = [[CDataContainer Instance].  
stationNameArray indexOfObject:[beginFilteredListContent objectAtIndex:currentBeginIndex]]+1;
    }
    else {
      detailViewController.currentStationName = [[CDataContainer Instance].  
stationNameArray objectAtIndex:currentBeginIndex];
      detailViewController.currentStationIndex = currentBeginIndex+1;
    }
    detailViewController.isStatToStat = NO;
  }
  else if(stationType == EEndStationType){
    NSLog(@"------尾站查询------");
    if (isSearchEndBegin){
      detailViewController.currentStationName = [endFilteredListContent   
objectAtIndex:currentEndIndex];
      detailViewController.currentStationIndex = [[CDataContainer Instance].  
stationNameArray indexOfObject:[endFilteredListContent objectAtIndex:currentEndIndex]]+1;
    }
    else{
      detailViewController.currentStationName = [[CDataContainer Instance]. stationNameArray objectAtIndex:currentEndIndex];
      detailViewController.currentStationIndex = currentEndIndex+1;
    }
    detailViewController.isStatToStat = NO;
  }  
  [currentSearchBar resignFirstResponder];
   stationPickView.hidden = YES;
  // 通过选定的对象到新视图控制器
  [self.navigationController pushViewController:detailViewController animated:YES];
  [detailViewController release];
}
#pragma mark -
#pragma mark Search Methods

- (void)filterContentForSearchText:(NSString*)searchText;{
  //基于搜索文本和范围更新过滤阵列
  //首先清除过滤数组
  if (stationType == EBeginStationType){
    [self.beginFilteredListContent removeAllObjects]; 
    for (int i = 0; i < [[CDataContainer Instance].stationNameArray count]; i++){
      NSString *searchNameInfo = [[CDataContainer Instance].stationNameArray objectAtIndex:i];
      NSString *searchPYInfo = [[CDataContainer Instance].stationPYArray objectAtIndex:i];
      NSComparisonResult result = [searchNameInfo compare:searchText options: (NSCaseInsensitiveSearch|NSDiacriticInsensitiveSearch) range:NSMakeRange(0, [searchText length])];
      NSComparisonResult resultPY = [searchPYInfo compare:searchText options: (NSCaseInsensitiveSearch|NSDiacriticInsensitiveSearch) range:NSMakeRange(0, [searchText length])];
      if (result == NSOrderedSame || resultPY == NSOrderedSame){
        [self.beginFilteredListContent addObject:searchNameInfo];
      }
    }
  }
  else if(stationType == EEndStationType){
    [self.endFilteredListContent removeAllObjects];
    for (int i = 0; i < [[CDataContainer Instance].stationNameArray count]; i++){
      NSString *searchNameInfo = [[CDataContainer Instance].stationNameArray objectAtIndex:i];
      NSString *searchPYInfo = [[CDataContainer Instance].stationPYArray objectAtIndex:i];

      NSComparisonResult result = [searchNameInfo compare:searchText options: (NSCaseInsensitiveSearch|NSDiacriticInsensitiveSearch) range:NSMakeRange(0, [searchText length])];
      NSComparisonResult resultPY = [searchPYInfo compare:searchText options: (NSCaseInsensitiveSearch|NSDiacriticInsensitiveSearch) range:NSMakeRange(0, [searchText length])];

      if (result == NSOrderedSame || resultPY == NSOrderedSame){
        [self.endFilteredListContent addObject:searchNameInfo];
      }
    }
  }
}
- (void)dealloc {

  [busStatToStatTableView release];
  [beginSearchBar release];
  [endSearchBar release];
  [currentSearchBar release];
  [stationPickView release];
  [beginFilteredListContent release];
  [endFilteredListContent release];
  [returnKeyBordBtn release];
  [super dealloc];
}
@end

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


e8bdedb7aee4733b13b82af30af33010dac6e7d6

6.3.2 站站查询详情视图
站站查询详情视图CBus_StatDetailStatView.xib的UI界面如图6-8所示,在上方显示票价、始发站、终点站、首班车时间和末班车时间,在下方列表显示了30条线路。


dbc54502a491e4a07195882c1255df263f7f211b

其实本模块和上一节中的线路详情模块类似,实现文件CBus_StatDetailStatViewController.m的主要代码如下所示。

#import "CBus_StatDetailStatViewController.h"
#import "CBus_StationDetailViewController.h"
#import "CBus_LineDetailLineViewController.h"
#import "CDataContainer.h"
@implementation CBus_StatDetailStatViewController
@synthesize busLineDetailTableView,currentLineName;
@synthesize currentLineIndex;
@synthesize isStatToStat;
// 视图初始化
- (void)viewDidLoad{
  [super viewDidLoad];  
  self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithBar ButtonSystemItem:UIBarButtonSystemItemAdd                        target:self        action:@selector(AddLineToFavorite)];
  [[CDataContainer Instance] GetLineStationFromTableSequence:currentLineIndex];
}
#pragma mark -
#pragma mark View lifecycle
- (void)viewWillAppear:(BOOL)animated {
  [super viewWillAppear:animated];
  [self.busLineDetailTableView 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];
  isStatToStat = NO;
}
-(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:self
   cancelButtonTitle:@"确定"
   otherButtonTitles:nil];
      [alert show];
      [alert release];
      return;
    }
  }

  [[CDataContainer Instance] InsertFavoriteInfoToDatabase:0 AddName:currentLine  
Name AddIndex:currentLineIndex AddNameEnd:nil AddIndexEnd:0];
  UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"收藏"
  message:[NSString stringWithFormat:@"收藏 %@ 成功",currentLineName]
  delegate:self
  cancelButtonTitle:@"确定"
  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 sections
  return 1;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
  // Return the number of rows in the section
  return [[CDataContainer Instance].sequenceNumArray count];
}
// Customize the appearance of table view cells.
- (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;
// Configure the cell
  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{
  // Navigation logic may go here. Create and push another view controller
  if (isStatToStat) {
    return;
  }  
  CBus_StationDetailViewController *statDetailViewController = [self.navigation  
Controller.viewControllers objectAtIndex:1];
  statDetailViewController.currentStationName = [[CDataContainer Instance].station NameArray objectAtIndex:[[CDataContainer Instance] GetBusLineSequenceByIndex:indexPath.row]-1];
  statDetailViewController.currentStationIndex = [[CDataContainer Instance].station NameArray indexOfObject:statDetailViewController.currentStationName]+1;
  [self.navigationController popViewControllerAnimated:YES];
}

版权声明:本文内容由阿里云实名注册用户自发贡献,版权归原作者所有,阿里云开发者社区不拥有其著作权,亦不承担相应法律责任。具体规则请查看《阿里云开发者社区用户服务协议》和《阿里云开发者社区知识产权保护指引》。如果您发现本社区中有涉嫌抄袭的内容,填写侵权投诉表单进行举报,一经查实,本社区将立刻删除涉嫌侵权内容。

相关文章
SNMP从入门到开发:进阶篇
管理信息库:MIB 我们要扩展mib首先必须清楚mib是如何定义的,用的什么语言,有哪些约定,遵循哪些规则等等。这些基本东西掌握过后,我们就可以很轻松的来写自己的mib文件了。 所谓管理信息库,或者MIB,就是所有代理进程包含的、并且能够被管理进程进行查询和设置的信息的集合,或者叫管理对象的集合,在RFC 1213 [McColghrie 和Rose 1991]中定义了MIB-II,即第二版的MIB库。
943 0
[Android]Android开发入门之HelloWorld
引言:在做Unity开发的时候,发现这么个问题,虽然Unity是跨平台的,能够进行Android,IOS,Web,PC等开发,但如果要实现一些稍微系统层的东西,还是需要通过通信,调用原系统的接口(自定义的接口)来进行开发的,所以这还是需要了解其他平台原生态的开...
1084 0
04.Eclipse下Ndk开发(以文件拆分合并为例模拟一下开发过程,参考文件加密的过程)
(创建于2017/12/6) 1.工具类PatchUtils package com.ren.ndk_file_patch; public class PatchUtils { static{ System.
825 0
SNMP从入门到开发:基础篇
SNMP协议入门 1、引言 基于TCP/IP的网络管理包含3个组成部分: 1) 一个管理信息库MIB(Management Information Base)。
926 0
敏捷模型驱动开发(AMDD):攀登敏捷软件开发的关键
Agile Model Driven Development (AMDD): The Key to Scaling Agile Software Development 敏捷模型驱动开发(AMDD):攀登敏捷软件开发的关键   Table ...
1228 0
Apache Mina开发手册
Apache Mina开发手册 一、介绍 Apache Mina是一个网络应用框架,简化用户开发高性能、高可扩展性的网络应用程序的难度。Mina提供了一个抽象的事件驱动的异步API,通过Java NIO实现各种传输协议如TCP/IP和UDP/IP。
1028 0
+关注
异步社区
异步社区(www.epubit.com)是人民邮电出版社旗下IT专业图书旗舰社区,也是国内领先的IT专业图书社区,致力于优质学习内容的出版和分享,实现了纸书电子书的同步上架,于2015年8月上线运营。公众号【异步图书】,每日赠送异步新书。
12049
文章
0
问答
文章排行榜
最热
最新
相关电子书
更多
《2021云上架构与运维峰会演讲合集》
立即下载
《零基础CSS入门教程》
立即下载
《零基础HTML入门教程》
立即下载