minor modifications

This commit is contained in:
A. Vatsaev 2016-11-06 00:18:07 +01:00
parent 4bed0ad132
commit df51d7f3fb
5 changed files with 53 additions and 8 deletions

View file

@ -13,8 +13,9 @@
A362A10D1DCE6D6B00737197 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = A362A10B1DCE6D6B00737197 /* Main.storyboard */; };
A3826CDA1DCE79B900B7C41E /* NyanCatCanvas.swift in Sources */ = {isa = PBXBuildFile; fileRef = A3826CD91DCE79B900B7C41E /* NyanCatCanvas.swift */; };
A3826CDC1DCE7B5000B7C41E /* NyanCatCanvas.xib in Resources */ = {isa = PBXBuildFile; fileRef = A3826CDB1DCE7B5000B7C41E /* NyanCatCanvas.xib */; };
A3A050D91DCE8F3E009D9775 /* nyan_long@2x.gif in Resources */ = {isa = PBXBuildFile; fileRef = A3A050D81DCE8F3E009D9775 /* nyan_long@2x.gif */; };
A3A050DC1DCE96BD009D9775 /* nyan_music.mp3 in Resources */ = {isa = PBXBuildFile; fileRef = A3A050DB1DCE96BD009D9775 /* nyan_music.mp3 */; };
A3A050DE1DCE9DB9009D9775 /* nyan_long@2x.gif in Resources */ = {isa = PBXBuildFile; fileRef = A3A050DD1DCE9DB9009D9775 /* nyan_long@2x.gif */; };
A3A050E01DCE9E03009D9775 /* icon.png in Resources */ = {isa = PBXBuildFile; fileRef = A3A050DF1DCE9E03009D9775 /* icon.png */; };
/* End PBXBuildFile section */
/* Begin PBXFileReference section */
@ -26,8 +27,9 @@
A362A10E1DCE6D6B00737197 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
A3826CD91DCE79B900B7C41E /* NyanCatCanvas.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = NyanCatCanvas.swift; sourceTree = "<group>"; };
A3826CDB1DCE7B5000B7C41E /* NyanCatCanvas.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = NyanCatCanvas.xib; sourceTree = "<group>"; };
A3A050D81DCE8F3E009D9775 /* nyan_long@2x.gif */ = {isa = PBXFileReference; lastKnownFileType = image.gif; path = "nyan_long@2x.gif"; sourceTree = "<group>"; };
A3A050DB1DCE96BD009D9775 /* nyan_music.mp3 */ = {isa = PBXFileReference; lastKnownFileType = audio.mp3; path = nyan_music.mp3; sourceTree = "<group>"; };
A3A050DD1DCE9DB9009D9775 /* nyan_long@2x.gif */ = {isa = PBXFileReference; lastKnownFileType = image.gif; path = "nyan_long@2x.gif"; sourceTree = "<group>"; };
A3A050DF1DCE9E03009D9775 /* icon.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = icon.png; sourceTree = "<group>"; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
@ -76,7 +78,8 @@
A3826CD61DCE73EA00B7C41E /* img */ = {
isa = PBXGroup;
children = (
A3A050D81DCE8F3E009D9775 /* nyan_long@2x.gif */,
A3A050DF1DCE9E03009D9775 /* icon.png */,
A3A050DD1DCE9DB9009D9775 /* nyan_long@2x.gif */,
);
name = img;
sourceTree = "<group>";
@ -150,7 +153,8 @@
buildActionMask = 2147483647;
files = (
A3826CDC1DCE7B5000B7C41E /* NyanCatCanvas.xib in Resources */,
A3A050D91DCE8F3E009D9775 /* nyan_long@2x.gif in Resources */,
A3A050DE1DCE9DB9009D9775 /* nyan_long@2x.gif in Resources */,
A3A050E01DCE9E03009D9775 /* icon.png in Resources */,
A3A050DC1DCE96BD009D9775 /* nyan_music.mp3 in Resources */,
A362A10A1DCE6D6B00737197 /* Assets.xcassets in Resources */,
A362A10D1DCE6D6B00737197 /* Main.storyboard in Resources */,

View file

@ -12,7 +12,7 @@
<scene sceneID="R2V-B0-nI4">
<objects>
<windowController id="B8D-0N-5wS" sceneMemberID="viewController">
<window key="window" title="Window" allowsToolTipsWhenApplicationIsInactive="NO" autorecalculatesKeyViewLoop="NO" oneShot="NO" releasedWhenClosed="NO" showsToolbarButton="NO" visibleAtLaunch="NO" animationBehavior="default" id="IQv-IB-iLA">
<window key="window" title="TouchBar NyanCat" allowsToolTipsWhenApplicationIsInactive="NO" autorecalculatesKeyViewLoop="NO" oneShot="NO" releasedWhenClosed="NO" showsToolbarButton="NO" visibleAtLaunch="NO" animationBehavior="default" id="IQv-IB-iLA">
<windowStyleMask key="styleMask" titled="YES" closable="YES" miniaturizable="YES" resizable="YES"/>
<windowPositionMask key="initialPositionMask" leftStrut="YES" rightStrut="YES" topStrut="YES" bottomStrut="YES"/>
<rect key="contentRect" x="196" y="240" width="480" height="270"/>
@ -61,12 +61,43 @@
<customObject id="rPt-NT-nkU" userLabel="First Responder" customClass="NSResponder" sceneMemberID="firstResponder"/>
<viewController id="XfG-lQ-9wD" customClass="NyanCatViewController" customModule="touchbar_nyancat" customModuleProvider="target" sceneMemberID="viewController">
<view key="view" wantsLayer="YES" id="m2S-Jp-Qdl">
<rect key="frame" x="0.0" y="0.0" width="480" height="149"/>
<rect key="frame" x="0.0" y="0.0" width="480" height="250"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<customView translatesAutoresizingMaskIntoConstraints="NO" id="iUM-SV-UtP">
<rect key="frame" x="0.0" y="0.0" width="480" height="250"/>
</customView>
<imageView horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="gMT-xv-P4n">
<rect key="frame" x="180" y="63" width="121" height="124"/>
<constraints>
<constraint firstAttribute="height" constant="124" id="RoQ-MZ-NU4"/>
<constraint firstAttribute="width" constant="121" id="mTk-cp-YzJ"/>
</constraints>
<imageCell key="cell" refusesFirstResponder="YES" alignment="left" imageScaling="proportionallyDown" image="icon" id="8Gj-P1-q8c"/>
</imageView>
</subviews>
<constraints>
<constraint firstAttribute="trailing" secondItem="gMT-xv-P4n" secondAttribute="trailing" constant="179" id="3lu-FZ-ahL"/>
<constraint firstAttribute="bottom" secondItem="iUM-SV-UtP" secondAttribute="bottom" id="58N-Hr-GF1"/>
<constraint firstItem="iUM-SV-UtP" firstAttribute="centerY" secondItem="m2S-Jp-Qdl" secondAttribute="centerY" id="97e-n6-v5E"/>
<constraint firstItem="iUM-SV-UtP" firstAttribute="centerX" secondItem="m2S-Jp-Qdl" secondAttribute="centerX" id="GFI-Ne-BiR"/>
<constraint firstItem="iUM-SV-UtP" firstAttribute="leading" secondItem="m2S-Jp-Qdl" secondAttribute="leading" id="JVR-aH-hpw"/>
<constraint firstAttribute="trailing" secondItem="iUM-SV-UtP" secondAttribute="trailing" id="QVv-rY-vfo"/>
<constraint firstAttribute="bottom" secondItem="gMT-xv-P4n" secondAttribute="bottom" constant="63" id="UK3-mL-juy"/>
<constraint firstItem="gMT-xv-P4n" firstAttribute="leading" secondItem="m2S-Jp-Qdl" secondAttribute="leading" constant="180" id="XcW-pT-FNZ"/>
<constraint firstItem="gMT-xv-P4n" firstAttribute="top" secondItem="m2S-Jp-Qdl" secondAttribute="top" constant="63" id="ZhM-b6-ufp"/>
<constraint firstItem="iUM-SV-UtP" firstAttribute="top" secondItem="m2S-Jp-Qdl" secondAttribute="top" id="cgm-iG-ydv"/>
</constraints>
</view>
<connections>
<outlet property="bkg" destination="iUM-SV-UtP" id="Y8L-Wa-nPi"/>
</connections>
</viewController>
</objects>
<point key="canvasLocation" x="75" y="715.5"/>
<point key="canvasLocation" x="75" y="766"/>
</scene>
</scenes>
<resources>
<image name="icon" width="192" height="189.75"/>
</resources>
</document>

View file

@ -15,13 +15,19 @@ class NyanCatViewController: NSViewController , NSTouchBarDelegate{
var audio_player: AVAudioPlayer?
@IBOutlet weak var bkg: NSView!
override func viewDidLoad() {
super.viewDidLoad()
self.view.wantsLayer = true
let nyan_music = URL(fileURLWithPath: Bundle.main.path(forResource: "nyan_music", ofType: "mp3")!)
do {
try audio_player = AVAudioPlayer(contentsOf: nyan_music)
audio_player?.numberOfLoops = -1
audio_player?.prepareToPlay()
@ -32,6 +38,10 @@ class NyanCatViewController: NSViewController , NSTouchBarDelegate{
}
override func viewWillAppear() {
bkg.layer?.backgroundColor = NSColor(red:0.08, green:0.31, blue:0.55, alpha:1.00).cgColor
}
override var representedObject: Any? {
didSet {

BIN
touchbar_nyancat/icon.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 48 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 60 KiB

After

Width:  |  Height:  |  Size: 60 KiB