我將非常感謝任何幫助 - 我一直在試圖弄清楚如何在嵌套的UITABLEVIEW中更改tabbarcontroller上的選項卡,就像在RayWenderlich.com的教程中一樣像滾輪http://www.raywenderlich.com/4723/how-to-make-an-interface-with-horizontal-tables-like-the-pulse-news-app-part-2脈衝,但我真的陷入了困境。我正在使用故事板和xcode 4.4更改wenderlich教程中的Tabbarcontroller選項卡脈衝uitableview
我是幾個星期的xcode的全新手機,所以我很抱歉如果這是一個新手問題。我已經得到了嵌套的水平桌面正常工作,因爲上面的鏈接圖像,但我想使用圖像切換到新標籤,但不能 - 我認爲這是因爲tableview是嵌套的,所以我找不到正確引用層次結構中的tabbarcontroller。
如果我使用ArticleListViewController.m didselect其中教程包含註釋似乎建議插入導航代碼將生成一個NSLog輸出和更改選項卡確定,但只使用圖像上方的一個小薄條(我偶然發現),但但圖像沒有任何反應。
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
// Navigation logic may go here. Create and push another view controller
//THIS SELECTS WHEN CLICK THINSTRIP JUST ABOVE BUTTONS
NSLog(@"ARTICLELISTVIEWCONTROLLER check didSelect: %u", self.tabBarController.selectedIndex);
self.tabBarController.selectedIndex = 2;
}
內HorizontaTableCell.m下面的代碼,當我點擊的實際圖像,但我想不通的tabbarcontroller參考,讓我改變標籤更適當地產生的NSLog輸出。
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
//the following line just generates an Error as follows: Property tabBarController not found on object of type 'HorizontalTableCell *'
self.tabBarController.selectedIndex = 2;
NSLog(@"HORIZONTALTABLECELL DIDSELECT");
}
我看了看周圍的方式,但無法弄清楚。發現使用appdelegate的提到,但不知道如何做到這一點。不能發佈故事板圖像作爲新用戶,但有一個帶有4個導航控制器的tabbarcontroller出來 - 第一個是ArticleListViewController菜單,其他每個都是viewcontrollers - 我希望把WebView加載鏈接/本地頁面取決於選擇的菜單和其他用於關於屏幕和其他當前空白的屏幕。
請幫忙!
謝謝!
謝謝,我想我已經明白了!經過一段時間的拖網捕魚工作。從字面上花了整整一天,大部分時間試圖解決它! AppDelegate * appdelegate1 =(AppDelegate *)[[UIApplication sharedApplication] delegate]; appdelegate1.TBcontroller.selectedIndex = .... – elricardo