Posted By

espinallab on 02/23/10


Tagged


Versions (?)

Who likes this?

1 person have marked this snippet as a favorite

umang_nine


Adding a UINavigationBar to a UITableView


 / Published in: Objective C
 

URL: http://dlinsin.blogspot.com/2010/01/adding-uinavigationbar-to-uitableview.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. }

Report this snippet  

You need to login to post a comment.