Skip to content

Commit

Permalink
update readme and demo
Browse files Browse the repository at this point in the history
  • Loading branch information
yulingtianxia committed May 12, 2018
1 parent f2ed33f commit 3316e60
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 14 deletions.
Binary file added Assets/demo.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
37 changes: 25 additions & 12 deletions MTDemo/MTDemo/Base.lproj/Main.storyboard
Original file line number Diff line number Diff line change
Expand Up @@ -18,31 +18,44 @@
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<button opaque="NO" contentMode="scaleToFill" fixedFrame="YES" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="2ia-SP-fXG">
<rect key="frame" x="172" y="318" width="30" height="30"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<state key="normal" title="Fire!"/>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="2ia-SP-fXG">
<rect key="frame" x="161" y="315" width="53" height="46"/>
<color key="backgroundColor" red="1" green="0.0" blue="0.0" alpha="1" colorSpace="calibratedRGB"/>
<fontDescription key="fontDescription" type="system" pointSize="28"/>
<state key="normal" title="Fire!">
<color key="titleColor" name="controlBackgroundColor" catalog="System" colorSpace="catalog"/>
</state>
<connections>
<action selector="tapFoo:" destination="BYZ-38-t0r" eventType="touchUpInside" id="xal-N4-gAU"/>
</connections>
</button>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" fixedFrame="YES" text="Please Tap Fire:" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="pwc-Ao-gsU">
<rect key="frame" x="0.0" y="487" width="375" height="21"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Please Tap Fire:" textAlignment="center" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="pwc-Ao-gsU">
<rect key="frame" x="94.5" y="474.5" width="187" height="33.5"/>
<fontDescription key="fontDescription" type="system" pointSize="28"/>
<nil key="textColor"/>
<nil key="highlightedColor"/>
</label>
<button opaque="NO" contentMode="scaleToFill" fixedFrame="YES" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="4Jy-zc-NeT">
<rect key="frame" x="128" y="166" width="119" height="30"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<state key="normal" title="Always Fire 1970!"/>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="4Jy-zc-NeT">
<rect key="frame" x="81" y="154" width="213" height="46"/>
<color key="backgroundColor" red="1" green="0.0" blue="0.0" alpha="1" colorSpace="calibratedRGB"/>
<fontDescription key="fontDescription" type="system" pointSize="28"/>
<state key="normal" title="Always Fire 1970!">
<color key="titleColor" name="controlBackgroundColor" catalog="System" colorSpace="catalog"/>
</state>
<connections>
<action selector="tapBar:" destination="BYZ-38-t0r" eventType="touchUpInside" id="akY-py-aWm"/>
</connections>
</button>
</subviews>
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<constraints>
<constraint firstItem="2ia-SP-fXG" firstAttribute="top" secondItem="8bC-Xf-vdC" secondAttribute="top" constant="315" id="0TE-3h-ov8"/>
<constraint firstItem="pwc-Ao-gsU" firstAttribute="centerX" secondItem="8bC-Xf-vdC" secondAttribute="centerX" id="KdC-KD-2KI"/>
<constraint firstItem="6Tk-OE-BBY" firstAttribute="bottom" secondItem="pwc-Ao-gsU" secondAttribute="bottom" constant="159" id="MVt-7Y-bNJ"/>
<constraint firstItem="4Jy-zc-NeT" firstAttribute="centerX" secondItem="8bC-Xf-vdC" secondAttribute="centerX" id="OpW-6S-sgS"/>
<constraint firstItem="2ia-SP-fXG" firstAttribute="centerX" secondItem="8bC-Xf-vdC" secondAttribute="centerX" id="bgo-iN-h5t"/>
<constraint firstItem="4Jy-zc-NeT" firstAttribute="top" secondItem="6Tk-OE-BBY" secondAttribute="top" constant="134" id="hbe-7i-WjC"/>
</constraints>
<viewLayoutGuide key="safeArea" id="6Tk-OE-BBY"/>
</view>
<connections>
Expand Down
4 changes: 2 additions & 2 deletions MTDemo/MTDemo/ViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -78,12 +78,12 @@ - (void)handleFooNotification:(NSNotification *)notification
{
NSDate *date = notification.userInfo[@"arg"];
NSDateFormatter *df = [NSDateFormatter new];
[df setDateFormat:@"dd/MM/yyyy HH:mm:ss"];
[df setDateFormat:@"dd/MM/yyyy\nHH:mm:ss"];

df.timeZone = [NSTimeZone timeZoneForSecondsFromGMT:[NSTimeZone localTimeZone].secondsFromGMT];
NSString *localDateString = [df stringFromDate:date];
dispatch_async(dispatch_get_main_queue(), ^{
self.label.text = [NSString stringWithFormat:@"Last Fire Date: %@", localDateString];
self.label.text = [NSString stringWithFormat:@"Last Fire Date:\n%@", localDateString];
});
}

Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ MessageThrottle is a lightweight, simple library for controlling frequency of fo

To run the example project, clone the repo and run MTDemo target.

![](Assets/demo.gif)

## 🐒 How to use

The following example shows how to restrict the frequency of forwarding `- [ViewController foo:]` message to 100 times per second.
Expand Down

0 comments on commit 3316e60

Please sign in to comment.