Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Wifi controller.

  • Loading branch information...
commit 9d8787e24117a410f5061f0a56b7f893ec4c6db3 1 parent 876ac2c
@jverkoey authored
View
6 Settings.xcodeproj/project.pbxproj
@@ -146,6 +146,7 @@
6677CFB01580440900FAB17D /* vc@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 6677CF471580440900FAB17D /* vc@2x.png */; };
6677CFB11580440900FAB17D /* YouTube.png in Resources */ = {isa = PBXBuildFile; fileRef = 6677CF481580440900FAB17D /* YouTube.png */; };
6677CFB21580440900FAB17D /* YouTube@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 6677CF491580440900FAB17D /* YouTube@2x.png */; };
+ 6677CFB51580492C00FAB17D /* WifiViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 6677CFB41580492C00FAB17D /* WifiViewController.m */; };
/* End PBXBuildFile section */
/* Begin PBXFileReference section */
@@ -329,6 +330,8 @@
6677CF471580440900FAB17D /* vc@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = "vc@2x.png"; path = "resources/vc@2x.png"; sourceTree = "<group>"; };
6677CF481580440900FAB17D /* YouTube.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = YouTube.png; path = resources/YouTube.png; sourceTree = "<group>"; };
6677CF491580440900FAB17D /* YouTube@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = "YouTube@2x.png"; path = "resources/YouTube@2x.png"; sourceTree = "<group>"; };
+ 6677CFB31580492C00FAB17D /* WifiViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WifiViewController.h; sourceTree = "<group>"; };
+ 6677CFB41580492C00FAB17D /* WifiViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = WifiViewController.m; sourceTree = "<group>"; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
@@ -480,6 +483,8 @@
children = (
6677CEDD158043A800FAB17D /* RootController.h */,
6677CEDE158043A800FAB17D /* RootController.m */,
+ 6677CFB31580492C00FAB17D /* WifiViewController.h */,
+ 6677CFB41580492C00FAB17D /* WifiViewController.m */,
);
name = Controllers;
sourceTree = "<group>";
@@ -794,6 +799,7 @@
6677CEDA1580432200FAB17D /* NITableViewActions.m in Sources */,
6677CEDB1580432200FAB17D /* NITableViewModel.m in Sources */,
6677CEDF158043A800FAB17D /* RootController.m in Sources */,
+ 6677CFB51580492C00FAB17D /* WifiViewController.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
View
20 Settings/RootController.m
@@ -8,8 +8,14 @@
#import "RootController.h"
+#import "WifiViewController.h"
+
@interface RootController ()
@property (nonatomic, readwrite, retain) NITableViewModel* model;
+
+// This actions object will handle the display of cells, as well as dealing with the user
+// interactions themselves.
+@property (nonatomic, readwrite, retain) NITableViewActions* actions;
@end
typedef enum {
@@ -19,6 +25,7 @@ @interface RootController ()
@implementation RootController
@synthesize model;
+@synthesize actions;
- (id)initWithStyle:(UITableViewStyle)style {
self = [super initWithStyle:UITableViewStyleGrouped];
@@ -34,6 +41,16 @@ - (id)initWithStyle:(UITableViewStyle)style {
didChangeTarget:self
didChangeSelector:@selector(didChangeAirplaneMode:)],
nil];
+
+ NISubtitleCellObject* wifi = [NISubtitleCellObject objectWithTitle:@"Wi-Fi"
+ subtitle:@"Off"];
+ wifi.cellStyle = UITableViewCellStyleValue1;
+ [contents addObject:wifi];
+
+ self.actions = [[NITableViewActions alloc] initWithController:self];
+ [self.actions attachNavigationAction:NIPushControllerAction([WifiViewController class])
+ toObject:wifi];
+
// NICellFactory here allows us to take advantage of the pre-built bindings between
// Nimbus cells. This way we don't have to create our own factory until we absolutely need to.
self.model = [[NITableViewModel alloc] initWithSectionedArray:contents delegate:(id)[NICellFactory class]];
@@ -49,6 +66,9 @@ - (void)loadView {
[super loadView];
self.tableView.dataSource = self.model;
+
+ // Insert the actions object in the delegate chain.
+ self.tableView.delegate = [self.actions forwardingTo:self];
}
- (void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath {
View
13 Settings/WifiViewController.h
@@ -0,0 +1,13 @@
+//
+// WifiViewController.h
+// Settings
+//
+// Created by Jeffrey Verkoeyen on 12-06-06.
+// Copyright (c) 2012 Memento. All rights reserved.
+//
+
+#import <UIKit/UIKit.h>
+
+@interface WifiViewController : UITableViewController
+
+@end
View
24 Settings/WifiViewController.m
@@ -0,0 +1,24 @@
+//
+// WifiViewController.m
+// Settings
+//
+// Created by Jeffrey Verkoeyen on 12-06-06.
+// Copyright (c) 2012 Memento. All rights reserved.
+//
+
+#import "WifiViewController.h"
+
+@interface WifiViewController ()
+@end
+
+@implementation WifiViewController
+
+- (id)initWithStyle:(UITableViewStyle)style {
+ self = [super initWithStyle:UITableViewStyleGrouped];
+ if (self) {
+ self.title = @"Wi-Fi Networks";
+ }
+ return self;
+}
+
+@end
Please sign in to comment.
Something went wrong with that request. Please try again.