当前位置: 首页 > news >正文

有没有什么排版的网站我自己做的一个网站显示证书错误

有没有什么排版的网站,我自己做的一个网站显示证书错误,网站地区词优化,个人建站1.创建一个Navigation—based—Application项目#xff0c;这样Interface Builder中会自动生成一个Table View#xff0c;然后将Search Bar拖放到表示图上#xff0c;以我们要给表示图添加搜索功能#xff0c;不要忘记将Search Bar的delegate连接到File‘s Owner项#xf…1.创建一个Navigation—based—Application项目这样Interface Builder中会自动生成一个Table View然后将Search Bar拖放到表示图上以我们要给表示图添加搜索功能不要忘记将Search Bar的delegate连接到File‘s Owner项然后将Search Bar与searchBar变量连接。 2.在Resources文件夹下创建一个Movies.plist文件然后为该文件添加一些数据如下图 3.在.h头文件添加如下内容 [cpp] view plaincopyprint? #import UIKit/UIKit.h       interface MyTableView : UITableViewController UISearchBarDelegate{      NSDictionary *movieTitles;      NSArray *years;            IBOutlet UISearchBar *searchBar;            BOOL isSearchOn;      BOOL canSelectRow;            //下面两个是搜索用到的两个变量       NSMutableArray *listOfMovies;      NSMutableArray *searchResult;  }  property(nonatomic,retain) NSDictionary *movieTitles;  property(nonatomic,retain)NSArray *years;  property(nonatomic,retain)UISearchBar *searchBar;    -(void)donSearching:(id)sender;  -(void)searchMoviesTableView;  end   #import UIKit/UIKit.h interface MyTableView : UITableViewController UISearchBarDelegate{ NSDictionary *movieTitles; NSArray *years; IBOutlet UISearchBar *searchBar; BOOL isSearchOn; BOOL canSelectRow; //下面两个是搜索用到的两个变量 NSMutableArray *listOfMovies; NSMutableArray *searchResult; } property(nonatomic,retain) NSDictionary *movieTitles; property(nonatomic,retain)NSArray *years; property(nonatomic,retain)UISearchBar *searchBar; -(void)donSearching:(id)sender; -(void)searchMoviesTableView; end 4.当加载View窗口时首先定位属性列表并把这个列表加载到listOfMovies中然后将所有的年份提取到years中然后添加搜索条并初始化搜索条用到的数据 [cpp] view plaincopyprint? //读取Movies.plist文件的内容到变量里面   - (void)viewDidLoad  {     NSString *path  [[NSBundle mainBundle]pathForResource:Movies ofType:plist];      NSDictionary *dic  [[NSDictionary alloc]initWithContentsOfFile:path];      self.movieTitles  dic;      [dic release];            NSArray *array  [[self.movieTitles allKeys]sortedArrayUsingSelector:selector(compare:)];      self.years  array;            //下面两句是添加搜索条       self.tableView.tableHeaderView  searchBar;      self.searchBar.autocorrectionType  UITextAutocorrectionTypeYes;            //初始化listofmovies       listOfMovies  [[NSMutableArray alloc]init];      for (NSString *year in years) {          NSArray *movies  [movieTitles objectForKey:year];          for(NSString *title in movies){              [listOfMovies addObject:title];          }      }        searchResult  [[NSMutableArray alloc]init];            isSearchOn  NO;      canSelectRow  YES;      [super viewDidLoad];    }   //读取Movies.plist文件的内容到变量里面 - (void)viewDidLoad { NSString *path [[NSBundle mainBundle]pathForResource:Movies ofType:plist]; NSDictionary *dic [[NSDictionary alloc]initWithContentsOfFile:path]; self.movieTitles dic; [dic release]; NSArray *array [[self.movieTitles allKeys]sortedArrayUsingSelector:selector(compare:)]; self.years array; //下面两句是添加搜索条 self.tableView.tableHeaderView searchBar; self.searchBar.autocorrectionType UITextAutocorrectionTypeYes; //初始化listofmovies listOfMovies [[NSMutableArray alloc]init]; for (NSString *year in years) { NSArray *movies [movieTitles objectForKey:year]; for(NSString *title in movies){ [listOfMovies addObject:title]; } } searchResult [[NSMutableArray alloc]init]; isSearchOn NO; canSelectRow YES; [super viewDidLoad]; } 5.在自动生成的方法numberOfSectionsInTableView中添加如下代码表示告诉表示图一共分多少节 [cpp] view plaincopyprint? - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView  {      if (isSearchOn) {          return 1;//如果正在搜索就只有一个section       }    else      return [self.years count];  }   - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView { if (isSearchOn) { return 1;//如果正在搜索就只有一个section } else return [self.years count]; }6.在自动生成的方法tableViewnumberOfRowsInSection中添加如下代码表示告诉表视图每一节显示多少行 [cpp] view plaincopyprint? - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section  {        if (isSearchOn) {          return [searchResult count];      }else{      // Return the number of rows in the section.       NSString *year  [self.years objectAtIndex:section];      NSArray *movieSection  [self.movieTitles objectForKey:year];      return [movieSection count];      }  }   - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { if (isSearchOn) { return [searchResult count]; }else{ // Return the number of rows in the section. NSString *year [self.years objectAtIndex:section]; NSArray *movieSection [self.movieTitles objectForKey:year]; return [movieSection count]; } } 7.在自动生成的方法tableViewcellForRowAtIndexPath中添加如下代码为每一行设值 [cpp] view plaincopyprint? - (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];      }            if (isSearchOn) {          NSString *cellValue  [searchResult objectAtIndex:indexPath.row];          cell.textLabel.text  cellValue;      }else{      NSString *year  [self.years objectAtIndex:[indexPath section]];//得到当前行所在的section       NSArray *movieSection  [self.movieTitles objectForKey:year];      cell.textLabel.text  [movieSection objectAtIndex:[indexPath row]];                    cell.accessoryType  UITableViewCellAccessoryDetailDisclosureButton;      }            //为每一行添加图片       UIImage *image  [UIImage imageNamed:apple.jpeg];      cell.imageView.image  image;            return cell;  }   - (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]; } if (isSearchOn) { NSString *cellValue [searchResult objectAtIndex:indexPath.row]; cell.textLabel.text cellValue; }else{ NSString *year [self.years objectAtIndex:[indexPath section]];//得到当前行所在的section NSArray *movieSection [self.movieTitles objectForKey:year]; cell.textLabel.text [movieSection objectAtIndex:[indexPath row]]; cell.accessoryType UITableViewCellAccessoryDetailDisclosureButton; } //为每一行添加图片 UIImage *image [UIImage imageNamed:apple.jpeg]; cell.imageView.image image; return cell; }8.实现tableViewtitleForHeaderInSection方法将得到的年份作为每一节的Header [cpp] view plaincopyprint? //设置每个section的标题   -(NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section{      NSString *year  [self.years objectAtIndex:section];      if (isSearchOn) {          return nil;      }      else{      return year;      }      }   //设置每个section的标题 -(NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section{ NSString *year [self.years objectAtIndex:section]; if (isSearchOn) { return nil; } else{ return year; } } 9.为表格添加索引只需要实现sectionIndexTitlesForTableView方法该方法返回每一节的Header数组 [cpp] view plaincopyprint? //添加索引   -(NSArray *)sectionIndexTitlesForTableView:(UITableView *)tableView{      if (isSearchOn)           return nil;      else      return years;  }   //添加索引 -(NSArray *)sectionIndexTitlesForTableView:(UITableView *)tableView{ if (isSearchOn) return nil; else return years; } 10.当用户点击搜索栏会促发searchBarTextDidBeginEditing事件UISearchBarDelegate协议中定义的一个方法我们在.h头文件中实现了这个协议在该方法中向屏幕右上角添加一个Done按钮当用户点击Done按钮时会调用doneSearching方法 [cpp] view plaincopyprint? //搜索筐得到焦点后   -(void)searchBarTextDidBeginEditing:(UISearchBar *)searchBar{      isSearchOn  YES;      canSelectRow  NO;      self.tableView.scrollEnabled  NO;      //添加down按钮及其点击方法       self.navigationItem.rightBarButtonItem  [[[UIBarButtonItem alloc]initWithBarButtonSystemItem:UIBarButtonSystemItemDone target:self action:selector(donSearching:)]autorelease];  }   //搜索筐得到焦点后 -(void)searchBarTextDidBeginEditing:(UISearchBar *)searchBar{ isSearchOn YES; canSelectRow NO; self.tableView.scrollEnabled NO; //添加down按钮及其点击方法 self.navigationItem.rightBarButtonItem [[[UIBarButtonItem alloc]initWithBarButtonSystemItem:UIBarButtonSystemItemDone target:self action:selector(donSearching:)]autorelease]; }11.doneSearching方法使得搜索栏移除了First Responder状态因而会隐藏键盘同时通过调用表视图的reloadData方法重新加载表视图 [cpp] view plaincopyprint? //点击down按钮后   -(void)donSearching:(id)sender{      isSearchOn  NO;      canSelectRow  YES;      self.tableView.scrollEnabled  YES;      self.navigationItem.rightBarButtonItem  nil;            [searchBar resignFirstResponder];            [self.tableView reloadData];  }   //点击down按钮后 -(void)donSearching:(id)sender{ isSearchOn NO; canSelectRow YES; self.tableView.scrollEnabled YES; self.navigationItem.rightBarButtonItem nil; [searchBar resignFirstResponder]; [self.tableView reloadData]; }12.当用户在搜索栏中输入时输入的每个字符都会触发searchBartextDidChange事件只要搜索栏中有一个字符就会调用searchMoviesTableView方法 [cpp] view plaincopyprint? //搜索筐里面的文字改变后   -(void) searchBar:(UISearchBar *)searchBar textDidChange:(NSString *)searchText{      if ([searchText length]0) {          isSearchOn  YES;          canSelectRow  YES;          self.tableView.scrollEnabled  YES;          [self searchMoviesTableView];//调用搜索方法       }      else{          isSearchOn  NO;          canSelectRow  NO;          self.tableView.scrollEnabled  NO;      }      [self.tableView reloadData];  }   //搜索筐里面的文字改变后 -(void) searchBar:(UISearchBar *)searchBar textDidChange:(NSString *)searchText{ if ([searchText length]0) { isSearchOn YES; canSelectRow YES; self.tableView.scrollEnabled YES; [self searchMoviesTableView];//调用搜索方法 } else{ isSearchOn NO; canSelectRow NO; self.tableView.scrollEnabled NO; } [self.tableView reloadData]; }13.searchMoviesTableView方法会搜索listOfMovies数组通过NSString类的rangeOfStringoptions方法使用特定的字符串对每个名称进行搜索返回的结果是一个nsRange对象如果长度大于0就表示有一个匹配结果将它添加到searchResult书组中 [cpp] view plaincopyprint? //自定义的搜索方法,得到搜索结果   -(void)searchMoviesTableView{      [searchResult removeAllObjects];      for (NSString *str in listOfMovies) {          NSRange titleResultsRange  [str rangeOfString:searchBar.text options:NSCaseInsensitiveSearch];          if (titleResultsRange.length  0) {              [searchResult addObject:str];          }      }  }   //自定义的搜索方法,得到搜索结果 -(void)searchMoviesTableView{ [searchResult removeAllObjects]; for (NSString *str in listOfMovies) { NSRange titleResultsRange [str rangeOfString:searchBar.text options:NSCaseInsensitiveSearch]; if (titleResultsRange.length 0) { [searchResult addObject:str]; } } } 14.当用户点击键盘上的Search按钮时就会调用如下方法 [cpp] view plaincopyprint? -(void) searchBarSearchButtonClicked:(UISearchBar *)searchBar{      [self searchMoviesTableView];  }   -(void) searchBarSearchButtonClicked:(UISearchBar *)searchBar{ [self searchMoviesTableView]; }15.新建一个新的文件该文件在后面定义点击表格的某一行后就会调转到该页面去并将点击的那一样的名称传过去要想做到这一点必须实现如下方法 [cpp] view plaincopyprint? //点击table某一行跳转页面   - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath  {      MyTableViewOneMessage *mytm  [[MyTableViewOneMessage alloc]initWithNibName:MyTableViewOneMessage bundle:nil];            NSString *year  [self.years objectAtIndex:[indexPath section]];      NSArray *movieSection  [self.movieTitles objectForKey:year];      NSString *movieTitle  [movieSection objectAtIndex:[indexPath row]];      NSString *message  [[NSString alloc]initWithFormat:%,movieTitle];      mytm.message  message;      [self.navigationController pushViewController:mytm animated:YES];      [mytm release];  }   //点击table某一行跳转页面 - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { MyTableViewOneMessage *mytm [[MyTableViewOneMessage alloc]initWithNibName:MyTableViewOneMessage bundle:nil]; NSString *year [self.years objectAtIndex:[indexPath section]]; NSArray *movieSection [self.movieTitles objectForKey:year]; NSString *movieTitle [movieSection objectAtIndex:[indexPath row]]; NSString *message [[NSString alloc]initWithFormat:%,movieTitle]; mytm.message message; [self.navigationController pushViewController:mytm animated:YES]; [mytm release]; } 16.新添加的页面很简单主要用来测试表格的点击事件导航然后显示传过来的字符串 Interface Builder中添加两个lable具体的就不详细了很简单的下面是这个界面的.h和.m文件 [cpp] view plaincopyprint? #import UIKit/UIKit.h       interface MyTableViewOneMessage : UIViewController {      IBOutlet UILabel *mylable;      NSString *message;  }    property(nonatomic,retain)UILabel *mylable;  property(nonatomic,retain)NSString *message;    end   #import UIKit/UIKit.h interface MyTableViewOneMessage : UIViewController { IBOutlet UILabel *mylable; NSString *message; } property(nonatomic,retain)UILabel *mylable; property(nonatomic,retain)NSString *message; end[cpp] view plaincopyprint? #import MyTableViewOneMessage.h       implementation MyTableViewOneMessage    synthesize mylable;  synthesize message;    - (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil  {      self  [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];      if (self) {          // Custom initialization       }      return self;  }    -(void)viewDidAppear:(BOOL)animated{      self.mylable.text  message;  }    - (void)dealloc  {      [mylable release];      [message release];      [super dealloc];  }    - (void)didReceiveMemoryWarning  {      // Releases the view if it doesnt have a superview.       [super didReceiveMemoryWarning];            // Release any cached data, images, etc that arent in use.   }    #pragma mark - View lifecycle     - (void)viewDidLoad  {      self.navigationItem.title  Tableview传过来的值;      [super viewDidLoad];      // Do any additional setup after loading the view from its nib.   }    - (void)viewDidUnload  {      [super viewDidUnload];      // Release any retained subviews of the main view.       // e.g. self.myOutlet  nil;   }    - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation  {      // Return YES for supported orientations       return (interfaceOrientation  UIInterfaceOrientationPortrait);  }    end   #import MyTableViewOneMessage.h implementation MyTableViewOneMessage synthesize mylable; synthesize message; - (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil { self [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil]; if (self) { // Custom initialization } return self; } -(void)viewDidAppear:(BOOL)animated{ self.mylable.text message; } - (void)dealloc { [mylable release]; [message release]; [super dealloc]; } - (void)didReceiveMemoryWarning { // Releases the view if it doesnt have a superview. [super didReceiveMemoryWarning]; // Release any cached data, images, etc that arent in use. } #pragma mark - View lifecycle - (void)viewDidLoad { self.navigationItem.title Tableview传过来的值; [super viewDidLoad]; // Do any additional setup after loading the view from its nib. } - (void)viewDidUnload { [super viewDidUnload]; // Release any retained subviews of the main view. // e.g. self.myOutlet nil; } - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation { // Return YES for supported orientations return (interfaceOrientation UIInterfaceOrientationPortrait); } end
http://www.pierceye.com/news/107590/

相关文章:

  • 如何将网站和域名绑定阿里云1M做网站
  • 南城网站建设公司咨询东莞智通人才网最新招聘
  • app建设网站公司哪家好php网站修改代码
  • 哪些网上订餐的网站做的好地情网站建设
  • 重庆推广网站的方法国内最近的新闻大事
  • 网站需要备案吗网站怎么推广软文
  • 做设计开哪个素材网站的会员好手机免费网站建设哪家公司好
  • 征婚网站认识的男人做定投保做高级电工题的网站
  • 学做饼干的网站汕头建设学校的网站
  • asp.net做网站原理工资卡app下载
  • 做齐鲁油官方网站集团网站建设报价
  • 网站的收录情况怎么查企业网银怎么登录
  • 网站开发会计处理wordpress阅读随机增加
  • 兰州做网站公司哪家好公司网站建设是什么意思
  • 小区物业管理网站开发报告deal 网站要怎么做
  • seo站长助手wordpress 注册侧边栏
  • 做网站是要编程吗那些网站是html5做的
  • 网站开发图在网站做电子画册
  • 怎样建一个英文网站wordpress 多用户商城
  • 制作一个自适应网站源码app在线生成器
  • Dw做html网站项目管理软件有哪些
  • 天津网站建设定制软件开发服务公司
  • 做企业网站cms减肥网站源码
  • 建设工程检测预约网站猎头公司怎么找
  • 北京网站手机站建设公司手机网站开发常用工具
  • 太原做网站联系方式论坛的网站开发项目
  • drupal 做的网站网站设计与网站制作
  • 我要表白网站在线制作wordpress朗读句子插件
  • 黑龙江建设网官方怎么提高seo关键词排名
  • 拍卖网站开发多少钱十堰秦楚网招聘公告