我正在尝试将 Adwhirl View 添加到我当前的 iOS 应用程序的顶部。该应用程序由五个不同的 View 组成,它们都在单个 TabBarController 的控制下。任何人都可以编写一个简短的教程来显示实现此目标所需的代码吗?我浏览并尝试了很多解决方案,但没有一个能奏效。
下面是我目前对这个问题的尝试,我没有收到错误,但我在屏幕上没有看到任何不同之处。提前致谢。
@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 {
}
最佳答案
您可能不应该向普通的 UITabBar 添加 subview ,如果您需要自定义选项卡栏的布局,您可能需要查看此处的一些替换:http://cocoacontrols.com/
关于iphone - 将 AdWhirl View 添加到 tabBarController,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10356899/