UINavigationController: push self?

I have a custom class which is a UITableViewController, this is inside of a UINavigationController. Normally, when I click a cell, I push a new class onto the stack and it is fine. This time, I would like to push self onto the stack (passing a different string onLoad so that I load different content), so that I can reuse my code, is this possible? Or do I always have to create a secondary class to push?

Answers


Rather than "pushing yourself", you can push a new instance of the same view controller yes. Simply create a new one like so:

MyViewController *viewController = [[MyViewController alloc] initWithNibName:"MyView"];
viewController.customString = @"Something else";
[self.navigationController pushViewController:viewController];
[viewController release];

I haven't tested this, and it's late so there might be bits wrong but you should be ok with that. Let me know if it works!


Need Your Help

list filenames in the recyclebin with c# without using any external files

c# file list recycle-bin

I would like to have a function which retrieves me the filenames in the recycle bin (on win 7) with usage of c# code. The framework seems nothing to contain to achieve this.

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.