Apps are a sports fan’s best friend. Ask any die-hard sports fan their favourite app and it’s going to be a sports app, maybe a Baseball app, maybe Basketball, maybe Football. A well designed sports app gets so much engagement and love from fans. So we’ve designed the best live sports app template, Football Live. Give your sports fans’ live score updates, player stats, stadium info, ladder/table and sport news.
We’ve combined a modern, clean UI with a Android style tab layout and top notch modern, native Objective-C code. It’s ready and waiting to add in your sport data feeds and to be turned into a killer live sports app!
//
// LiveViewController.m
// SoccerApp
//
// Copyright (c) 2014 MyAppTemplates. All rights reserved.
//
#import "LiveViewController.h"
#import "iCarousel.h"
@interface LiveViewController ()
@property (nonatomic, weak) IBOutlet UIButton *btnSeriesA;
@property (nonatomic, weak) IBOutlet UIButton *btnWorldCup;
@property (nonatomic, weak) IBOutlet UIButton *btnPremierLeague;
@property (nonatomic, weak) IBOutlet UIScrollView *scrollContent;
@end
@implementation LiveViewController
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
if (self) {
// Custom initialization
}
return self;
}
- (IBAction)reloadAndScroll;
{
[self.carousel reloadData];
self.carousel.scrollToItemBoundary = NO;
[self.carousel scrollByOffset:4.5 duration:0.0];
}
- (IBAction)stop
{
self.carousel.scrollOffset = self.carousel.scrollOffset;
}
- (void)dealloc
{
self.carousel.delegate = nil;
self.carousel.dataSource = nil;
}
#pragma mark -
#pragma mark View lifecycle
- (void)viewDidLoad
{
self.title = @"Stadium";
[super viewDidLoad];
_scrollContent.contentSize = CGSizeMake(320, 250);
[self resetButtons:_btnSeriesA];
[self btnTapped:_btnWorldCup];
//configure carousel
self.carousel.type = iCarouselTypeRotary;
//scroll to fixed offset
[self.carousel scrollToItemAtIndex:5 animated:NO];
}
-(IBAction)btnTapped:(UIButton *)sender
{
[self resetButtons:sender];
sender.selected = !sender.selected;
[self selectButton:sender];
}
-(void)resetButtons:(UIButton *)btn
{
if (_btnSeriesA != btn)
{
[_btnSeriesA setSelected:NO];
[self selectButton:_btnSeriesA];
}
if (_btnWorldCup != btn)
{
[_btnWorldCup setSelected:NO];
[self selectButton:_btnWorldCup];
}
if (_btnPremierLeague != btn)
{
[_btnPremierLeague setSelected:NO];
[self selectButton:_btnPremierLeague];
}
}
-(void)selectButton:(UIButton *)btn
{
if (btn.selected)
{
btn.transform = CGAffineTransformMakeScale(1.3, 1.3);
btn.alpha = 1;
}
else
{
btn.transform = CGAffineTransformIdentity;
btn.alpha = 0.5;
}
}
- (void)viewDidUnload
{
[super viewDidUnload];
self.carousel = nil;
}
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
return YES;
}
#pragma mark -
#pragma mark iCarousel methods
- (NSUInteger)numberOfItemsInCarousel:(iCarousel *)carousel
{
return 5;
}
- (UIView *)carousel:(iCarousel *)carousel viewForItemAtIndex:(NSUInteger)index reusingView:(UIView *)view
{
//create a numbered view
view = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 250, 219.0f)];
UIImageView *img = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 250, 219)];
img.image = [UIImage imageNamed:@"stadium-slider-bg.png"];
[view addSubview:img];
UIImageView *imgStadium = [[UIImageView alloc] initWithFrame:CGRectMake(4, 4, 242, 211)];
if (index%3==0)
imgStadium.image = [UIImage imageNamed:@"stadium-slider-left.png"];
if (index%3==1)
imgStadium.image = [UIImage imageNamed:@"stadium-slider-middle.png"];
if (index%3==2)
imgStadium.image = [UIImage imageNamed:@"stadium-slider-right.png"];
[view addSubview:imgStadium];
UIButton *btn = [[UIButton alloc]initWithFrame:CGRectMake(0, 0, 250, 219)];
[btn addTarget:self action:@selector(liveBtnTapped:) forControlEvents:UIControlEventTouchUpInside];
[view addSubview:btn];
return view;
}
-(IBAction)liveBtnTapped:(id)sender
{
[self performSegueWithIdentifier:@"PushToLive" sender:sender];
}
- (CGFloat)carousel:(iCarousel *)carousel valueForOption:(iCarouselOption)option withDefault:(CGFloat)value
{
switch (option)
{
case iCarouselOptionWrap:
{
return YES;
}
default:
{
return value;
}
}
}
-(void)carousel:(iCarousel *)carousel didSelectItemAtIndex:(NSInteger)index
{
[self performSegueWithIdentifier:@"PushToLive" sender:nil];
}
- (void)carouselWillBeginDragging:(iCarousel *)carousel
{
NSLog(@"Carousel will begin dragging");
}
- (void)carouselDidEndDragging:(iCarousel *)carousel willDecelerate:(BOOL)decelerate
{
NSLog(@"Carousel did end dragging and %@ decelerate", decelerate? @"will": @"won't");
}
- (void)carouselWillBeginDecelerating:(iCarousel *)carousel
{
NSLog(@"Carousel will begin decelerating");
}
- (void)carouselDidEndDecelerating:(iCarousel *)carousel
{
NSLog(@"Carousel did end decelerating");
}
- (void)carouselWillBeginScrollingAnimation:(iCarousel *)carousel
{
NSLog(@"Carousel will begin scrolling");
}
- (void)carouselDidEndScrollingAnimation:(iCarousel *)carousel
{
NSLog(@"Carousel did end scrolling");
}
/*
#pragma mark - Navigation
// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
{
// Get the new view controller using [segue destinationViewController].
// Pass the selected object to the new view controller.
}
*/
@end