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 08-15-2010, 10:14 AM   #1 (permalink)
Registered Member
 
Join Date: Feb 2010
Posts: 66
hatembr is on a distinguished road
Default 2 UITabBarItems weird behavior : 1st visible & 2nd hidden until clicked

hi,

I have a weird behavior with tab bar items.

I have 2 items in the tab bar. when the app is launched, the 1st one's image is visible but not the title. while the second is completely visible. when clicked the 2nd's text disappears.

any idea please ? here is my code :

Code:
ArticlesViewController *articlesViewController = [[ArticlesViewController alloc] initWithNibName:@"ArticlesViewController" bundle:[NSBundle mainBundle]];
	WebTVViewController *videosViewController = [[WebTVViewController alloc] initWithNibName:@"WebTVViewController" bundle:[NSBundle mainBundle]];
	
	UINavigationController *articlesNavController = [[UINavigationController alloc] initWithRootViewController:articlesViewController];
	UINavigationController *videosNavController = [[UINavigationController alloc] initWithRootViewController:videosViewController] ;
	
	// tab bar items
	UITabBarItem *itemArticles = [[UITabBarItem alloc] initWithTitle:@"Top News" image:[UIImage imageNamed:@"v2-tabbar-une.png"] tag:1];
	articlesNavController.tabBarItem = itemArticles;
	[itemArticles release];
	
	UITabBarItem *itemWebTV = [[UITabBarItem alloc] initWithTitle:@"Web TV" image:[UIImage imageNamed:@"v2-tabbar-webtv.png"] tag:1];
	videosViewController.tabBarItem = itemWebTV;
	[itemWebTV release];
	
	tabBarController.viewControllers  = [NSArray arrayWithObjects:articlesNavController, videosNavController, nil];
	
	
	[articlesNavController release];
	[videosNavController release];
	[articlesViewController release];
	[videosViewController release];
I have attached 2 screenshots to see this behavior.
Attached Images
File Type: png s1.png (16.8 KB, 0 views)
File Type: png s2.png (13.2 KB, 0 views)
hatembr is offline   Reply With Quote
Old 08-15-2010, 10:16 AM   #2 (permalink)
Registered Member
 
Join Date: Feb 2010
Posts: 66
hatembr is on a distinguished road
Default

seems like the attachments are not working.
here are the links :

hatembr is offline   Reply With Quote
Old 08-15-2010, 10:51 AM   #3 (permalink)
Registered Member
 
Join Date: Feb 2010
Posts: 66
hatembr is on a distinguished road
Unhappy

I moved the bar item creation to the init function as described in the apple docs :

Code:
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil {
	if (self = [super initWithNibName:@"ArticlesViewController" bundle:nil]) {
		
		// tab bar items
		UIImage *tabImage = [UIImage imageNamed:@"v2-tabbar-une.png"];
		UITabBarItem *itemArticles = [[UITabBarItem alloc] initWithTitle:@"Top News" image:tabImage tag:0];
		itemArticles.enabled = YES;
		self.tabBarItem = itemArticles;
		[itemArticles release];
		
		self.title = @"";
	}
	
	return self;
}

Now I get this :




any idea please ?
hatembr is offline   Reply With Quote
Old 08-17-2010, 07:03 AM   #4 (permalink)
Registered Member
 
Join Date: Feb 2010
Posts: 66
hatembr is on a distinguished road
Talking

plz, any idea why is this happening?
hatembr is offline   Reply With Quote
Old 08-17-2010, 07:08 AM   #5 (permalink)
Registered Member
 
Join Date: Sep 2008
Location: London, UK
Posts: 1,050
wuf810 is on a distinguished road
Default

Quote:
Originally Posted by hatembr View Post
plz, any idea why is this happening?
Not sure as I only ever use IB to create tabBars.

Anyway a long shot: could it be they have the same Tag number?
wuf810 is offline   Reply With Quote
Old 08-17-2010, 07:54 AM   #6 (permalink)
Registered Member
 
Join Date: Feb 2010
Posts: 66
hatembr is on a distinguished road
Default

no :s
I tried different ones but it looks the same.
hatembr is offline   Reply With Quote
Old 08-17-2010, 08:51 AM   #7 (permalink)
Registered Member
 
Join Date: Feb 2010
Posts: 66
hatembr is on a distinguished road
Default

ok I moved to IB. It is solved.
But I am still curious to know why it wasn't working. I checked Apple's tutorials and few blogs, the code is the same. Weird.
hatembr is offline   Reply With Quote
Old 08-17-2010, 09:08 AM   #8 (permalink)
Registered Member
 
Join Date: Sep 2008
Location: London, UK
Posts: 1,050
wuf810 is on a distinguished road
Default

Quote:
Originally Posted by hatembr View Post
ok I moved to IB. It is solved.
But I am still curious to know why it wasn't working. I checked Apple's tutorials and few blogs, the code is the same. Weird.
Not sure but it could be something minor and easily missed.

Anyway glad to hear it is working now!
wuf810 is offline   Reply With Quote
Reply

Bookmarks

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: 346
5 members and 341 guests
bignoggins, Chickenrig, givensur, linkmx, PlutoPrime
Most users ever online was 1,387, 04-10-2012 at 04:21 AM.
» Stats
Members: 175,657
Threads: 94,118
Posts: 402,894
Top Poster: BrianSlick (7,990)
Welcome to our newest member, jenniead38
Powered by vBadvanced CMPS v3.1.0

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