Permalink
Browse files

MVLCMediaCell is loaded from a NIB file

  • Loading branch information...
1 parent 75b20aa commit 770537e286aca6366cd80ef4e25763bc719af6ec Romain Goyet committed Jul 13, 2010
@@ -3,7 +3,7 @@
// MobileVLC
//
// Created by Romain Goyet on 12/07/10.
-// Copyright 2010 __MyCompanyName__. All rights reserved.
+// Copyright 2010 Applidium. All rights reserved.
//
#import <UIKit/UIKit.h>
@@ -13,6 +13,7 @@
@interface MVLCMovieGridViewCell : AQGridViewCell {
VLCMedia * _media;
}
-@property (nonatomic, retain) VLCMedia * media;
++ (CGSize)cellSize;
- (id)initWithReuseIdentifier:(NSString *)reuseIdentifier;
+@property (nonatomic, retain) VLCMedia * media;
@end
@@ -3,21 +3,32 @@
// MobileVLC
//
// Created by Romain Goyet on 12/07/10.
-// Copyright 2010 __MyCompanyName__. All rights reserved.
+// Copyright 2010 Applidium. All rights reserved.
//
#import "MVLCMovieGridViewCell.h"
+@interface MVLCMovieGridViewCell (Private)
++ (UIView *)_viewFromNib;
+@end
@implementation MVLCMovieGridViewCell
@synthesize media=_media;
++ (CGSize)cellSize {
+ static CGSize sSize = { 0.0f, 0.0f };
+ if (sSize.width == 0.0f && sSize.height == 0.0f) {
+ sSize = [[self _viewFromNib] frame].size;
+ }
+ return sSize;
+}
+
- (id)initWithReuseIdentifier:(NSString *)reuseIdentifier {
- self = [super initWithFrame:CGRectMake(0.0f, 0.0f, 200.0f, 200.0f) reuseIdentifier:reuseIdentifier];
+ UIView * view = [MVLCMovieGridViewCell _viewFromNib];
+
+ self = [super initWithFrame:view.frame reuseIdentifier:reuseIdentifier];
if (self != nil) {
- UIImageView * imageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"MVLCIcon.png"]];
- [self.contentView addSubview:imageView];
- [imageView release];
+ [self.contentView addSubview:view];
}
return self;
}
@@ -38,3 +49,13 @@ - (void)dealloc {
[super dealloc];
}
@end
+
+@implementation MVLCMovieGridViewCell (Private)
++ (UIView *)_viewFromNib {
+ NSArray * array = [[NSBundle mainBundle] loadNibNamed:@"MVLCMovieGridViewCell" owner:nil options:nil];
+ MVLCAssert([array count] == 1, @"Wrong number of objects in NIB file !");
+ MVLCAssert([[array lastObject] isKindOfClass:[UIView class]], @"Unexpected object in NIB file !");
+ return (UIView *)[array lastObject];
+}
+@end
+
@@ -3,7 +3,7 @@
// MobileVLC
//
// Created by Romain Goyet on 12/07/10.
-// Copyright 2010 __MyCompanyName__. All rights reserved.
+// Copyright 2010 Applidium. All rights reserved.
//
#import <UIKit/UIKit.h>
@@ -3,7 +3,7 @@
// MobileVLC
//
// Created by Romain Goyet on 12/07/10.
-// Copyright 2010 __MyCompanyName__. All rights reserved.
+// Copyright 2010 Applidium. All rights reserved.
//
#import "MVLCMovieListViewController.h"
@@ -48,11 +48,17 @@ - (AQGridViewCell *)gridView:(AQGridView *)gridView cellForItemAtIndex:(NSUInteg
MVLCMovieGridViewCell * cell = (MVLCMovieGridViewCell *)[gridView dequeueReusableCellWithIdentifier:MVLCMovieListGridCellIdentifier];
if (cell == nil) {
cell = [[[MVLCMovieGridViewCell alloc] initWithReuseIdentifier:MVLCMovieListGridCellIdentifier] autorelease];
- cell.media = [_allMedia objectAtIndex:index];
}
+ cell.media = [_allMedia objectAtIndex:index];
return cell;
}
+// all cells are placed in a logical 'grid cell', all of which are the same size. The default size is 96x128 (portrait).
+// The width/height values returned by this function will be rounded UP to the nearest denominator of the screen width.
+- (CGSize)portraitGridCellSizeForGridView:(AQGridView *)gridView {
+ return [MVLCMovieGridViewCell cellSize];
+}
+
#pragma mark -
#pragma mark AQGridViewDelegate
- (void)gridView:(AQGridView *)gridView didSelectItemAtIndex:(NSUInteger)index {
@@ -3,7 +3,7 @@
// MobileVLC
//
// Created by Romain Goyet on 06/07/10.
-// Copyright 2010 __MyCompanyName__. All rights reserved.
+// Copyright 2010 Applidium. All rights reserved.
//
#import <UIKit/UIKit.h>
@@ -3,7 +3,7 @@
// MobileVLC
//
// Created by Romain Goyet on 06/07/10.
-// Copyright 2010 __MyCompanyName__. All rights reserved.
+// Copyright 2010 Applidium. All rights reserved.
//
#import "MVLCMovieViewController.h"
View
@@ -3,7 +3,7 @@
// MobileVLC
//
// Created by Romain Goyet on 13/07/10.
-// Copyright 2010 __MyCompanyName__. All rights reserved.
+// Copyright 2010 Applidium. All rights reserved.
//
#ifdef DEBUG
@@ -3,7 +3,7 @@
// MobileVLC
//
// Created by Pierre d'Herbemont on 6/27/10.
-// Copyright __MyCompanyName__ 2010. All rights reserved.
+// Copyright Applidium 2010. All rights reserved.
//
#import <UIKit/UIKit.h>
@@ -3,7 +3,7 @@
// MobileVLC
//
// Created by Pierre d'Herbemont on 6/27/10.
-// Copyright __MyCompanyName__ 2010. All rights reserved.
+// Copyright Applidium 2010. All rights reserved.
//
#import "MobileVLCAppDelegate.h"
@@ -15,6 +15,7 @@
7A350A9B11EB7D7F00B80E7C /* MVLCMovieListView.xib in Resources */ = {isa = PBXBuildFile; fileRef = 7A350A9A11EB7D7F00B80E7C /* MVLCMovieListView.xib */; };
7A350AA211EB7E2300B80E7C /* MVLCMovieListBackground.jpg in Resources */ = {isa = PBXBuildFile; fileRef = 7A350AA111EB7E2300B80E7C /* MVLCMovieListBackground.jpg */; };
7A350AFE11EB83B400B80E7C /* MVLCMovieGridViewCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 7A350AFD11EB83B400B80E7C /* MVLCMovieGridViewCell.m */; };
+ 7A3B2C2E11EC877000A01E01 /* MVLCMovieGridViewCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = 7A3B2C2D11EC877000A01E01 /* MVLCMovieGridViewCell.xib */; };
7A4BA0B211EB48AF0056579C /* libstdc++.6.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 7A4BA0B111EB48AF0056579C /* libstdc++.6.dylib */; };
7A4BA1F911EB73EC0056579C /* AQGridView.m in Sources */ = {isa = PBXBuildFile; fileRef = 7A4BA1D811EB737B0056579C /* AQGridView.m */; };
7A4BA1FA11EB73EC0056579C /* AQGridViewAnimatorItem.m in Sources */ = {isa = PBXBuildFile; fileRef = 7A4BA1DA11EB737B0056579C /* AQGridViewAnimatorItem.m */; };
@@ -63,6 +64,8 @@
7A350AA111EB7E2300B80E7C /* MVLCMovieListBackground.jpg */ = {isa = PBXFileReference; lastKnownFileType = image.jpeg; name = MVLCMovieListBackground.jpg; path = Resources/MVLCMovieListBackground.jpg; sourceTree = "<group>"; };
7A350AFC11EB83B400B80E7C /* MVLCMovieGridViewCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MVLCMovieGridViewCell.h; sourceTree = "<group>"; };
7A350AFD11EB83B400B80E7C /* MVLCMovieGridViewCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MVLCMovieGridViewCell.m; sourceTree = "<group>"; };
+ 7A3B2C2D11EC877000A01E01 /* MVLCMovieGridViewCell.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = MVLCMovieGridViewCell.xib; path = Resources/MVLCMovieGridViewCell.xib; sourceTree = "<group>"; };
+ 7A3B2C4C11EC882B00A01E01 /* MobileVLC.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MobileVLC.h; sourceTree = "<group>"; };
7A4BA0B111EB48AF0056579C /* libstdc++.6.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = "libstdc++.6.dylib"; path = "usr/lib/libstdc++.6.dylib"; sourceTree = SDKROOT; };
7A4BA1D511EB737B0056579C /* AQGridView+CellLayout.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "AQGridView+CellLayout.h"; sourceTree = "<group>"; };
7A4BA1D611EB737B0056579C /* AQGridView+CellLocationDelegation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "AQGridView+CellLocationDelegation.h"; sourceTree = "<group>"; };
@@ -146,6 +149,7 @@
080E96DDFE201D6D7F000001 /* Classes */ = {
isa = PBXGroup;
children = (
+ 7A3B2C4C11EC882B00A01E01 /* MobileVLC.h */,
7A3453A011E5FD9C00A141F2 /* Model */,
7A3453A111E5FDA200A141F2 /* View */,
7A3453A211E5FDA600A141F2 /* Controller */,
@@ -356,6 +360,7 @@
7A87ECAB11E3A1DD007BE827 /* MVLCMainWindow.xib */,
7A350A9A11EB7D7F00B80E7C /* MVLCMovieListView.xib */,
7A87ECD911E3A356007BE827 /* MVLCMovieView.xib */,
+ 7A3B2C2D11EC877000A01E01 /* MVLCMovieGridViewCell.xib */,
);
name = XIB;
sourceTree = "<group>";
@@ -434,6 +439,7 @@
7AF667DA11E61BA300BC5F19 /* MVLCIcon.png in Resources */,
7A350A9B11EB7D7F00B80E7C /* MVLCMovieListView.xib in Resources */,
7A350AA211EB7E2300B80E7C /* MVLCMovieListBackground.jpg in Resources */,
+ 7A3B2C2E11EC877000A01E01 /* MVLCMovieGridViewCell.xib in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -474,6 +480,7 @@
GCC_OPTIMIZATION_LEVEL = 0;
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = MobileVLC_Prefix.pch;
+ GCC_PREPROCESSOR_DEFINITIONS = "DEBUG=1";
HEADER_SEARCH_PATHS = "$(SRCROOT)/External/MobileVLCKit/include";
INFOPLIST_FILE = "MobileVLC-Info.plist";
LIBRARY_SEARCH_PATHS = (
View
2 main.m
@@ -3,7 +3,7 @@
// MobileVLC
//
// Created by Pierre d'Herbemont on 6/27/10.
-// Copyright __MyCompanyName__ 2010. All rights reserved.
+// Copyright Applidium 2010. All rights reserved.
//
#import <UIKit/UIKit.h>

0 comments on commit 770537e

Please sign in to comment.