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

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

Draw This
($0.99)

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

Pic Frame Dynamo: Photo Editing
($0.99)

Want your application or service advertised on iPhone Dev SDK?

Go Back   iPhone Dev SDK Forum

View Single Post
Old 07-24-2009, 03:18 PM   #1 (permalink)
blueFLoyd8
Registered Member
 
Join Date: Mar 2009
Posts: 96
blueFLoyd8 is on a distinguished road
Default Accessing a view controller from App delegate class

Good afternoon everyone.
I'm trying to refresh a list from another class. There is a view controller class that adds the list controller class as a subview. I wrote a method in the App delegate that gets the list's view controller class. I'm getting a warning from this code, and the App will crash when it reaches the line in bold

Warning: tabBarItemController may not respond to '-getListViewController'
I used getter/setter methods so that listViewController should be available. So I think the problem might be how I am getting the view controller from the tabBarController.

Code:
- (void) refresListViewController {
	NSLog(@"Delegate: getting View Controller");
	tabBarItemController *vc = [tabBarController.viewControllers objectAtIndex:1];  // This might be the problem line
	if (vc != nil) {
		NSLog(@"Delegate: getting listView controller");
		ObjectListController *objViewController = [vc getListViewController]; // CODE CRASHES HERE. GETS WARNING
		[objViewController refreshTable];
	} else {
		NSLog(@"Delegate: Error, unable to get ListViewController");
	}
}

Last edited by blueFLoyd8; 07-24-2009 at 03:20 PM.
blueFLoyd8 is offline   Reply With Quote
 

» Advertisements
» Stats
Members: 175,014
Threads: 93,860
Posts: 401,911
Top Poster: BrianSlick (7,962)
Welcome to our newest member, Shimi574
Powered by vBadvanced CMPS v3.1.0

All times are GMT -5. The time now is 08:47 AM.
Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.