I want my scrollview
to be added as UINavigationBar's titleview
, but strangely I am unable to do so.
In viewDidLoad:
navController = [[UINavigationController alloc] init];
self.view.frame = CGRectMake(0, 0, [UIScreen mainScreen].bounds.size.width, [UIScreen mainScreen].bounds.size.height - 20 - 45 - 2);
CGRect frame = navController.view.frame;
frame.size.height -= 20;
[self.view addSubview:navController.view];
UIScrollView *someview = [[UIScrollView alloc] initWithFrame:CGRectMake(0, 0, self.view.frame.size.width, 44)];
someview.backgroundColor = [UIColor orangeColor];
navController.navigationItem.titleView = someview;
It is a very simple piece of code, but I can't figure out that what I am missing. Please someone help me... Thanks.
Side Note: I am initiating UINavigationController
without any root controller, since my first concern is adding scrollview to navigationbar.