Want to build a social recipe food app? Our food template app is the best place to start. Create the next digital food sensation with this beautiful, custom food app. Create intricate recipe with icons and images, and link to social networks. Our Food App Template is put together from the ground up for iOS in the modern Swift language.
//
// HomeViewController.swift
// Food
//
// Created by My App Templates Team on 28/08/14.
// Copyright (c) 2014 MyAppTemplates. All rights reserved.
//
import UIKit
class HomeViewController: UIViewController {
@IBOutlet var scrollViewTop : UIScrollView!
@IBOutlet var previousBtn : UIButton!
@IBOutlet var nextBtn : UIButton!
@IBOutlet var btnDesc : UIButton!
@IBOutlet var btnIngredient : UIButton!
@IBOutlet var btnProcess : UIButton!
@IBOutlet var viewDesc :UIView!
@IBOutlet var viewIngredient :UIView!
@IBOutlet var viewProcess :UIView!
var currentOffset : CGFloat = 0
override init(nibName nibNameOrNil: String?, bundle nibBundleOrNil: NSBundle?) {
super.init(nibName: nibNameOrNil, bundle: nibBundleOrNil)
// Custom initialization
}
required init(coder aDecoder: NSCoder)
{
super.init(coder: aDecoder)
}
override func viewDidLoad() {
super.viewDidLoad()
self.tabBarController?.tabBar.tintColor = UIColor.blackColor()
UITabBar.appearance().shadowImage = UIImage(named: "transparent.png")
for (index, value) in enumerate(self.tabBarController?.tabBar.items as NSArray!) {
var item : UITabBarItem
item = value as UITabBarItem
if (index == 0) {
item.image = UIImage(named:"icon-tab-add-new.png").imageWithRenderingMode(.AlwaysOriginal)
}
if (index == 1) {
item.image = UIImage(named:"icon-tab-recipes").imageWithRenderingMode(.AlwaysOriginal)
}
if (index == 2) {
item.image = UIImage(named:"icon-tab-wine").imageWithRenderingMode(.AlwaysOriginal)
}
if (index == 3) {
item.image = UIImage(named:"icon-tab-profile").imageWithRenderingMode(.AlwaysOriginal)
}
}
self.performSegueWithIdentifier("loginSegue", sender: nil)
previousBtn.enabled = 0;
scrollViewTop.contentOffset = CGPointMake(scrollViewTop.frame.size.width * 3, scrollViewTop.frame.size.height)
// Do any additional setup after loading the view.
}
@IBAction func nextBtnTapped (sender : UIButton){
previousBtn.enabled = 1;
if (currentOffset < 2) {
currentOffset++
}
if (currentOffset==2){
nextBtn.enabled = 0;
}
var newOffset : CGFloat
newOffset = currentOffset * 288.0
scrollViewTop.setContentOffset(CGPointMake(newOffset, 0), animated:1);
}
@IBAction func previousBtnTapped (sender : UIButton){
nextBtn.enabled = 1;
if (currentOffset > 0) {
currentOffset--
}
if (currentOffset == 0) {
previousBtn.enabled = 0;
}
var newOffset : CGFloat
newOffset = currentOffset * 288.0
scrollViewTop.setContentOffset(CGPointMake(newOffset, 0), animated:1);
}
@IBAction func descBtnTapped (sender : UIButton){
btnDesc.selected = 1
btnIngredient.selected = 0
btnProcess.selected = 0
viewDesc.hidden = 0
viewIngredient.hidden = 1
viewProcess.hidden = 1
}
@IBAction func ingredientBtnTapped (sender : UIButton){
btnDesc.selected = 0
btnIngredient.selected = 1
btnProcess.selected = 0
viewDesc.hidden = 1
viewIngredient.hidden = 0
viewProcess.hidden = 1
}
@IBAction func processBtnTapped (sender : UIButton){
btnDesc.selected = 0
btnIngredient.selected = 0
btnProcess.selected = 1
viewDesc.hidden = 1
viewIngredient.hidden = 1
viewProcess.hidden = 0
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
/*
// #pragma mark - Navigation
// In a storyboard-based application, you will often want to do a little preparation before navigation
override func prepareForSegue(segue: UIStoryboardSegue?, sender: AnyObject?) {
// Get the new view controller using [segue destinationViewController].
// Pass the selected object to the new view controller.
}
*/
}