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 09-13-2010, 02:02 PM   #1 (permalink)
Registered Member
 
Join Date: Sep 2009
Posts: 38
mtbennett24 is on a distinguished road
Default How to pass a variable to a UITabBarController viewController

Hello,

What is the best way to pass a variable from a UIViewController to a viewController in the UITabBarController before making it visible. The following code is throwing an error:

2010-09-13 11:51:40.752 iFlyGuide[948:207] *** -[UINavigationController setImageObj:]: unrecognized selector sent to instance 0x12a280
2010-09-13 11:51:40.758 iFlyGuide[948:207] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[UINavigationController setImageObj:]: unrecognized selector sent to instance 0x12a280'

Code:
- (void)mapButtonPressed:(id)sender {
	AppDelegate *appDelegate = (AppDelegate *)[[UIApplication sharedApplication] delegate];
	
	MapViewController *mvc = [appDelegate.tabBarController.viewControllers objectAtIndex:2];
	mvc.imageObj = self.imageObj;
	appDelegate.tabBarController.selectedViewController = mvc;
	
}
From the current UIViewController, there is an object 'imageObj' I would like to pass that value to the MapViewController (which is part of the UITabBarController.viewControllers) before making it visible. Is this possible? I have declared and synthesized an 'imageObj' variable in MapViewController.

Thank you.
mtbennett24 is offline   Reply With Quote
Old 09-13-2010, 05:27 PM   #2 (permalink)
Registered Member
 
Join Date: Sep 2009
Posts: 38
mtbennett24 is on a distinguished road
Default

Is it even possible to set values in UIViewController that is part of the viewControllers array in UITabController from some other ViewController within the app before switching to the aformentioned UIViewController?
mtbennett24 is offline   Reply With Quote
Old 09-13-2010, 05:41 PM   #3 (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're not paying enough attention to that error message. You tried to send it to a navigation controller. You aren't dealing with the correct object.
__________________
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 09-13-2010, 07:07 PM   #4 (permalink)
Registered Member
 
Join Date: Sep 2009
Posts: 38
mtbennett24 is on a distinguished road
Default

Thank you
mtbennett24 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: 332
14 members and 318 guests
Absentia, cgokey, fiftysixty, givensur, heshiming, iGamesDev, linkmx, michaelhansen, mraalex, PixelInteractive, raihan.zbr, Sloshmonster, Trickphotostudios
Most users ever online was 1,387, 04-10-2012 at 04:21 AM.
» Stats
Members: 175,657
Threads: 94,117
Posts: 402,890
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:06 AM.
Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0