Skip to content

Commit

Permalink
* Use Interface Builder to create the grid view
Browse files Browse the repository at this point in the history
* Fix memory leak
* Realod Button
  • Loading branch information
René Sprotte committed Jun 27, 2011
1 parent cda93d0 commit 6ddbb89
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 5 deletions.
21 changes: 21 additions & 0 deletions MMGridViewDemo/RootViewController.m
Expand Up @@ -23,6 +23,11 @@
#import "AnyViewController.h"
#import "MMGridViewDefaultCell.h"


@interface RootViewController()
- (void)reload;
@end

@implementation RootViewController

// ----------------------------------------------------------------------------------
Expand All @@ -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
Expand All @@ -55,6 +70,12 @@ - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interface
interfaceOrientation == UIInterfaceOrientationLandscapeRight);
}


- (void)reload
{
[gridView reloadData];
}

// ----------------------------------------------------------------------------------

#pragma - MMGridViewDataSource
Expand Down
15 changes: 10 additions & 5 deletions MMGridViewDemo/en.lproj/RootViewController.xib
Expand Up @@ -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>
Expand All @@ -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"/>
Expand All @@ -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>
Expand Down Expand Up @@ -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>
Expand Down

0 comments on commit 6ddbb89

Please sign in to comment.