Maj 8, 2017
174 Wyświetleń

Who doesn’t like hamburgers? ;)

A hamburger menu or pancake menu is a button usually placed in a top corner of a mobile app. The name comes from button’s icon which takes form of three horizontal lines  resembling the layers of a hamburger or a pile of pancakes. I love both ;) Tapping or clicking the button reveals application’s menu.

Facebook app has it’s menu placed at the bottom:

while Endomondo app in the top left corner:

I really like the endomondo settings style with options sliding from the left and wanted to achieve same results in my Magic hours app. Luckily, the ready-to-implement-solution is out there ;)

There’s a github project: SWRevealViewController that does the trick. And there’s also a tutorial showing how to include the classes written in Objective-C in your Swift project to achieve the sliding menu effect. The code is written for the earlier version of the language, but at the end of the article there’s a download link for the complete example project. Xcode can handle conversion to Swift 3 by itself :)

I followed the tutorial and can confirm that it works :)

My menu view consists of five labels. I will be adding tap gesture recognizers to perform various actions: navigating to map view, managing notifications, displaying „about” view and so on. See the little images on the left? Thanks to Xcode support for emoji adding an icon like this is now a piece of cake. Here you can find a complete list of smiles: just copy and paste. You can also search for a proper icon directly from Xcode: emoji keyboard opens up after pressing shift + cmd + space shortcut.