4
我無法在導航欄(或導航控制器,位於應用程序頂部)中設置完整圖像。剩下的空間很小。當我把信息按鈕放在圖片上時,我怎樣才能解決這個問題無法在導航欄中設置完整圖像
這裏是我的代碼,請看看
UIImageView* img = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"headerBG.png"]];
img.frame = CGRectMake(0, 0, 320, 44);
self.navigationItem.titleView =img;
[img release];
UIButton * infoDarkButtonType = [[UIButton buttonWithType:UIButtonTypeInfoLight] retain];
infoDarkButtonType.frame = CGRectMake(0.0, 0.0, 25.0, 25.0);
infoDarkButtonType.backgroundColor = [UIColor clearColor];
[infoDarkButtonType addTarget:self action:@selector(showInfo) forControlEvents:UIControlEventTouchUpInside];
UIBarButtonItem *infoButton = [[UIBarButtonItem alloc] initWithCustomView:infoDarkButtonType];
self.navigationItem.leftBarButtonItem = infoButton;
[infoDarkButtonType release];
[infoButton release];
非常感謝你。
我。
YEP它可以工作,但它會改變每個頁面的所有導航欄。我只是想改變1頁。請你能指導我更多。 – crazyoxygen 2011-05-10 07:25:11
您是否可以隱藏導航欄並改爲使用與導航欄類似的自定義視圖,並使用必要的按鈕。 – visakh7 2011-05-10 08:11:55
對不起。恐怕不行。原因它來自導航控制器 – crazyoxygen 2011-05-10 08:22:26