2012-04-27 11 views
1

현재 iOS 응용 프로그램 상단에 Adwhirl보기를 추가하려고합니다. 응용 프로그램은 다섯 개의 다른보기로 구성되며, 모두 단일 TabBarController의 제어를받습니다. 누구든지이 작업을 수행하는 데 필요한 코드를 보여주는 간단한 자습서를 작성할 수 있습니까? 나는 보았고 그곳에 많은 해결책을 시도했지만 그들 중 누구도 일을하지 않고있다.tabBarController에 AdWhirl보기 추가

다음은 현재 내 문제를 시도한 것입니다. 오류는 발생하지 않지만 화면에 다른 내용은 표시되지 않습니다. 미리 감사드립니다.

@implementation idoubs2AppDelegate 

@synthesize window; 
@synthesize tabBarController; 
@synthesize contactsViewController; 
@synthesize messagesViewController; 
@synthesize adwhirlview = adview; 

static UIBackgroundTaskIdentifier sBackgroundTask = UIBackgroundTaskInvalid; 
static dispatch_block_t sExpirationHandler = nil; 

#pragma mark - 
#pragma mark Application lifecycle 

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { 

AdWhirlView *adView = [AdWhirlView requestAdWhirlViewWithDelegate:self]; 
[self.tabBarController.view addSubview:adView]; 
adView.center = CGPointMake(160, 342); 
[self.tabBarController.view bringSubviewToFront:adView]; 
} 

- (NSString *)adWhirlApplicationKey { 
// return your SDK key 
return kSampleAppKey; 

} 
- (UIViewController *)viewControllerForPresentingModalView { 

//return UIWindow.viewController; 
return [(idoubs2AppDelegate *)[[UIApplication sharedApplication] delegate]  tabBarController]; 

} 
- (void)adWhirlDidReceiveAd:(AdWhirlView *)adWhirlView { 



} 

답변

1

당신은 아마 당신이 당신의 탭 표시 줄의 레이아웃을 사용자 정의해야하는 경우가 여기에 교체의 몇 가지를 살펴 할 수 있습니다, 보통의 UITabBar에 하위 뷰를 추가해서는 안 : http://cocoacontrols.com/

0

을 UITabBar에 하위 뷰를 추가하는 대신에 GADBannerView 싱글 톤과 비슷한 것을 만들면 UITabBarController에 포함 된 ViewControllers에 각각 추가 할 수 있다고 생각할 수 있습니다.

그래서 싱글 톤을 쉽게 설정할 수 있습니다 (AdMob 광고에서이 작업을 수행하고 AdWhirl과 함께 작동시키는 방법은 간단하지 않은 StackOverflow 질문 here이 있습니다).

UIViewController *viewController1 = [[[FirstViewController alloc] 
             initWithNibName:@"FirstViewController" 
             bundle:nil] 
             autorelease]; 
    UIViewController *viewController2 = [[[SecondViewController alloc] 
             initWithNibName:@"SecondViewController" 
             bundle:nil] 
             autorelease]; 

    self.tabBarController = [[[UITabBarController alloc] init] autorelease]; 
    self.tabBarController.viewControllers = [NSArray arrayWithObjects: 
              viewController1, 
              viewController2, 
              nil]; 
:

은 그럼 그냥처럼 UITabBarController하고 무언가로 일부 ViewControllers를 추가