I try to call UINavigationBar @ main page. It shows navigationbar but without text and segmented controll. I dont know why it doesn't show. Please help me why and how I fix it.
Here is code
@MainController.m
- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
NavigationBar = [[BINavigationBar alloc] init];
[self.view addSubview:[NavigationBar getNavigationbar:@"Desktop"]];
}
@BINavigationBar.m
-(UINavigationBar *)getNavigationbar:(NSString *)name
{
navigationBar = [[UINavigationBar alloc] initWithFrame:CGRectMake(0, 0, 1024, 44)];
//UILabel *namelb = [[UILabel alloc] init];
//namelb.text = @"DesktopTest";
//[navigationBar.topItem.titleView addSubview:namelb];
navigationBar.topItem.title = @"Desktop";
UIBarButtonItem *segmentBarItem = [[UIBarButtonItem alloc] initWithCustomView:[self getSegmentedControl]];
navigationBar.topItem.rightBarButtonItem = segmentBarItem;
return navigationBar;
}
-(UISegmentedControl *)getSegmentedControl
{
UISegmentedControl *segmented = [[UISegmentedControl alloc] initWithItems:[NSArray arrayWithObjects:@"Archieve", @"Desktop", @"Library", nil]];
segmented.frame = CGRectMake(0, 2, 120, 40);
segmented.segmentedControlStyle = UISegmentedControlStyleBar;
return segmented;
}