Skip to content

Commit

Permalink
Add button action.
Browse files Browse the repository at this point in the history
  • Loading branch information
AkkeyLab committed Nov 6, 2016
1 parent d52de71 commit a233ff1
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 0 deletions.
20 changes: 20 additions & 0 deletions mezamaShare/Classes/View/StampButtonView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
// bkImage1.image = UIImage(named: "buttonImage1")

import UIKit
import SimpleAnimation

class StampButtonView: UIView {

Expand Down Expand Up @@ -51,4 +52,23 @@ class StampButtonView: UIView {
button5.addTarget(MainViewController(), action: #selector(MainViewController.onTapButton5(sender:)), for: .touchUpInside)
button6.addTarget(MainViewController(), action: #selector(MainViewController.onTapButton6(sender:)), for: .touchUpInside)
}

@IBAction func onButton1(_ sender: UIButton) {
bkImage1.shake(toward: .top, amount: 0.5, duration: 0.5, delay: 0.0)
}
@IBAction func onButton2(_ sender: UIButton) {
bkImage2.shake(toward: .top, amount: 0.5, duration: 0.5, delay: 0.0)
}
@IBAction func onButton3(_ sender: UIButton) {
bkImage3.shake(toward: .top, amount: 0.5, duration: 0.5, delay: 0.0)
}
@IBAction func onButton4(_ sender: UIButton) {
bkImage4.shake(toward: .top, amount: 0.5, duration: 0.5, delay: 0.0)
}
@IBAction func onButton5(_ sender: UIButton) {
bkImage5.shake(toward: .top, amount: 0.5, duration: 0.5, delay: 0.0)
}
@IBAction func onButton6(_ sender: UIButton) {
bkImage6.shake(toward: .top, amount: 0.5, duration: 0.5, delay: 0.0)
}
}
18 changes: 18 additions & 0 deletions mezamaShare/Classes/View/StampButtonView.xib
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@
</imageView>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="8GO-Qk-XZ9">
<rect key="frame" x="176" y="0.0" width="155" height="155"/>
<connections>
<action selector="onButton2:" destination="i5M-Pr-FkT" eventType="touchUpInside" id="kkb-py-DKb"/>
</connections>
</button>
<imageView userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="buttonImage1" translatesAutoresizingMaskIntoConstraints="NO" id="L8s-sY-43J">
<rect key="frame" x="0.0" y="0.0" width="155" height="155"/>
Expand All @@ -38,6 +41,9 @@
<constraints>
<constraint firstAttribute="width" secondItem="mjS-Pm-tXq" secondAttribute="height" multiplier="1:1" id="U2m-cb-K8k"/>
</constraints>
<connections>
<action selector="onButton1:" destination="i5M-Pr-FkT" eventType="touchUpInside" id="Jkt-uY-CSs"/>
</connections>
</button>
</subviews>
<color key="backgroundColor" cocoaTouchSystemColor="darkTextColor"/>
Expand Down Expand Up @@ -70,6 +76,9 @@
</imageView>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="xWU-bi-oVG">
<rect key="frame" x="176" y="0.0" width="155" height="155"/>
<connections>
<action selector="onButton4:" destination="i5M-Pr-FkT" eventType="touchUpInside" id="IBo-8G-T5X"/>
</connections>
</button>
<imageView userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="okiroImage" translatesAutoresizingMaskIntoConstraints="NO" id="ALc-96-0OP">
<rect key="frame" x="0.0" y="0.0" width="155" height="155"/>
Expand All @@ -83,6 +92,9 @@
<constraints>
<constraint firstAttribute="width" secondItem="JI2-aq-tzD" secondAttribute="height" multiplier="1:1" id="0oP-23-AyC"/>
</constraints>
<connections>
<action selector="onButton3:" destination="i5M-Pr-FkT" eventType="touchUpInside" id="ech-tU-ETN"/>
</connections>
</button>
</subviews>
<color key="backgroundColor" cocoaTouchSystemColor="darkTextColor"/>
Expand Down Expand Up @@ -148,6 +160,9 @@
</imageView>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="FGr-fd-Le4">
<rect key="frame" x="176" y="0.0" width="155" height="155"/>
<connections>
<action selector="onButton6:" destination="i5M-Pr-FkT" eventType="touchUpInside" id="UJu-IQ-kU2"/>
</connections>
</button>
<imageView userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="buttonImage5" translatesAutoresizingMaskIntoConstraints="NO" id="KSl-Ov-hUY">
<rect key="frame" x="0.0" y="0.0" width="155" height="155"/>
Expand All @@ -160,6 +175,9 @@
<constraints>
<constraint firstAttribute="width" secondItem="i1J-rQ-uZz" secondAttribute="height" multiplier="1:1" id="v39-v9-vj0"/>
</constraints>
<connections>
<action selector="onButton5:" destination="i5M-Pr-FkT" eventType="touchUpInside" id="rog-SJ-gf8"/>
</connections>
</button>
</subviews>
<color key="backgroundColor" cocoaTouchSystemColor="darkTextColor"/>
Expand Down

0 comments on commit a233ff1

Please sign in to comment.