![](/img/trans.png)
[英]Add UITableViewController's view to another UIViewController, the “delegate” and “date source” are not called
[英]Putting another UIViewController's view within a “main” UIViewController — delegate methods
我正在嘗試使應用程序與iPhone上的iCal應用程序非常相似。
為此,我將集成兩個開源項目Kal(https://github.com/klazuka/Kal)和GuiCocoa / Calendar(https://github.com/guicocoa/calendar),以及我自己的項目編碼為“列表”視圖段。
我決定,因為我需要將所有內容嵌套在UINavigationController堆棧中,所以將這3個獨立項目實現為一種東西的最佳方法是,我將創建類似於UITabBarController的東西(其中有1個UIViewController類,用於存儲和嵌套其他類) UIViewControllers-但是,我想使用帶有UISegmentedControl的自定義UIToolbar來在不同的視圖控制器之間進行委派)。
因此,我遇到的最主要問題是行為的誤授權。 例如:
如果我單擊網格日期之一,它將消除錯誤:
-[UINavigationButton didSelectDate:]: unrecognized selector sent to instance 0x6c1aba0
或類似的東西。
也許我的問題應該是:是否存在UITabBarController的“子類”,我可以實現自己的UIToolbar,而不是正式的UITabBar等?
否則,是否有辦法指定將“子視圖”中的所有單擊委托給子視圖中的函數?
謝謝,rnc505
首先,您可以子類化UIToolBar對其進行自定義。
#import <Foundation/Foundation.h>
@interface CustomToolBar : UIToolbar
{
}
@end
#import "CustomToolBar.h"
@implementation CustomToolBar
@end
而不是調用:
UIToolbar *toolbar = [[UIToolBar alloc] init];
你打電話
CustomToolbar *toolbar = [[CustomToolbar alloc] init]
您的另一個選擇是僅根據需要更改按鈕的委托。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.