iPhone 修改navigation bar 字型和顏色

paul_wuhaha發表於2012-03-26

- (void)setTitle:(NSString *) title

{

    [super setTitle:title];

    UILabel *titleView = (UILabel *)self.navigationItem.titleView;

    if(!titleView){

         titleView = [[UILabel alloc] initWithFrame:CGRectZero];

         titleView.backgroundColor = [UIColor clearColor];

         titleView.font = [UIFont boldSystemFontOfSize:20.0];

         titleView.shadowColor = [UIColor colorWithWhite:0.0 alpha:0.5];

         titleView.textColor = [UIColor blackColor];

         self.navigationItem.titleView = titleView;

    }

   titleView.text = title;

   [titleView sizeToFit];

}

這個群裡找的,是圖片,我一個個的碼上去的。。。


相關文章