Advertise here




Advertise here

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Sign In with Google Sign In with OpenID
Please do not post the same thing multiple times. The board software automatically flags certain posts as needing moderator attention. This happens the most often for new users. I'm pretty sure this is made clear at the time you attempt to post. Posting the same thing over and over again just makes that many more posts the moderators have to weed through later. This makes us sad. Don't make us sad. If your post/thread doesn't appear, just wait a while. Don't post it again. If it hasn't shown up by the next day, then you can try again. I normally go through posts in the mornings, and try to check a few times throughout the day, but I'm not here 24/7. There will typically be a significant delay before posts are approved. Just be patient.

How to Access the same ViewController but with different functionality

chanduschandus Posts: 6New Users
edited June 2012 in iPhone SDK Development
i have a view controller with a list of categories which is in an UITableView.I push this View Controller in three other viewcontrollers.so the same functionality of the tableView is getting applied when ever it is called which i dont want to happen.

to be precise the following method should be accessible when it is called from one view controller only.

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
self.index = indexPath;
[retrieveName getItemName:[self.arrayForCategories objectAtIndex:indexPath.row]];
[self dismissModalViewControllerAnimated:YES];
[tableView reloadData];
}
Post edited by chandus on

Replies

  • givensurgivensur Posts: 315Registered Users
    edited June 2012
    You could subclass the view controller, and include that method in the subclass. Then you just use the subclass for the view controller that you want that functionality in.

    Or, you could have a BOOL property that determines whether or not the table view should respond to selections, and set that property before pushing the view controller (set it in prepareForSegue:sender: if you are using storyboards).
    I make cake apps.
    Some of my code can be found on GitHub.
Sign In or Register to comment.