Where to put code for buttons on navigation bar in MVC

Considering MVC design pattern, I was not sure where I put code for buttons on the navigation bar.

button on navigation bar

↑You can see this kind of button at the navigation bar in a modal view. Before, I usually wrote code for the button in loadView: method of a viewController class like this :
    UIButton *closeButton = [UIButton buttonWithType:102];
    [closeButton setTitle:@"CLOSE" forState:UIControlStateNormal];
    [closeButton addTarget:self action:@selector(tappedCloseButton) forControlEvents:UIControlEventTouchUpInside];
    UIBarButtonItem *closeButtonItem = [[[UIBarButtonItem alloc] initWithCustomView:closeButton] autorelease];
    self.navigationItem.rightBarButtonItem = closeButtonItem;
And I tried to remove this code from this C to V class. I suppose this code should be in a V class.
But as you see above, this code needs a reference of an object of UIViewController class.
Do I have to send the reference to V class?
    View *view = [[View alloc] initWithFrame:frame controller:self];
    self.view = view;
Really? I don’t like this… I guess View must NOT know a reference of Controller class in MVC. If need, I have to use delegate. I believe this but something is wrong?
I have to be careful when I see other developers’ code.
Develop | Comments(1) | Trackback(0)
Comment is pending approval.
Comment is pending blog author's approval.