Permalink
Browse files

* Use Interface Builder to create the grid view

* Fix memory leak
* Realod Button
  • Loading branch information...
1 parent cda93d0 commit 6ddbb89a80d355bd0bd7da5038fe1078b416448e @renspr renspr committed Jun 27, 2011
Showing with 31 additions and 5 deletions.
  1. +21 −0 MMGridViewDemo/RootViewController.m
  2. +10 −5 MMGridViewDemo/en.lproj/RootViewController.xib
View
21 MMGridViewDemo/RootViewController.m
@@ -23,6 +23,11 @@
#import "AnyViewController.h"
#import "MMGridViewDefaultCell.h"
+
+@interface RootViewController()
+- (void)reload;
+@end
+
@implementation RootViewController
// ----------------------------------------------------------------------------------
@@ -32,19 +37,29 @@ @implementation RootViewController
- (void)dealloc
{
[gridView release];
+ [pageControl release];
[super dealloc];
}
- (void)viewDidUnload {
[gridView release];
gridView = nil;
+ [pageControl release];
+ pageControl = nil;
[super viewDidUnload];
}
- (void)viewDidLoad
{
// Give us a nice title
self.title = @"MMGridView Demo";
+
+ // Create a reload button
+ UIBarButtonItem *reloadButton = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemRefresh
+ target:self
+ action:@selector(reload)];
+ self.navigationItem.rightBarButtonItem = reloadButton;
+ [reloadButton release];
}
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
@@ -55,6 +70,12 @@ - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interface
interfaceOrientation == UIInterfaceOrientationLandscapeRight);
}
+
+- (void)reload
+{
+ [gridView reloadData];
+}
+
// ----------------------------------------------------------------------------------
#pragma - MMGridViewDataSource
View
15 MMGridViewDemo/en.lproj/RootViewController.xib
@@ -45,10 +45,10 @@
<object class="IBUIView" id="828679809">
<reference key="NSNextResponder" ref="774585933"/>
<int key="NSvFlags">274</int>
- <string key="NSFrameSize">{320, 440}</string>
+ <string key="NSFrameSize">{320, 396}</string>
<reference key="NSSuperview" ref="774585933"/>
<reference key="NSWindow"/>
- <reference key="NSNextKeyView"/>
+ <reference key="NSNextKeyView" ref="450822537"/>
<object class="NSColor" key="IBUIBackgroundColor">
<int key="NSColorSpace">3</int>
<bytes key="NSWhite">MQA</bytes>
@@ -70,24 +70,26 @@
<string key="NSFrame">{{20, -7}, {280, 36}}</string>
<reference key="NSSuperview" ref="450822537"/>
<reference key="NSWindow"/>
+ <reference key="NSNextKeyView"/>
<bool key="IBUIOpaque">NO</bool>
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
<int key="IBUIContentHorizontalAlignment">0</int>
<int key="IBUIContentVerticalAlignment">0</int>
<int key="IBUINumberOfPages">3</int>
</object>
</object>
- <string key="NSFrame">{{0, 439}, {320, 21}}</string>
+ <string key="NSFrame">{{0, 395}, {320, 21}}</string>
<reference key="NSSuperview" ref="774585933"/>
<reference key="NSWindow"/>
+ <reference key="NSNextKeyView" ref="331678497"/>
<object class="NSColor" key="IBUIBackgroundColor">
<int key="NSColorSpace">3</int>
<bytes key="NSWhite">MCAwLjUAA</bytes>
</object>
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
</object>
</object>
- <string key="NSFrame">{{0, 20}, {320, 460}}</string>
+ <string key="NSFrame">{{0, 64}, {320, 416}}</string>
<reference key="NSSuperview"/>
<reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="828679809"/>
@@ -97,6 +99,9 @@
</object>
<bool key="IBUIClearsContextBeforeDrawing">NO</bool>
<object class="IBUISimulatedStatusBarMetrics" key="IBUISimulatedStatusBarMetrics"/>
+ <object class="IBUISimulatedNavigationBarMetrics" key="IBUISimulatedTopBarMetrics">
+ <bool key="IBUIPrompted">NO</bool>
+ </object>
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
</object>
</object>
@@ -169,8 +174,8 @@
<reference key="object" ref="774585933"/>
<object class="NSMutableArray" key="children">
<bool key="EncodedWithXMLCoder">YES</bool>
- <reference ref="828679809"/>
<reference ref="450822537"/>
+ <reference ref="828679809"/>
</object>
<reference key="parent" ref="0"/>
</object>

0 comments on commit 6ddbb89

Please sign in to comment.