我正在尝试创建这样的ui bar按钮来更改视图。
但是,我不知道如何将2 ui bar buttom放在一起(1个方形按钮和4个方形按钮)。我只知道如何做这样的事情。我该怎么办?
答案 0 :(得分:1)
UISegmentedControl
而非UIButton
UISegmentedControl *segmentedControl = [[UISegmentedControl alloc] init];
[segmentedControl insertSegmentWithImage:[UIImage imageNamed:@"0.png"] atIndex:0 animated:NO];
[segmentedControl insertSegmentWithImage:[UIImage imageNamed:@"1.png"] atIndex:1 animated:NO];
UIBarButtonItem *barButtonItem = [[UIBarButtonItem alloc] initWithCustomView:segmentedControl];
[[[self navigationController] navigationItem] setRightBarButtonItem:barButtonItem];