任何人都可以帮助我如何使用标题视图属性向导航标题视图添加两个按钮。我试过了,但只能使用以下代码添加一个按钮。
UIView *customView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 100, 100)];
customView.backgroundColor = [UIColor redColor];
UIButton *b1 = [[UIButton alloc] initWithFrame:CGRectMake(0, 0, 50, 50)];
UIButton *b2 = [[UIButton alloc] initWithFrame:CGRectMake(0, 0, 50, 50)];
[b1 setTitle:@"Hai" forState:UIControlStateNormal];
[b2 setTitle:@"Hello" forState:UIControlStateNormal];
[customView insertSubview:b1 atIndex:0];
[customView insertSubview:b2 atIndex:1];
self.navigationItem.titleView = customView;