UINavigationControllerでsetAlpha
-
26-09-2019 - |
質問
私はUINavigationControllerにtitleViewのアルファを設定したいのです。ここでは、このクラスのコードがあります:
#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
また、ここではその結果のスクリーンショットです:あなたは、アルファが変更されていない見ることができるように
任意のアイデア?アム私は間違った場所でこれを置く?
解決
問題がself.navigationItem.titleView
はあなたに何も与えないということです。プロパティは、あなたのスクリーンショットに示されているデフォルトのラベルを置き換えるためにあなたによって設定することができます。しかし、あなたがやりたいように設計一切APIはありません。
質問です:あなたが達成するために何をしたいですか?あなたがしたい場合はバーを半透明にする、またはそれの色合いを変更することができます。テキストの不透明度を変更すると、あまりにも簡単ではありません。あなたの可能性は、のコントローラのUINavigationBarのサブビューとフィドルが、私はそれを控えると思います。
所属していません StackOverflow