Adding a UINavigationBar to a UITableView


/ Published in: Objective C
Save to your folder(s)



Copy this code and paste it in your HTML
  1. - (void)viewWillAppear:(BOOL)animated {
  2. [super viewWillAppear:animated];
  3.  
  4. tableViewNavigationBar = [[UINavigationBar alloc] initWithFrame: CGRectMake(0.0f, 0.0f, 320.0f, 44.0f)];
  5.  
  6. UIImage *image = [UIImage imageNamed:@"synyx_150_no_os.png"];
  7. imageView = [ [ UIImageView alloc ] initWithFrame:CGRectMake(84.0, 1.0, image.size.width, image.size.height) ];
  8. [imageView setImage:image];
  9.  
  10. [tableViewNavigationBar addSubview:imageView];
  11.  
  12. [super.tableView addSubview:tableViewNavigationBar];
  13. }
  14.  
  15.  
  16. //This is the way i implemented in a Tab Bar Window
  17.  
  18. - (void)viewWillAppear:(BOOL)animated {
  19. [super viewWillAppear:animated];
  20.  
  21. //navigationBar = [[UINavigationBar alloc] initWithFrame: CGRectMake(0.0f, 0.0f, 320.0f, 44.0f)];
  22.  
  23. UIImage *image = [UIImage imageNamed:@"cpSmallLogoB.png"];
  24. UIImageView *imageView = [ [ UIImageView alloc ] initWithFrame:CGRectMake(84.0, 22.0, image.size.width, image.size.height) ];
  25. [imageView setImage:image];
  26.  
  27. //[navigationBar addSubview:imageView];
  28.  
  29. [super.navigationController.view addSubview:imageView];
  30. }

URL: http://dlinsin.blogspot.com/2010/01/adding-uinavigationbar-to-uitableview.html

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.