2013-04-15 10 views
5

करने के लिए एक कस्टम दृश्य जोड़ना मुझे लगता है कि जब एक घटना शुरू हो रहा है मैं एक कस्टम UIView जरूरत है सिर्फ NavigationBar नीचे प्रकट करने के लिए है, लेकिन मौजूदा ViewController बाधा नहीं एक UINavigationController है। मुझे UIView को लगातार चालू करने की आवश्यकता होगी क्योंकि नियंत्रकों को पॉप/धक्का दिया जाता है।UINavigationController

- (id)initWithNavigationController:(UINavigationController *)navController { 
    self.navController = navController; 
    return [self init]; 
} 

- (id)init 
{ 
    CGRect viewFrame = self.navController.view.frame; 

    return [self initWithFrame:CGRectMake(viewFrame.origin.x, 
             self.navController.navigationBar.frame.origin.y + self.navController.navigationBar.frame.size.height, 
             viewFrame.size.width, 
             40.0)]; 
} 

इस इस बारे में जाने के लिए रास्ता नहीं है:

----------------- 
| Status Bar | 
----------------- 
|  Nav Bar  | 
----------------- 
| Custom View | 
----------------- 
|     | 
| View Controller | 
|     | 
----------------- 

मैं वर्तमान में मेरे CustomView (UIView) की तरह फ्रेम की स्थापना हो रही है?

+0

इस कोशिश https://github.com/tursunovic/DMRNotificationView –

उत्तर

0
- (id)initWithNavigationController:(UINavigationController *)navController { 
    CGRect viewFrame = navController.view.frame; 

    if (self = [super initWithFrame:CGRectMake(viewFrame.origin.x, 
             navController.navigationBar.frame.origin.y + navController.navigationBar.frame.size.height, 
             viewFrame.size.width, 
             40.0)]){ 
     self.navController = navController; 
     } 
    return self; 
    } 

फिर

CustomView* _myCustomView = [[CustomView alloc] initWithNavigationController:navigationController]; 
[navigationcontroller.view addSubview:_myCustomView]; 
संबंधित मुद्दे