开发者

How to hide the segments button and display other segments button

I am having a problem in displaying the segment button on the navigation bar. My program flow is like this: Login page > details page > map page. I also want to display the 2 segments button开发者_StackOverflow中文版 on the details page And when goto the Map page then user sees 3 segments button. How is this possible?

More information about my project: in this app i have the tabbar also for that i create the other class it's name is tabbar class. And i am calling all page.

TTabBar *tabbar=[[TTabBar alloc] init];
[self.navigationController pushViewController:tabbar animated:YES];
tabbar.selectedIndex = 0;


You can try adding segments from code using following

    segmentedControl = [[UISegmentedControl alloc]initWithFrame:CGRectMake(115, 210, 190, 30)];
    segmentedControl.segmentedControlStyle = UISegmentedControlStyleBar;
    [segmentedControl insertSegmentWithImage:[UIImage imageNamed:@"bus.png"] atIndex:0 animated:YES];
    [segmentedControl insertSegmentWithImage:[UIImage imageNamed:@"car.png"] atIndex:1 animated:YES];
    [segmentedControl insertSegmentWithImage:[UIImage imageNamed:@"walking.png"] atIndex:2 animated:YES];
    segmentedControl.selectedSegmentIndex =0;
    segmentedControl.tintColor = [UIColor greyColor];
    [mainView addSubview:segmentedControl];


I assume you are adding segment control as leftBarButtonItem or rightBarButtonItem. How about setting barButtonItem to nil and add the new one?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜