Re: [問題] 有關navigation 返回按鈕 圖形

看板MacDev作者 (tingyu)時間12年前 (2012/11/15 21:44), 編輯推噓1(100)
留言1則, 1人參與, 最新討論串2/2 (看更多)
※ 引述《j5307 (JJ)》之銘言: : 在做返回按鈕時 : self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc] : initWithTitle:@"影片清單" : style:UIBarButtonItemStylePlain : target:self : action:@selector(backToHome:)]; : 會執行backToHom方法 : 而此時 返回按鈕的 圖形是 矩形 : 而欲想改成 rectangle shape 左邊有箭頭的矩形 : UIBarButtonItem *backButton = [[UIBarButtonItem alloc] : initWithTitle:@"影片清單" : style:UIBarButtonItemStylePlain : target:self : action:@selector(backToHome:)]; : self.navigationItem.backBarButtonItem = backButton; : 可以產生有箭頭的矩形 但是卻無法呼叫backToHome : 所以似乎是無法實現這部分的動作 UIButton *customButton = [UIButton buttonWithType:xxxxx]; [customButton addTarget:self action@selector(backToHome:) forControlEvent:xxx]; 反正就這個button要什麼樣子你就自己做一個出來,然後: self.navigationItem.leftButtonItem = [[UIBarButtonItem alloc] initWithcustomView:customButton]; 這樣就可以了 -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 111.243.139.152

11/16 11:22, , 1F
謝謝分享囉
11/16 11:22, 1F
文章代碼(AID): #1GfF76_Z (MacDev)
討論串 (同標題文章)
文章代碼(AID): #1GfF76_Z (MacDev)