Skip to content

Commit

Permalink
UI Kit Playground
Browse files Browse the repository at this point in the history
  • Loading branch information
myselfHimanshu committed Jun 26, 2018
1 parent beee796 commit 53bb8e6
Show file tree
Hide file tree
Showing 7 changed files with 130 additions and 36 deletions.
4 changes: 4 additions & 0 deletions Meme-Me/Meme-Me.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
257E937E20DFCC4800492ED9 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 257E937C20DFCC4800492ED9 /* Main.storyboard */; };
257E938020DFCC4900492ED9 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 257E937F20DFCC4900492ED9 /* Assets.xcassets */; };
257E938320DFCC4900492ED9 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 257E938120DFCC4900492ED9 /* LaunchScreen.storyboard */; };
25CC24CE20E2387C007F0807 /* random_code.txt in Resources */ = {isa = PBXBuildFile; fileRef = 25CC24CD20E2387C007F0807 /* random_code.txt */; };
/* End PBXBuildFile section */

/* Begin PBXFileReference section */
Expand All @@ -22,6 +23,7 @@
257E937F20DFCC4900492ED9 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
257E938220DFCC4900492ED9 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = "<group>"; };
257E938420DFCC4900492ED9 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
25CC24CD20E2387C007F0807 /* random_code.txt */ = {isa = PBXFileReference; lastKnownFileType = text; path = random_code.txt; sourceTree = "<group>"; };
/* End PBXFileReference section */

/* Begin PBXFrameworksBuildPhase section */
Expand All @@ -38,6 +40,7 @@
257E936C20DFCC4800492ED9 = {
isa = PBXGroup;
children = (
25CC24CD20E2387C007F0807 /* random_code.txt */,
257E937720DFCC4800492ED9 /* Meme-Me */,
257E937620DFCC4800492ED9 /* Products */,
);
Expand Down Expand Up @@ -122,6 +125,7 @@
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
25CC24CE20E2387C007F0807 /* random_code.txt in Resources */,
257E938320DFCC4900492ED9 /* LaunchScreen.storyboard in Resources */,
257E938020DFCC4900492ED9 /* Assets.xcassets in Resources */,
257E937E20DFCC4800492ED9 /* Main.storyboard in Resources */,
Expand Down
Binary file not shown.
84 changes: 79 additions & 5 deletions Meme-Me/Meme-Me/Base.lproj/Main.storyboard
Original file line number Diff line number Diff line change
Expand Up @@ -18,23 +18,97 @@
<rect key="frame" x="0.0" y="0.0" width="414" height="736"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" fixedFrame="YES" text="Label" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="sT3-r2-wQ6">
<rect key="frame" x="186" y="130" width="42" height="21"/>
<button opaque="NO" contentMode="scaleToFill" fixedFrame="YES" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="Wvy-1A-zkl">
<rect key="frame" x="70" y="39" width="118" height="47"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<fontDescription key="fontDescription" type="system" weight="thin" pointSize="29"/>
<state key="normal" title="Increment">
<color key="titleColor" red="0.90940743684768677" green="0.41916555166244507" blue="0.43401077389717102" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</state>
<connections>
<action selector="incrementCount" destination="BYZ-38-t0r" eventType="touchUpInside" id="Rat-HP-5FD"/>
</connections>
</button>
<button opaque="NO" contentMode="scaleToFill" fixedFrame="YES" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="Jqa-pW-eeY">
<rect key="frame" x="70" y="94" width="132" height="47"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<fontDescription key="fontDescription" type="system" weight="thin" pointSize="29"/>
<state key="normal" title="Decrement">
<color key="titleColor" red="0.90940743684768677" green="0.41916555166244507" blue="0.43401077389717102" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</state>
<connections>
<action selector="decrementCount" destination="BYZ-38-t0r" eventType="touchUpInside" id="Kun-3B-SVi"/>
</connections>
</button>
<switch opaque="NO" contentMode="scaleToFill" horizontalHuggingPriority="750" verticalHuggingPriority="750" fixedFrame="YES" contentHorizontalAlignment="center" contentVerticalAlignment="center" on="YES" translatesAutoresizingMaskIntoConstraints="NO" id="Nyh-YP-I4T">
<rect key="frame" x="251" y="225" width="49" height="31"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<connections>
<action selector="changeColor" destination="BYZ-38-t0r" eventType="valueChanged" id="IIq-gL-Nz9"/>
</connections>
</switch>
<switch opaque="NO" contentMode="scaleToFill" horizontalHuggingPriority="750" verticalHuggingPriority="750" fixedFrame="YES" contentHorizontalAlignment="center" contentVerticalAlignment="center" on="YES" translatesAutoresizingMaskIntoConstraints="NO" id="TtI-Fa-P9v">
<rect key="frame" x="251" y="283" width="49" height="31"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<connections>
<action selector="changeColor" destination="BYZ-38-t0r" eventType="valueChanged" id="Rzn-qs-Nlo"/>
</connections>
</switch>
<switch opaque="NO" contentMode="scaleToFill" horizontalHuggingPriority="750" verticalHuggingPriority="750" fixedFrame="YES" contentHorizontalAlignment="center" contentVerticalAlignment="center" on="YES" translatesAutoresizingMaskIntoConstraints="NO" id="3dL-lM-Atg">
<rect key="frame" x="251" y="353" width="49" height="31"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<connections>
<action selector="changeColor" destination="BYZ-38-t0r" eventType="valueChanged" id="W9R-Hd-cCL"/>
</connections>
</switch>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" fixedFrame="YES" text="Red Control" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="cmK-Uw-xV5">
<rect key="frame" x="108" y="230" width="91" height="21"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<color key="textColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" fixedFrame="YES" text="Green Control" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="29N-MA-Vfg">
<rect key="frame" x="108" y="288" width="107" height="21"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<nil key="textColor"/>
<color key="textColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" fixedFrame="YES" text="Blue Control" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="IIi-VE-wMZ">
<rect key="frame" x="108" y="358" width="95" height="21"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<color key="textColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<nil key="highlightedColor"/>
</label>
<view alpha="0.94999999999999996" contentMode="scaleToFill" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="Xj9-0S-Zx5">
<rect key="frame" x="87" y="482" width="240" height="128"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
</view>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" fixedFrame="YES" text="0" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="08h-uS-H46">
<rect key="frame" x="336" y="55" width="58" height="58"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<fontDescription key="fontDescription" type="boldSystem" pointSize="31"/>
<color key="textColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<nil key="highlightedColor"/>
</label>
</subviews>
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<color key="backgroundColor" cocoaTouchSystemColor="darkTextColor"/>
<viewLayoutGuide key="safeArea" id="6Tk-OE-BBY"/>
</view>
<connections>
<outlet property="label" destination="sT3-r2-wQ6" id="Fb1-X5-Jn3"/>
<outlet property="blueControl" destination="3dL-lM-Atg" id="SFN-kP-8K8"/>
<outlet property="colorView" destination="Xj9-0S-Zx5" id="6nM-V6-0e6"/>
<outlet property="greenControl" destination="TtI-Fa-P9v" id="uIK-zZ-Qn9"/>
<outlet property="label" destination="08h-uS-H46" id="6Ue-nU-A3v"/>
<outlet property="redControl" destination="Nyh-YP-I4T" id="GfT-f0-7Vh"/>
</connections>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="dkx-z0-nzr" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="86.956521739130437" y="34.239130434782609"/>
</scene>
</scenes>
</document>
48 changes: 18 additions & 30 deletions Meme-Me/Meme-Me/ViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,50 +11,38 @@ import UIKit
class ViewController: UIViewController {

var count = 0
@IBOutlet var label : UILabel!
@IBOutlet weak var label : UILabel!
@IBOutlet weak var colorView : UIView!
@IBOutlet weak var redControl : UISwitch!
@IBOutlet weak var greenControl : UISwitch!
@IBOutlet weak var blueControl : UISwitch!

override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view, typically from a nib.
/*
// label
let label = UILabel()
label.frame = CGRect(x: 200, y: 150, width: 60, height: 60)
label.text = "0"
view.addSubview(label)
self.label = label

// button1
let button1 = UIButton()
button1.frame = CGRect(x: 10, y: 500, width: 180, height: 60)
button1.setTitle("Click to increment..", for: .normal)
button1.setTitleColor(UIColor.black, for: .normal)
button1.backgroundColor = UIColor.green
view.addSubview(button1)

// button2
let button2 = UIButton()
button2.frame = CGRect(x: 215, y: 500, width: 180, height: 60)
button2.setTitle("Click to decrement..", for: .normal)
button2.setTitleColor(UIColor.black, for: .normal)
button2.backgroundColor = UIColor.yellow
view.addSubview(button2)

button1.addTarget(self, action: #selector(ViewController.incrementCount), for: UIControlEvents.touchUpInside)
button2.addTarget(self, action: #selector(ViewController.decrementCount), for: UIControlEvents.touchUpInside)
*/
}

@objc func incrementCount(){
@IBAction func incrementCount(){
self.count += 1
self.label.text = "\(self.count)"
}

@objc func decrementCount(){
@IBAction func decrementCount(){
self.count -= 1
self.label.text = "\(self.count)"
}

@IBAction func changeColor(){
if self.redControl==nil{
return
}

let r : CGFloat = self.redControl.isOn ? 1 : 0
let g : CGFloat = self.greenControl.isOn ? 1 : 0
let b : CGFloat = self.blueControl.isOn ? 1 : 0

colorView.backgroundColor = UIColor(red: r, green: g, blue: b, alpha: 1)
}



Expand Down
28 changes: 28 additions & 0 deletions Meme-Me/random_code.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
// Do any additional setup after loading the view, typically from a nib.
/*
// label
let label = UILabel()
label.frame = CGRect(x: 200, y: 150, width: 60, height: 60)
label.text = "0"
view.addSubview(label)
self.label = label

// button1
let button1 = UIButton()
button1.frame = CGRect(x: 10, y: 500, width: 180, height: 60)
button1.setTitle("Click to increment..", for: .normal)
button1.setTitleColor(UIColor.black, for: .normal)
button1.backgroundColor = UIColor.green
view.addSubview(button1)

// button2
let button2 = UIButton()
button2.frame = CGRect(x: 215, y: 500, width: 180, height: 60)
button2.setTitle("Click to decrement..", for: .normal)
button2.setTitleColor(UIColor.black, for: .normal)
button2.backgroundColor = UIColor.yellow
view.addSubview(button2)

button1.addTarget(self, action: #selector(ViewController.incrementCount), for: UIControlEvents.touchUpInside)
button2.addTarget(self, action: #selector(ViewController.decrementCount), for: UIControlEvents.touchUpInside)
*/
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "PitchPerfect/PlaySoundsViewController+Audio.swift"
timestampString = "551477487.725075"
timestampString = "551610372.960169"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "33"
Expand Down

0 comments on commit 53bb8e6

Please sign in to comment.