2010-08-06 20 views
5

मैं इससे कुछ एप्लिकेशन, जहां नेविगेशन पट्टी वास्तव में डिफ़ॉल्ट 44px से छोटी है पर किया है, और वहाँ एक UIView (जो कार्यक्षमता है) नेविगेशन बार से ऊपर है देखा है ...क्या आप UINavigationBar के ऊपर एक UIView जोड़ सकते हैं?

मैं अधिक से अधिक चाहते हैं एक कस्टम पृष्ठभूमि छवि, जिसे मैंने समझने के लिए प्रबंधित किया था कि कैसे करना है, लेकिन मुझे नहीं पता कि ऐसा कुछ करने के लिए कहां से शुरू करना है।

किसी भी मदद की बहुत सराहना कर रहा है :) मार्क

उत्तर

3

मैं यह करने के लिए रास्ता एक तरह से मिला:

UINavigationBar *navBar = [[UINavigationBar alloc] initWithFrame: CGRectMake(0.0f, 20.0f, 320.0f, 32.0f)]; 

UIView *tempView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 320, 20)]; 
UIImageView *back = [[UIImageView alloc] initWithImage: [UIImage imageNamed:@"logo.png"]]; 
[back setFrame: CGRectMake(0, 0, 320, 20)]; 
[tempView addSubview: back]; 
[[self view] addSubview: tempView]; 

[[self view] addSubview: navBar]; 

UINavigationItem *navItem = [[UINavigationItem alloc] initWithTitle: @"Controls"]; 
[navBar pushNavigationItem:navItem animated:NO]; 

जो, चाल करने के लिए लगता है, हालांकि मैं कैसे करने के लिए यह पता लगाने नहीं कर पा रहे नेविगेशन नियंत्रक को 'इन' में प्राप्त करें ताकि बैक बटन काम कर सकें, इस समय मुझे मैन्युअल रूप से leftBarButtonItem को NavItem में डालना होगा, बैक बटन कभी दिखाना नहीं लगता है ...

0

हाँ आप कर सकते हैं,

UINavigationBar *navBar = [[UINavigationBar alloc] initWithFrame: CGRectMake(0.0f, 20.0f, 320.0f, 32.0f)]; 
UIView *tempView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 320, 20)]; 
navBar.navigationBar.layer.zPosition =-1; 
self.view insertSubview:navBar atIndex:[[self.view subviews] count]]; 
[self.view insertSubview:tempView atIndex:[[self.view subviews] count]]; 
संबंधित मुद्दे