2011-03-21 4 views
2

저는 Objective-C에 익숙하지 않고 webradio 앱을 만들고 있습니다.앱의 어느 곳에서나 영구적 인보기

내 앱은 TabBarController에 포함 된 일부 NavigationController로 구성됩니다.

TabBar 전체 시간 위에 머무를 수있는보기를 만들고 싶습니다. (오디오 플레이어 컨트롤이 포함되어 있으며 앱의 어느 곳에서나 액세스 할 수 있어야합니다.)

이렇게하는 가장 좋은 방법은 무엇입니까?

감사합니다.

SQ; P 당신은 UITabBarController보기 속성의 서브 뷰로보기를 추가 할 필요가

답변

2

:

m_yourToolbar =[[UIToolbar alloc] initWithFrame:CGRectMake(0, 401, 320, 44)]; 
// set some properties on the toolbar 
// ... 
[self.tabBarController.view m_yourToolbar]; 

이것은 UITabBarController가 모든 탭의 내용을 통해 UILabel의 ㅋ 추가 (m_tabBarController) . , 앱 위임의 보류를 얻을 수있는 도구 모음을 업데이트해야 뷰 컨트롤러에 따라서

@synthesize yourToolbar= m_yourToolbar; 
// .. other app delegate stuff 

yourToolbar 속성을 잡고 설정 : 앱 위임 구현에서

@interface YouAppDelegate : NSObject <UIApplicationDelegate, UITabBarControllerDelegate> { 
    UIToolbar * m_yourToolbar; 

    // ... whatever other stuff you have in your app delegate 
} 

@property (nonatomic, retain) UIToolbar * yourToolbar; 

당신이 필요합니다 속성 :

AppDelegate *appDelegate = (YouAppDelegate *)[[UIApplication sharedApplication] delegate]; 
// set stuff on the toolbar property 
appDelegate.yourToolbar.stuff = stuff; 
+0

+1 이것은 특히 광고가 앱 전체에 나타나기를 원하는 경우 매우 일반적입니다. AdWhirl은이 정확한 것을 제안합니다. –

+0

고마워, 나는 그것을 시험해 볼 것이다. 하지만 UITabBarController를 구현하는 가장 좋은 방법은 무엇입니까 (Xcode 템플릿에는이 .h & .m 파일이 없습니다 .tabBarController는 appDelegate에 선언되어 있습니다) –

+0

UITabBarController를 구현할 필요가 없습니다. appDelegate에 선언 된 tabBarController에 액세스하면됩니다 (appDelegate 코드에서 m_tabBarController를 self.tabBarController로 바꿉니다). – RedBlueThing

관련 문제