putting labels, buttons on the navigation bar iOS

前端 未结 5 1725
佛祖请我去吃肉
佛祖请我去吃肉 2021-01-13 11:59

I have created custom navigation controller,

I want to be added, a date at the left, a back button on the right and the title next to back button.

I tried to

5条回答
  •  情歌与酒
    2021-01-13 12:46

    UINavigationBar *naviBarObj = [[UINavigationBar alloc] initWithFrame:CGRectMake(0, 0, 1024, 66)];
    
        UILabel *navLabel = [[UILabel alloc] initWithFrame:CGRectMake(200,8,200,30)];
        navLabel.text = @"My Text";
        navLabel.textColor = [UIColor redColor];
        [naviBarObj addSubview:navLabel];
        [navLabel setBackgroundColor:[UIColor clearColor]];
        [self.view addSubview:naviBarObj];
    

    try this it will work .It works for me :)

提交回复
热议问题