1

 The scroll is covering the time and carrier , I just want it not to overlapp

The scroll is covering the time and carrier , I just want it not to overlapp but the image view should finish below the carrier bar .

How can this be done.

This is my code for the same

tableView = [[UITableView alloc] initWithFrame:CGRectMake(0, 0, 320   , self.view.frame.size.height)];
self.tableView.delegate = self;
self.tableView.dataSource = self;

UIImage *image = [UIImage imageNamed:@"dora.jpeg"];

UIGraphicsBeginImageContext(CGSizeMake(320, 480));
[image drawInRect:CGRectMake(0, 0, 320, 480)];
image = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();

imageView = [[UIImageView alloc] initWithImage:image];


CGRect frame = imageView.frame;
frame.origin.y -= 130;
defaultY = frame.origin.y;
imageView.frame = frame;

self.tableView.backgroundColor = [UIColor clearColor];

UIView *header = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 320, 170)];
header.backgroundColor = [UIColor clearColor];

self.tableView.tableHeaderView = header;

[self.view addSubview:imageView];
[self.view addSubview:self.tableView];

defaultSize = CGSizeMake(50, 20);
scrollPanel = [[UIView alloc] initWithFrame:CGRectMake(-defaultSize.width, 0, defaultSize.width, defaultSize.height)];
scrollPanel.backgroundColor = [UIColor blackColor];
scrollPanel.alpha = 0.45;

Thanks

John
  • 29
  • 3
  • You can embed the UITableViewController in a UINavigationController. Refer to this [UITableView shows under status bar](https://stackoverflow.com/q/18900428/6521116) – LF00 Jan 15 '18 at 07:39

2 Answers2

0

Set the origin.y of your scrollView (or table) to height of the status bar:

CGRect scrollControllFrame = scrollControll.frame;
scrollControllFrame.origin.y = [UIApplication sharedApplication].statusBarFrame.size.height;
scrollControllFrame.size.height-=[UIApplication sharedApplication].statusBarFrame.size.height;
scrollControll.frame = scrollControllFrame;
Misha
  • 5,260
  • 6
  • 35
  • 63
0

This issue can be very frustrating, and I believe it is a bug on Apple's end, especially because it shows up in their own pre-wired TableViewController from the object library.

For more info refer

iOS 7: UITableView shows under status bar

Community
  • 1
  • 1
Sanjay Mohnani
  • 5,947
  • 30
  • 46