У меня есть следующий код, который добавляет некоторые кнопки в контроллер навигации.Мне нужно это, чтобы у меня была панель инструментов с несколькими элементами.
CGRect frame = self.navigationController.navigationBar.frame;
frame.size.height += 0.01f;
UIToolbar *tb= [[UIToolbar alloc] initWithFrame:frame];
NSMutableArray *tbitems = [NSMutableArray array];
tb.autoresizingMask= UIViewAutoresizingFlexibleWidth;
UIBarButtonItem* bi = [[UIBarButtonItem alloc]
initWithBarButtonSystemItem:UIBarButtonSystemItemAdd target:self action:NULL];
bi.style = UIBarButtonItemStyleBordered;
[tbitems addObject:bi];
[bi release];
bi = [[UIBarButtonItem alloc]
initWithBarButtonSystemItem:UIBarButtonSystemItemFixedSpace target:nil action:nil];
[tbitems addObject:bi];
[bi release];
bi = [[UIBarButtonItem alloc]
initWithBarButtonSystemItem:UIBarButtonSystemItemRefresh target:self action:@selector(refresh:)];
bi.style = UIBarButtonItemStyleBordered;
[tbitems addObject:bi];
[bi release];
tb.items = tbitems;
self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithCustomView:tb];
[tb release];
Это прекрасно работает в книжной ориентации, однако в альбомной - не очень хорошо!В конце есть пробел, и я не могу понять, как заставить его заполнить пробел!
![gap](https://i.stack.imgur.com/ymK5i.png)