我有一個plist,填充標籤欄上的所有內容,包括tableview:標籤名稱,標籤圖標,標題,細節,並使VC進入viewControllers數組。 「Banner VC alloc with content view controller:viewControllers」 - 不接受數組,只接受單個VC或多個VC(如果它們已知的話)。 這些標籤是可變的,他們可以移動和更改,所以我不能單獨編程它們。如何將未知的選項卡數組傳遞給bannerview控制器?橫幅VC不會加載從plist陣列
下面非常接近,但橫幅vc將只顯示在plist中的最後一個集合,而不是整個集合......並且如果我嘗試將viewControllers數組傳遞給它,就會崩潰。
即時通訊問的是什麼...你如何加載一個內置5個標籤的plist的banner vc?
提前致謝。如果有可能的話,請嘗試引導我。我真的不想限制自己onyl 5選項卡。
我只是向plist添加一個鍵,它會自動將選項卡廣告到更多部分......我如何通過bannew VC來傳遞此選項?
_tabBarController.viewControllers = viewControllers; //Loads the array viewControllers fine with 5 tabs and icons, but no banner container
_tabBarController.viewControllers = @[[[BannerViewController alloc] initWithContentViewController:viewControllers]] // Crashes on launch
_tabBarController.viewControllers = @[[[BannerViewController alloc] initWithContentViewController:newsNavigationController]] // Loads only the last key in plist and with no icons
@implementation AppDelegate {
UITabBarController *_tabBarController;
}
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
CGRect bounds = [[UIScreen mainScreen] bounds];
self.window = [[UIWindow alloc] initWithFrame:bounds];
self.window.backgroundColor = [UIColor whiteColor];
NSMutableArray * viewControllers = [[NSMutableArray alloc] init];
NSString * subscriptionListFile = [[[NSBundle mainBundle] bundlePath] stringByAppendingPathComponent:@"My_Subscription.plist"];
NSDictionary * subscriptionList = [[NSDictionary alloc] initWithContentsOfFile:subscriptionListFile];
NSArray * subscriptionFolders = subscriptionList[@"Folders"];
NewsListViewController * newsController = nil;
UINavigationController * newsNavigationController = nil;
for (NSDictionary * folderDetails in subscriptionFolders) {
NSArray * newsItems = folderDetails[@"Items"];
NSString * folderTitle = folderDetails[@"FolderName"];
NSString * folderIcon = folderDetails[@"FolderIcon"];
UIImage * folderIconImage = [UIImage imageNamed:folderIcon];
newsController = [[NewsListViewController alloc] initWithNewsSourceList:newsItems];
[newsController setTitle:folderTitle];
newsNavigationController = [[UINavigationController alloc] initWithRootViewController:newsController];
[newsNavigationController setTitle:folderTitle];
[newsNavigationController.tabBarItem setImage:folderIconImage];
[viewControllers addObject:newsNavigationController];
}
_tabBarController = [[UITabBarController alloc] init];
// _tabBarController.viewControllers = viewControllers; <--- this line works, below doesnt load the array...
_tabBarController.viewControllers = @[[[BannerViewController alloc] initWithContentViewController:viewControllers]]
self.window.rootViewController = _tabBarController;
[self.window makeKeyAndVisible];
return YES;
}
@end //The above crashes, but works fine if I SKIP "BannerViewController alloc..."
//and go right to "_tabBarController.viewControllers = viewControllers"
//perfect but no adbanner :(
BannerViewController的一個子類是什麼類? – rdelmar
它直接來自iAd suite oct24th,標籤式橫幅示例。它只是一個uivc。 –