作爲我的頭銜,我瀏覽了幾個網站,但未能取得成效。不過,我成功地在導航欄上添加了一個圖像。這是我目前面臨的兩個問題,都在UINavigationBar部分。 1.無法顯示rightbarbutton 2.無法隱藏後退箭頭 「<」UINavigationItem rightbarbuttonitem not displayed
MasterViewController.m
//Back Button
UIButton *backBtn = [UIButton buttonWithType:UIButtonTypeCustom];
UIImage *backBtnImage = [UIImage imageNamed:@"sidemenu.png"];
[backBtn setBackgroundImage:backBtnImage forState:UIControlStateNormal];
backBtn.frame = CGRectMake(0, 0, 54, 30);
//Rightbarbutton
UIButton *infoButton = (UIButton *) [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"icon_info.png"]];
UIBarButtonItem *infoButtonItem = [[UIBarButtonItem alloc] initWithCustomView:infoButton];
self.navigationItem.rightBarButtonItem = infoButtonItem;
//Image (Working and displaying)
UIImage *image = [UIImage imageNamed: @"icon_image.png"];
UIImageView *imageView = [[UIImageView alloc] initWithFrame:CGRectMake(245, 0, 30, 42)];
[imageView setImage:image];
[self.navigationController.navigationBar addSubview:imageView];
相同的程序是bringSubviewToFront?正如我剛剛「沒有可見@interface for'UINavigationBar'聲明選擇器'bringSubviewToBack:」。 – aka
對不起,我編輯了答案,這是sendSubviewToBack –
它不工作... – aka