Skip to content

Commit

Permalink
add demo project
Browse files Browse the repository at this point in the history
  • Loading branch information
hlung committed Mar 19, 2015
1 parent f864f1b commit de30fd6
Show file tree
Hide file tree
Showing 12 changed files with 888 additions and 0 deletions.

Large diffs are not rendered by default.

17 changes: 17 additions & 0 deletions MTStatusBarOverlayDemo/MTStatusBarOverlayDemo/AppDelegate.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
//
// AppDelegate.h
// MTStatusBarOverlayDemo
//
// Created by Hlung on 19/3/15.
// Copyright (c) 2015 Hlung. All rights reserved.
//

#import <UIKit/UIKit.h>

@interface AppDelegate : UIResponder <UIApplicationDelegate>

@property (strong, nonatomic) UIWindow *window;


@end

45 changes: 45 additions & 0 deletions MTStatusBarOverlayDemo/MTStatusBarOverlayDemo/AppDelegate.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
//
// AppDelegate.m
// MTStatusBarOverlayDemo
//
// Created by Hlung on 19/3/15.
// Copyright (c) 2015 Hlung. All rights reserved.
//

#import "AppDelegate.h"

@interface AppDelegate ()

@end

@implementation AppDelegate


- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
// Override point for customization after application launch.
return YES;
}

- (void)applicationWillResignActive:(UIApplication *)application {
// Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
// Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game.
}

- (void)applicationDidEnterBackground:(UIApplication *)application {
// Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
// If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
}

- (void)applicationWillEnterForeground:(UIApplication *)application {
// Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background.
}

- (void)applicationDidBecomeActive:(UIApplication *)application {
// Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
}

- (void)applicationWillTerminate:(UIApplication *)application {
// Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
}

@end
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="6214" systemVersion="14A314h" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" useTraitCollections="YES">
<dependencies>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="6207"/>
<capability name="Constraints with non-1.0 multipliers" minToolsVersion="5.1"/>
</dependencies>
<objects>
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner"/>
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
<view contentMode="scaleToFill" id="iN0-l3-epB">
<rect key="frame" x="0.0" y="0.0" width="480" height="480"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text=" Copyright (c) 2015 Hlung. All rights reserved." textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" minimumFontSize="9" translatesAutoresizingMaskIntoConstraints="NO" id="8ie-xW-0ye">
<rect key="frame" x="20" y="439" width="441" height="21"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<color key="textColor" cocoaTouchSystemColor="darkTextColor"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="MTStatusBarOverlayDemo" textAlignment="center" lineBreakMode="middleTruncation" baselineAdjustment="alignBaselines" minimumFontSize="18" translatesAutoresizingMaskIntoConstraints="NO" id="kId-c2-rCX">
<rect key="frame" x="20" y="140" width="441" height="43"/>
<fontDescription key="fontDescription" type="boldSystem" pointSize="36"/>
<color key="textColor" cocoaTouchSystemColor="darkTextColor"/>
<nil key="highlightedColor"/>
</label>
</subviews>
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/>
<constraints>
<constraint firstItem="kId-c2-rCX" firstAttribute="centerY" secondItem="iN0-l3-epB" secondAttribute="bottom" multiplier="1/3" constant="1" id="5cJ-9S-tgC"/>
<constraint firstAttribute="centerX" secondItem="kId-c2-rCX" secondAttribute="centerX" id="Koa-jz-hwk"/>
<constraint firstAttribute="bottom" secondItem="8ie-xW-0ye" secondAttribute="bottom" constant="20" id="Kzo-t9-V3l"/>
<constraint firstItem="8ie-xW-0ye" firstAttribute="leading" secondItem="iN0-l3-epB" secondAttribute="leading" constant="20" symbolic="YES" id="MfP-vx-nX0"/>
<constraint firstAttribute="centerX" secondItem="8ie-xW-0ye" secondAttribute="centerX" id="ZEH-qu-HZ9"/>
<constraint firstItem="kId-c2-rCX" firstAttribute="leading" secondItem="iN0-l3-epB" secondAttribute="leading" constant="20" symbolic="YES" id="fvb-Df-36g"/>
</constraints>
<nil key="simulatedStatusBarMetrics"/>
<freeformSimulatedSizeMetrics key="simulatedDestinationMetrics"/>
<point key="canvasLocation" x="548" y="455"/>
</view>
</objects>
</document>
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="6751" systemVersion="14C1510" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" initialViewController="aFQ-0U-rhW">
<dependencies>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="6736"/>
</dependencies>
<scenes>
<!--Navigation Controller-->
<scene sceneID="LWU-ZG-n0V">
<objects>
<navigationController id="aFQ-0U-rhW" sceneMemberID="viewController">
<simulatedScreenMetrics key="simulatedDestinationMetrics" type="retina4"/>
<navigationBar key="navigationBar" contentMode="scaleToFill" id="qhw-9a-U3A">
<rect key="frame" x="0.0" y="0.0" width="320" height="44"/>
<autoresizingMask key="autoresizingMask"/>
</navigationBar>
<connections>
<segue destination="BYZ-38-t0r" kind="relationship" relationship="rootViewController" id="JID-UO-sBU"/>
</connections>
</navigationController>
<placeholder placeholderIdentifier="IBFirstResponder" id="QxH-fk-TZB" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="18" y="333"/>
</scene>
<!--Test MTStatusBarOverlay-->
<scene sceneID="tne-QT-ifu">
<objects>
<viewController id="BYZ-38-t0r" customClass="ViewController" sceneMemberID="viewController">
<layoutGuides>
<viewControllerLayoutGuide type="top" id="y3c-jy-aDJ"/>
<viewControllerLayoutGuide type="bottom" id="wfy-db-euE"/>
</layoutGuides>
<view key="view" contentMode="scaleToFill" id="8bC-Xf-vdC">
<rect key="frame" x="0.0" y="0.0" width="320" height="568"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="W1J-T4-r3G">
<rect key="frame" x="106" y="215" width="108" height="30"/>
<state key="normal" title="Reconnecting...">
<color key="titleShadowColor" white="0.5" alpha="1" colorSpace="calibratedWhite"/>
</state>
<connections>
<action selector="reconnecting:" destination="BYZ-38-t0r" eventType="touchUpInside" id="V4e-7h-f3a"/>
</connections>
</button>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="AqE-D3-5bn">
<rect key="frame" x="124" y="270" width="73" height="30"/>
<state key="normal" title="Hide Toast">
<color key="titleShadowColor" white="0.5" alpha="1" colorSpace="calibratedWhite"/>
</state>
<connections>
<action selector="hideToast:" destination="BYZ-38-t0r" eventType="touchUpInside" id="c31-Jy-MnF"/>
</connections>
</button>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="9bo-vs-IgJ">
<rect key="frame" x="94" y="160" width="133" height="30"/>
<state key="normal" title="Internet Connected">
<color key="titleShadowColor" white="0.5" alpha="1" colorSpace="calibratedWhite"/>
</state>
<connections>
<action selector="internetConnected:" destination="BYZ-38-t0r" eventType="touchUpInside" id="9UB-n8-kHk"/>
</connections>
</button>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="12G-7Z-3X1">
<rect key="frame" x="122" y="105" width="77" height="30"/>
<state key="normal" title="No Internet">
<color key="titleShadowColor" white="0.5" alpha="1" colorSpace="calibratedWhite"/>
</state>
<connections>
<action selector="noInternet:" destination="BYZ-38-t0r" eventType="touchUpInside" id="cgk-fd-f6u"/>
</connections>
</button>
</subviews>
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/>
<constraints>
<constraint firstAttribute="centerX" secondItem="12G-7Z-3X1" secondAttribute="centerX" id="3it-wJ-9ry"/>
<constraint firstItem="W1J-T4-r3G" firstAttribute="top" secondItem="9bo-vs-IgJ" secondAttribute="bottom" constant="25" id="Dvc-18-MWY"/>
<constraint firstItem="9bo-vs-IgJ" firstAttribute="top" secondItem="12G-7Z-3X1" secondAttribute="bottom" constant="25" id="INa-X1-tNV"/>
<constraint firstAttribute="centerX" secondItem="W1J-T4-r3G" secondAttribute="centerX" id="PtW-qp-WqE"/>
<constraint firstItem="AqE-D3-5bn" firstAttribute="top" secondItem="W1J-T4-r3G" secondAttribute="bottom" constant="25" id="Qas-39-HHh"/>
<constraint firstItem="12G-7Z-3X1" firstAttribute="top" secondItem="y3c-jy-aDJ" secondAttribute="bottom" constant="41" id="Z7v-gC-80K"/>
<constraint firstAttribute="centerX" secondItem="AqE-D3-5bn" secondAttribute="centerX" id="aTj-70-7PU"/>
<constraint firstAttribute="centerX" secondItem="9bo-vs-IgJ" secondAttribute="centerX" id="xVB-Hx-Tb9"/>
</constraints>
</view>
<navigationItem key="navigationItem" title="Test MTStatusBarOverlay" id="bqd-be-YPH"/>
<simulatedScreenMetrics key="simulatedDestinationMetrics" type="retina4"/>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="dkx-z0-nzr" sceneMemberID="firstResponder"/>
</objects>
</scene>
</scenes>
</document>
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
{
"images" : [
{
"idiom" : "iphone",
"size" : "29x29",
"scale" : "2x"
},
{
"idiom" : "iphone",
"size" : "29x29",
"scale" : "3x"
},
{
"idiom" : "iphone",
"size" : "40x40",
"scale" : "2x"
},
{
"idiom" : "iphone",
"size" : "40x40",
"scale" : "3x"
},
{
"idiom" : "iphone",
"size" : "60x60",
"scale" : "2x"
},
{
"idiom" : "iphone",
"size" : "60x60",
"scale" : "3x"
},
{
"idiom" : "ipad",
"size" : "29x29",
"scale" : "1x"
},
{
"idiom" : "ipad",
"size" : "29x29",
"scale" : "2x"
},
{
"idiom" : "ipad",
"size" : "40x40",
"scale" : "1x"
},
{
"idiom" : "ipad",
"size" : "40x40",
"scale" : "2x"
},
{
"idiom" : "ipad",
"size" : "76x76",
"scale" : "1x"
},
{
"idiom" : "ipad",
"size" : "76x76",
"scale" : "2x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
47 changes: 47 additions & 0 deletions MTStatusBarOverlayDemo/MTStatusBarOverlayDemo/Info.plist
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key>
<string>th.in.hlung.$(PRODUCT_NAME:rfc1034identifier)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>$(PRODUCT_NAME)</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>1</string>
<key>LSRequiresIPhoneOS</key>
<true/>
<key>UILaunchStoryboardName</key>
<string>LaunchScreen</string>
<key>UIMainStoryboardFile</key>
<string>Main</string>
<key>UIRequiredDeviceCapabilities</key>
<array>
<string>armv7</string>
</array>
<key>UISupportedInterfaceOrientations</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
<key>UISupportedInterfaceOrientations~ipad</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationPortraitUpsideDown</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
</dict>
</plist>
15 changes: 15 additions & 0 deletions MTStatusBarOverlayDemo/MTStatusBarOverlayDemo/ViewController.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
//
// ViewController.h
// MTStatusBarOverlayDemo
//
// Created by Hlung on 19/3/15.
// Copyright (c) 2015 Hlung. All rights reserved.
//

#import <UIKit/UIKit.h>

@interface ViewController : UIViewController


@end

48 changes: 48 additions & 0 deletions MTStatusBarOverlayDemo/MTStatusBarOverlayDemo/ViewController.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
//
// ViewController.m
// MTStatusBarOverlayDemo
//
// Created by Hlung on 19/3/15.
// Copyright (c) 2015 Hlung. All rights reserved.
//

#import "ViewController.h"
#import "MTStatusBarOverlay.h"

@interface ViewController ()

@end

@implementation ViewController

- (void)viewDidLoad {
[super viewDidLoad];

MTStatusBarOverlay *overlay = [MTStatusBarOverlay sharedInstance];
overlay.animation = MTStatusBarOverlayAnimationFallDown; // MTStatusBarOverlayAnimationShrink
overlay.detailViewMode = MTDetailViewModeHistory; // enable automatic history-tracking and show in detail-view
overlay.customTextColor = [UIColor blackColor];
overlay.customBackgroundColor = [UIColor whiteColor];
}

- (IBAction)noInternet:(id)sender {
MTStatusBarOverlay *overlay = [MTStatusBarOverlay sharedInstance];
[overlay postImmediateErrorMessage:@"No Internet Connection" duration:2 animated:YES];
}

- (IBAction)internetConnected:(id)sender {
MTStatusBarOverlay *overlay = [MTStatusBarOverlay sharedInstance];
[overlay postFinishMessage:@"Internet Connected" duration:2 animated:YES];
}

- (IBAction)reconnecting:(id)sender {
MTStatusBarOverlay *overlay = [MTStatusBarOverlay sharedInstance];
[overlay postImmediateMessage:@"Reconnecting..." animated:YES];
}

- (IBAction)hideToast:(id)sender {
MTStatusBarOverlay *overlay = [MTStatusBarOverlay sharedInstance];
[overlay hide];
}

@end
16 changes: 16 additions & 0 deletions MTStatusBarOverlayDemo/MTStatusBarOverlayDemo/main.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
//
// main.m
// MTStatusBarOverlayDemo
//
// Created by Hlung on 19/3/15.
// Copyright (c) 2015 Hlung. All rights reserved.
//

#import <UIKit/UIKit.h>
#import "AppDelegate.h"

int main(int argc, char * argv[]) {
@autoreleasepool {
return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class]));
}
}
Loading

0 comments on commit de30fd6

Please sign in to comment.