2014年4月18日金曜日

UIToolBar上のUIBarButtonItemを一時的に非表示にする

どうも
self.toolBarItemsから一時的に削除するのが筋らしいけど、なんか気持ち悪い。

で。

if(ButtonVisible)
{
    self.BarButtonRef.tintColor = nil;
    [self.BarButtonRef setEnabled:YES]
} else {
    self.BarButtonRef.tintColor = [UIColor colorWithWhite:0 alpha:0];
    [self.BarButtonRef setEnabled:NO]
}

注意点
・BarButtonRefってあるところはアウトレットするか、toolBarItemsから取得しておきます。
・デフォルトカラーじゃない場合はnilんとこ直します。





          /~~~~,

          /おしまい /
         /~~~~'
     / ̄ ̄\
    ./   ヽ_   \
   (●)(● )    |
   (__人__)     |
   ヽ`⌒´     |
    {         |
    {       ノ
    ヽ     ノ
   /      ヽ

0 件のコメント:

コメントを投稿