Просмотр исходного кода

MovieViewController: use a backgroundimage for controls on iOS6

Carola Nitz 11 лет назад
Родитель
Сommit
4d300b74de

+ 7 - 16
Resources/VLCMovieViewController~iphone.xib

@@ -1,9 +1,9 @@
 <?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="5037" systemVersion="12F45" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none">
+<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="4514" systemVersion="13A603" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none">
     <dependencies>
         <deployment defaultVersion="1552" identifier="iOS"/>
         <development version="5000" identifier="xcode"/>
-        <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="3733"/>
+        <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="3747"/>
     </dependencies>
     <objects>
         <placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner" customClass="VLCMovieViewController">
@@ -57,7 +57,7 @@
             </connections>
         </placeholder>
         <placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
-        <view contentMode="scaleToFill" id="260" userLabel="Time view">
+        <view contentMode="scaleToFill" id="260" userLabel="Time view" customClass="VLCFrostedGlasView">
             <rect key="frame" x="0.0" y="0.0" width="300" height="40"/>
             <autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMaxY="YES"/>
             <subviews>
@@ -180,15 +180,10 @@
                         </label>
                     </subviews>
                 </view>
-                <view contentMode="scaleToFill" id="117" userLabel="Controls panel">
+                <view contentMode="scaleToFill" id="117" userLabel="Controls panel" customClass="VLCFrostedGlasView">
                     <rect key="frame" x="0.0" y="342" width="320" height="198"/>
                     <autoresizingMask key="autoresizingMask" flexibleMinX="YES" flexibleMaxX="YES" flexibleMinY="YES"/>
                     <subviews>
-                        <imageView userInteractionEnabled="NO" contentMode="scaleToFill" image="playbackControllerBg.png" id="274">
-                            <rect key="frame" x="0.0" y="0.0" width="320" height="198"/>
-                            <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
-                            <rect key="contentStretch" x="0.10000000000000001" y="0.10000000000000001" width="0.80000000000000004" height="0.80000000000000004"/>
-                        </imageView>
                         <slider opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" minValue="0.0" maxValue="2" id="128" customClass="VLCSlider">
                             <rect key="frame" x="18" y="19" width="284" height="29"/>
                             <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
@@ -276,14 +271,10 @@
                         </button>
                     </subviews>
                 </view>
-                <view contentMode="scaleToFill" id="92" userLabel="Controls panel">
+                <view contentMode="scaleToFill" id="92" userLabel="Controls panel" customClass="VLCFrostedGlasView">
                     <rect key="frame" x="0.0" y="478" width="320" height="90"/>
                     <autoresizingMask key="autoresizingMask" flexibleMinX="YES" widthSizable="YES" flexibleMaxX="YES" flexibleMinY="YES"/>
                     <subviews>
-                        <imageView userInteractionEnabled="NO" contentMode="scaleToFill" image="playbackControllerBg.png" id="231">
-                            <rect key="frame" x="0.0" y="0.0" width="320" height="90"/>
-                            <autoresizingMask key="autoresizingMask" flexibleMinX="YES" widthSizable="YES" flexibleMaxX="YES" flexibleMaxY="YES"/>
-                        </imageView>
                         <view contentMode="scaleToFill" id="mKM-iB-gtC">
                             <rect key="frame" x="20" y="14" width="40" height="40"/>
                             <autoresizingMask key="autoresizingMask" flexibleMinX="YES" flexibleMaxX="YES" flexibleMaxY="YES"/>
@@ -463,7 +454,7 @@
                         </navigationItem>
                     </items>
                 </navigationBar>
-                <view hidden="YES" contentMode="scaleToFill" id="241" userLabel="Controls panel">
+                <view hidden="YES" contentMode="scaleToFill" id="241" userLabel="Controls panel" customClass="VLCFrostedGlasView">
                     <rect key="frame" x="0.0" y="63" width="320" height="46"/>
                     <autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMaxY="YES"/>
                     <subviews>
@@ -543,4 +534,4 @@
         <image name="subtitleIcon.png" width="19" height="19"/>
         <image name="videoEffectsIcon.png" width="21" height="21"/>
     </resources>
-</document>
+</document>

BIN
Resources/playbackControllerBg.png


BIN
Resources/playbackControllerBg@2x.png


+ 17 - 5
Sources/VLCFrostedGlasView.m

@@ -15,6 +15,7 @@
 @interface VLCFrostedGlasView ()
 
 @property (nonatomic) UIToolbar *toolbar;
+@property (nonatomic) UIImageView *imageview;
 
 @end
 
@@ -26,10 +27,17 @@
     self = [super initWithCoder:aDecoder];
     if (self) {
         [self setClipsToBounds:YES];
-        if (![self toolbar]) {
-            [self setToolbar:[[UIToolbar alloc] initWithFrame:[self bounds]]];
-            [self.layer insertSublayer:[self.toolbar layer] atIndex:0];
-            [self.toolbar setBarStyle:UIBarStyleBlack];
+        if (SYSTEM_RUNS_IOS7_OR_LATER) {
+            if (![self toolbar]) {
+                [self setToolbar:[[UIToolbar alloc] initWithFrame:[self bounds]]];
+                [self.layer insertSublayer:[self.toolbar layer] atIndex:0];
+                [self.toolbar setBarStyle:UIBarStyleBlack];
+            }
+        } else {
+            if(![self imageview]) {
+                [self setImageview:[[UIImageView alloc] initWithImage:[UIImage imageNamed:@"playbackControllerBg"]]];
+                [self insertSubview:self.imageview atIndex:0];
+            }
         }
     }
     return self;
@@ -37,7 +45,11 @@
 
 - (void)layoutSubviews {
     [super layoutSubviews];
-    [self.toolbar setFrame:[self bounds]];
+     if (SYSTEM_RUNS_IOS7_OR_LATER) {
+         [self.toolbar setFrame:[self bounds]];
+     } else {
+         [self.imageview setFrame:[self bounds]];
+     }
 }
 
 @end

+ 8 - 0
VLC for iOS.xcodeproj/project.pbxproj

@@ -291,6 +291,8 @@
 		9B5BEF2917FBAEA50016F9CB /* GTLDrive_Sources.m in Sources */ = {isa = PBXBuildFile; fileRef = 9B5BEF2717FBAEA50016F9CB /* GTLDrive_Sources.m */; };
 		9B9231C4185A703700F89498 /* VLCFutureNetworkLoginViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 9B9231C3185A703700F89498 /* VLCFutureNetworkLoginViewController.xib */; };
 		9BADAF45185FBD9D00108BD8 /* VLCFrostedGlasView.m in Sources */ = {isa = PBXBuildFile; fileRef = 9BADAF44185FBD9D00108BD8 /* VLCFrostedGlasView.m */; };
+		9BADAF48185FC66700108BD8 /* playbackControllerBg.png in Resources */ = {isa = PBXBuildFile; fileRef = 9BADAF46185FC66700108BD8 /* playbackControllerBg.png */; };
+		9BADAF49185FC66700108BD8 /* playbackControllerBg@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 9BADAF47185FC66700108BD8 /* playbackControllerBg@2x.png */; };
 		9BD3F367185DEC0A00569ADC /* arrows.png in Resources */ = {isa = PBXBuildFile; fileRef = 9BD3F365185DEC0900569ADC /* arrows.png */; };
 		9BD3F368185DEC0A00569ADC /* arrows@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 9BD3F366185DEC0A00569ADC /* arrows@2x.png */; };
 		9BE4D1CE183D76950006346C /* VLCCloudStorageTableViewCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 7D3784B0183A990F009EE944 /* VLCCloudStorageTableViewCell.m */; };
@@ -817,6 +819,8 @@
 		9B9231C3185A703700F89498 /* VLCFutureNetworkLoginViewController.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; name = VLCFutureNetworkLoginViewController.xib; path = Resources/VLCFutureNetworkLoginViewController.xib; sourceTree = SOURCE_ROOT; };
 		9BADAF43185FBD9D00108BD8 /* VLCFrostedGlasView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = VLCFrostedGlasView.h; path = Sources/VLCFrostedGlasView.h; sourceTree = SOURCE_ROOT; };
 		9BADAF44185FBD9D00108BD8 /* VLCFrostedGlasView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = VLCFrostedGlasView.m; path = Sources/VLCFrostedGlasView.m; sourceTree = SOURCE_ROOT; };
+		9BADAF46185FC66700108BD8 /* playbackControllerBg.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = playbackControllerBg.png; sourceTree = "<group>"; };
+		9BADAF47185FC66700108BD8 /* playbackControllerBg@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "playbackControllerBg@2x.png"; sourceTree = "<group>"; };
 		9BD3F365185DEC0900569ADC /* arrows.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = arrows.png; sourceTree = "<group>"; };
 		9BD3F366185DEC0A00569ADC /* arrows@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "arrows@2x.png"; sourceTree = "<group>"; };
 		9BF0708B185122AA009B23DD /* audio.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = audio.png; sourceTree = "<group>"; };
@@ -1286,6 +1290,8 @@
 		7D47D6C81760CD2700E86BAD /* Movie VIew */ = {
 			isa = PBXGroup;
 			children = (
+				9BADAF46185FC66700108BD8 /* playbackControllerBg.png */,
+				9BADAF47185FC66700108BD8 /* playbackControllerBg@2x.png */,
 				9B1A1650185E08B4001A99D9 /* forwardIcon.png */,
 				9B1A1651185E08B4001A99D9 /* forwardIcon@2x.png */,
 				9B1A164C185E0821001A99D9 /* backIcon.png */,
@@ -2024,6 +2030,7 @@
 				7D47D6FC1760CD8700E86BAD /* videoEffectsIcon@2x.png in Resources */,
 				7D47D6FD1760CD8700E86BAD /* seekbarBg@2x.png in Resources */,
 				7D89787A185DEFB5009BAB5D /* flatDeleteButton.png in Resources */,
+				9BADAF49185FC66700108BD8 /* playbackControllerBg@2x.png in Resources */,
 				7D47D6FE1760CD8700E86BAD /* slidermaximumTrack.png in Resources */,
 				7D47D6FF1760CD8700E86BAD /* slidermaximumTrack@2x.png in Resources */,
 				7D47D7001760CD8700E86BAD /* slidermaxValue.png in Resources */,
@@ -2053,6 +2060,7 @@
 				7D223E1A181EC56E00B36798 /* gradient-cell-ios7-ipad.png in Resources */,
 				7D47D7211760CD8700E86BAD /* ballSlider@2x.png in Resources */,
 				7D897885185E00C3009BAB5D /* checkboxEmpty@2x.png in Resources */,
+				9BADAF48185FC66700108BD8 /* playbackControllerBg.png in Resources */,
 				7DBBF19D183AB4300009A339 /* VLCCloudStorageTableViewController.xib in Resources */,
 				7D47D7271760D77C00E86BAD /* pauseIcon.png in Resources */,
 				7D47D7281760D77C00E86BAD /* pauseIcon@2x.png in Resources */,