You guys asked for it (a lot!), so we’ve finally done it. Our super popular iOS Chatt app now comes with a backend. What backend – it’s only the coolest new Platform-as-as-Service, Atlas on Layer. This means it’s much easier that struggling through complex coding and deployment of your own web service. Just set up a Layer account, install our suppled PHP backend and get started customising your own Chat app fast.
On the app side, we’ve combined our beautiful, clean chat layout, and pared it down to it’s most functional – Facebook sign in, and Chat. We’ve included the artwork for other features in the PSDs that come with the project, incase you want to extend your customisation in any direction. So download Chatt app template with Layer Backend and get making!
//
// MainTabBarController.m
// Chat Template
//
// Created by Xin ZhangZhe on 17/16/15.
// Copyright (c) 2015 Harski Technology Pty Ltd. All rights reserved.
//
// --- Headers --- ;
#import "MainTabBarController.h"
// --- Defines --- ;
// MainTabBarController Class ;
@interface MainTabBarController ()
{
NSInteger selectedIndex ;
}
@end
@implementation MainTabBarController
// Functions ;
#pragma mark - Shared Functions
+ ( MainTabBarController* ) sharedController
{
NSArray* array = [ [ NSBundle mainBundle ] loadNibNamed : @"MainTabBarController" owner : nil options : nil ] ;
MainTabBarController* sharedController = [ array objectAtIndex : 0 ] ;
return sharedController ;
}
#pragma mark - MainTabBarController
- ( void ) viewDidLoad
{
[ super viewDidLoad ] ;
// Tab Bar ;
CGRect oldFrame = self.tabBar.frame ;
CGRect newFrame = viewForTabBar.bounds ;
newFrame.origin.y = oldFrame.origin.y + oldFrame.size.height - newFrame.size.height ;
[ self.tabBar setFrame : newFrame ] ;
[ self.tabBar addSubview : viewForTabBar ] ;
// Set ;
selectedIndex = -1 ;
[ self setSelected : 0 ] ;
}
- ( void ) didReceiveMemoryWarning
{
[ super didReceiveMemoryWarning ] ;
}
- ( void ) dealloc
{
[ super dealloc ] ;
}
#pragma mark - Events
- ( void ) setSelected : ( NSInteger ) index
{
// Prev
if( selectedIndex != index )
{
switch( selectedIndex )
{
case 0 :
[ btnForChat setAdjustsImageWhenHighlighted : YES ] ;
[ btnForChat setImage : [ UIImage imageNamed : @"tabbar_chat.png" ] forState : UIControlStateNormal ] ;
break ;
case 3 :
[ btnForMore setAdjustsImageWhenHighlighted : YES ] ;
[ btnForMore setImage : [ UIImage imageNamed : @"tabbar_more.png" ] forState : UIControlStateNormal ] ;
break ;
default :
break ;
}
}
// Current ;
if( selectedIndex != index )
{
selectedIndex = index ;
switch( selectedIndex )
{
case 0 :
[ btnForChat setAdjustsImageWhenHighlighted : NO ] ;
[ btnForChat setImage : [ UIImage imageNamed : @"tabbar_chat_highlighted.png" ] forState : UIControlStateNormal ] ;
break ;
case 3 :
[ btnForMore setAdjustsImageWhenHighlighted : NO ] ;
[ btnForMore setImage : [ UIImage imageNamed : @"tabbar_more_highlighted.png" ] forState : UIControlStateNormal ] ;
break ;
default :
break ;
}
}
// Select ;
if( selectedIndex != [ self selectedIndex ] )
{
[ self setSelectedIndex : selectedIndex ] ;
return ;
}
if( [ self.selectedViewController isKindOfClass : [ UINavigationController class ] ] )
{
[ ( UINavigationController* )self.selectedViewController popToRootViewControllerAnimated : YES ] ;
return ;
}
}
- ( IBAction ) onBtnChat : ( id ) sender
{
[ self setSelected : 0 ] ;
}
- ( IBAction ) onBtnNote : ( id ) sender
{
[ self setSelected : 1 ] ;
}
- ( IBAction ) onBtnProject : ( id ) sender
{
[ self setSelected : 2 ] ;
}
- ( IBAction ) onBtnMore : ( id ) sender
{
[ self setSelected : 3 ] ;
}
@end