开发者

Iphone: Calling a function in a view controller from the super view controller?

Hi Im new to Iphone App development. I have a Tab bar based application. In one of the Tabs I have a Custom Navigation View controller with a Custom Table View Controller. How do I call a function in the Custom Table View Controller from the viewDidLoad method of the Super Controller i.e the Cus开发者_StackOverflowtom Navigation View Controller?

Thanks


How are you instantiating the Custom Table View Controller? Is it a Nib or programmatically.

If the former use an IBOutlet from the Custom Navigation View Controller to the instance of the custom TV controller.

If the latter just keep a ivar handle to the custom TV controller when you create it.

as in self.ctvc = [[[MyCVTV alloc] initWithNibName:nil bundle:nil] autorelease];

where ctvc is @property (readwrite,retain) MyCTVC *ctvc;

Dont forget to release in the dealloc overide

-(void)dealloc {
self.ctvc = nil;
[super dealloc];
}

So when you wish to use the method from the viewDidLoad method. [ctvc doSomething:thing]

But UINavigationController isnt designed for sub-classing . http://developer.apple.com/library/ios/#documentation/uikit/reference/UINavigationController_Class/Reference/Reference.html

You should rethink your object structure

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜