Advertise Mobile SDKs Books Events Forum News Social Networking Support Us
Follow @iphonedevsdk on Twitter

Interface 2, Advanced iOS
Mockup & Code Gen
($9.99)

Make your own iPhone apps
and run them live!
(free)

Pic Frame Dynamo: Photo Editing
($0.99)

Abiliator
($1.99)

Want your application or service advertised on iPhone Dev SDK?

Go Back   iPhone Dev SDK Forum > iPhone SDK Development Forums > iPhone SDK Development

Reply
 
LinkBack Thread Tools Display Modes
Old 01-14-2010, 10:13 PM   #1 (permalink)
Registered Member
 
Join Date: Dec 2009
Posts: 5
daffniles is on a distinguished road
Default moreNavigationController

Hi All.

I am trying to deal with the fact that when editing the tab view controller customisable list of Navigation controllers, you can only display around 20 on the screen as the view does not scroll.

In order to achieve this I have limited the displayed controllers to the current four in the tabbar, and twelve more, with pageination effectively allowing the rest to be displayed via a next and back button.

This works (sort of)... will post code below. What I cannot get to work is having the edit page unload. I need to do this so that it refreshes with the new list of controllers. At the moment, I push the next button and can get the list to come up by pressing the done and then the edit button again, and I would just like to automate that process. Any thoughts would be great, or if you have found another way to address the limit of 20 (or so) navigation controllers that can be displayed and manipulated via the edit function of the tabbarcontroller.

(PS. I have at times upwards of 30 controllers to display.)

Code.

Note that the application delegate is also the tabBarController delegate as well. tabCtrl is the tabBarController.


- (void)tabBarControllerUITabBarController *)tabBarController willBeginCustomizingViewControllersNSArray *)viewControllers
{
if([tabCtrl.viewControllers count] > 16)
{
UIView *edit_views = [tabBarController.view.subviews objectAtIndex:1];
UINavigationBar *edit_modal_navbar = [[edit_views subviews] objectAtIndex:0];

if(pageIndex == 0)
{
edit_modal_navbar.topItem.leftBarButtonItem = [[UIBarButtonItem alloc] initWithTitle:@"Next" style:UIBarButtonItemStylePlain target:self action:@selector(nextList)];
}
else if(pageIndex == 1)
{
edit_modal_navbar.topItem.leftBarButtonItem = [[UIBarButtonItem alloc] initWithTitle:@"Back" style:UIBarButtonItemStylePlain target:self action:@selector(backList)];
}
}
}

- (void)nextList
{
NSMutableArray *newViewControllers = [[NSMutableArray alloc] init];

for(int i = 0; i < [tabCtrl.viewControllers count]; i++)
{
if(i < 4 || i > 15)
{
[newViewControllers addObject:[tabCtrl.viewControllers objectAtIndex:i]];
}
}

pageIndex = 1;

[tabCtrl.moreNavigationController popToRootViewControllerAnimated:YES];

tabCtrl.customizableViewControllers = newViewControllers;
[newViewControllers release];
}

- (void)backList
{
NSMutableArray *newViewControllers = [[NSMutableArray alloc] init];

for(int i = 0; i < [tabCtrl.viewControllers count]; i++)
{
if(i < 16)
{
[newViewControllers addObject:[tabCtrl.viewControllers objectAtIndex:i]];
}
}

pageIndex = 0;

[tabCtrl.moreNavigationController popToRootViewControllerAnimated:YES];

tabCtrl.customizableViewControllers = newViewControllers;
[newViewControllers release];
}

Note the two calls to [tabCtrl.moreNavigationController popToRootViewControllerAnimated:YES] do not seem to do anything, which is contrary to what apple indicate a NavigationController should do.

Again any thoughts would be great as I have seen a couple of other posts of people trying to deal with the 20 controller limit, but with no suitable replies.

Cheers.
daffniles is offline   Reply With Quote
Old 01-14-2010, 10:16 PM   #2 (permalink)
Emphasizing Fundamentals
 
BrianSlick's Avatar
 
Join Date: Jul 2009
Location: NoVA / DC Area
Age: 36
Posts: 7,990
BrianSlick has a spectacular aura about
Default

You need 20 different tabs? Really? Time for a rethink of the app.
__________________
BriTer Ideas LLC - Professional iOS App Development. Available for hire.

SlickShopper 2 | Free NSLog utility | Leave a PayPal donation.

Are you a newbie? Things you should read:
Definitive Guide To Properties | UITableView Series | Guide To Troubleshooting | Model Object Overview

Do you sit at a desk all day? Walk instead! Follow along with my treadmill desk adventures.
BrianSlick is offline   Reply With Quote
Old 05-19-2010, 07:43 PM   #3 (permalink)
Registered Member
 
Join Date: May 2010
Posts: 1
kludgeless is on a distinguished road
Default Any luck?

Ran into the same problem recently. Curious if you ever found a workable solution!
kludgeless is offline   Reply With Quote
Reply

Bookmarks

Tags
morenavigationcontroller, tabbarcontroller

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



» Advertisements
» Online Users: 335
9 members and 326 guests
2Apps1Day, akacaj, Domele, michelle, NSString, SLIC, soohyun, Techgirl-52, v1n2e7t
Most users ever online was 1,387, 04-10-2012 at 04:21 AM.
» Stats
Members: 175,650
Threads: 94,114
Posts: 402,886
Top Poster: BrianSlick (7,990)
Welcome to our newest member, soohyun
Powered by vBadvanced CMPS v3.1.0

All times are GMT -5. The time now is 10:02 PM.
Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0