2011-07-02 2 views

答えて

0

はい、appDelegateのようにグローバル関数を作成し、その関数にいくつかのパラメータを渡すことができます。あなたのnavigationController、target、selectorを渡すように。

ここにサンプルコードスニペットがあります。

- (UIBarbuttonItem *) rightBarButtonGlobal:(UINavigationItem*)navigationItem target:(id)target { 
    //you can also pass nsstring for title and selector for you desired selector. 
    //But as per your question I assume you want a application logo like button in navigation bar. If that is the case just pass navigationItem as parameter.Create your logo button and assign to navigationItem. 
    //Allocate button here 
    navigationItem.rightBarButtonItem = button; 
    [button release]; 
} 
関連する問題