3
看起來UITabBarController在iPad中使用垂直標籤時將標籤數量限制爲8。
但我想顯示9個或更多選項卡。如何添加9個或更多的選項卡到UITabBarController?
首先,我只設置了1到7個選項卡到UITabBarController,
並使用UITabBarController以外的第8個和第9個選項卡作爲以下源代碼。
它顯示9選項卡,但會導致一些問題,如工具欄,旋轉withoug權限左右等。
有什麼方法可以正確顯示9個或更多選項卡嗎?
#define RT_TABMEMU_ITEM_MAX 8
#define RT_TABMEMU_ITEM_MAX_WITH_MORE 7
- (void)setSelectedViewController:(UIViewController *)selectedViewController {
...
// If the amount of viewController is less than 9,
// or index of selectedViewController is 0~6,
// set selectedViewController to UITabBarController
if (!(RT_TABMEMU_ITEM_MAX < [self.viewControllers count]
&& RT_TABMEMU_ITEM_MAX_WITH_MORE <= [self.viewControllers indexOfObject:selectedViewController])) {
[super setSelectedViewController:selectedViewController];
}
...
}
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
UIViewController *selectedController = (self.viewControllers)[indexPath.row];
if (self.selectedViewController != selectedController) {
[self setSelectedViewController:selectedController];
...
謝謝!看起來不錯的項目..我嘗試使用它。 – Kazuya 2013-03-15 01:28:50