我試圖在我的應用中創建一個彈出式菜單,就像facebook應用使用的一樣。創建不帶導航欄按鈕的彈出菜單
我發現這個非常好的教程,並得到它在他們的例子中工作。 http://www.appcoda.com/ios-programming-sidebar-navigation-menu/
在他們的示例中,他們使用導航欄上的導航欄項作爲激活和取消激活彈出菜單的按鈕。
在我目前的項目中,我不想使用導航欄,並希望只有一個按鈕來激活彈出菜單。
但是,當涉及到下面的一段代碼時,我不會做什麼。
// Set the side bar button action. When it's tapped, it'll show up the sidebar.
_sidebarButton.target = self.revealViewController;
_sidebarButton.action = @selector(revealToggle:);
// Set the gesture
[self.view addGestureRecognizer:self.revealViewController.panGestureRecognizer];
我無法將動作和目標設置爲普通按鈕。
有沒有簡單的解決方法呢?
感謝
您使用的是iPhone或iPad嗎? –
iPhone的隊友,謝謝。 – user1923975
看看我的答案。 –