setAlpha в UINavigationController - PullRequest
       5

setAlpha в UINavigationController

0 голосов
/ 31 августа 2010

Я хочу установить альфа titleView в моем UINavigationController. Вот код для этого класса:

#import "FAQNavigationController.h"


@implementation FAQNavigationController

/*
 // The designated initializer.  Override if you create the controller programmatically and want to perform customization that is not appropriate for viewDidLoad.
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil {
    if ((self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil])) {

    }
    return self;
}
*/


// Implement viewDidLoad to do additional setup after loading the view, typically from a nib.
- (void)viewDidLoad {

 self.navigationItem.titleView.alpha = 0.5;


    [super viewDidLoad];
}


/*
// Override to allow orientations other than the default portrait orientation.
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
    // Return YES for supported orientations
    return (interfaceOrientation == UIInterfaceOrientationPortrait);
}
*/

- (void)didReceiveMemoryWarning {
    // Releases the view if it doesn't have a superview.
    [super didReceiveMemoryWarning];

    // Release any cached data, images, etc that aren't in use.
}

- (void)viewDidUnload {
    [super viewDidUnload];
    // Release any retained subviews of the main view.
    // e.g. self.myOutlet = nil;
}


- (void)dealloc {
    [super dealloc];
}


@end

Кроме того, вот скриншот этого результата: Как вы можете видеть, альфа не изменилась.

alt text

Есть идеи? Я помещаю это в неправильном месте?

1 Ответ

1 голос
/ 31 августа 2010

Проблема в том, что self.navigationItem.titleView ничего вам не дает. Вы можете установить это свойство, чтобы заменить метку по умолчанию, показанную на снимке экрана. Однако нет API, предназначенного для того, что вы хотите.

Вопрос в том, чего вы хотите достичь? Вы можете сделать бар прозрачным, если хотите, или изменить его оттенок. Изменить непрозрачность текста не так просто. Вы могли бы возиться с подпредставлениями UINavigationBar контроллера, но я бы воздержался от этого.

...