[22548] | 1 |
|
---|
| 2 |
|
---|
| 3 | #import <Foundation/Foundation.h> // can remove?? *****
|
---|
| 4 |
|
---|
| 5 | #import <UIKit/UIKit.h>
|
---|
| 6 |
|
---|
| 7 |
|
---|
| 8 | #import "GreenstoneApplication.h"
|
---|
| 9 |
|
---|
| 10 | #import "PrefTable.h"
|
---|
| 11 | #import "PrefView.h"
|
---|
| 12 |
|
---|
| 13 |
|
---|
| 14 |
|
---|
| 15 | @implementation PrefView
|
---|
| 16 |
|
---|
| 17 | - (id)initWithFrame:(struct CGRect)frame withParent:(UIView*)parent
|
---|
| 18 | withCollection:(NSString*)collection withTitle:(NSString*)title
|
---|
| 19 | {
|
---|
| 20 | self = [super initWithFrame:frame];
|
---|
| 21 |
|
---|
| 22 | _parent = parent;
|
---|
| 23 | _collection = collection;
|
---|
| 24 |
|
---|
| 25 | // Create the storage array.
|
---|
| 26 | // _cellResultList = [[NSMutableArray alloc] init]; // ****
|
---|
| 27 |
|
---|
| 28 | // Create the navigation bar.
|
---|
| 29 | _navbar = [[UINavigationBar alloc] initWithFrame: CGRectMake(0, 0, 320, 45)];
|
---|
| 30 | [_navbar showLeftButton:@"Back" withStyle:2 rightButton:nil withStyle:0]; // 2 = arrow left. // *** do enum for "2"
|
---|
| 31 | [_navbar setBarStyle: barstyleBlue];
|
---|
| 32 | [_navbar setDelegate:self];
|
---|
| 33 | [_navbar enableAnimation];
|
---|
| 34 |
|
---|
| 35 | [self setTitle:title];
|
---|
| 36 |
|
---|
| 37 |
|
---|
| 38 | CGRect pref_rect = frame;
|
---|
| 39 | pref_rect.origin.y += 45;
|
---|
| 40 | pref_rect.size.height -= 45;
|
---|
| 41 |
|
---|
| 42 | _prefTable = [ [ PrefTable alloc ] initWithFrame: pref_rect ];
|
---|
| 43 | [_prefTable reloadData];
|
---|
| 44 |
|
---|
| 45 | // [self setTitle:collection]; // ***** can't seem to be this to work!!!! but does in MenuCascadeView
|
---|
| 46 |
|
---|
| 47 |
|
---|
| 48 | [self addSubview: _navbar];
|
---|
| 49 | [self addSubview: _prefTable];
|
---|
| 50 |
|
---|
| 51 | return self;
|
---|
| 52 | }
|
---|
| 53 |
|
---|
| 54 |
|
---|
| 55 | -(void) setTitle:(NSString*)title
|
---|
| 56 | {
|
---|
| 57 | UINavigationItem* navtitle = [UINavigationItem alloc];
|
---|
| 58 | [_navbar pushNavigationItem: [navtitle initWithTitle: title]];
|
---|
| 59 | }
|
---|
| 60 |
|
---|
| 61 | -(NSString*) languagePref
|
---|
| 62 | {
|
---|
| 63 | return [_prefTable languagePref];
|
---|
| 64 | }
|
---|
| 65 |
|
---|
| 66 |
|
---|
| 67 | //***********
|
---|
| 68 | //* Delegates
|
---|
| 69 | //***********
|
---|
| 70 |
|
---|
| 71 | - (void)navigationBar:(UINavigationBar*)navbar buttonClicked:(int)button
|
---|
| 72 | {
|
---|
| 73 | switch (button)
|
---|
| 74 | {
|
---|
| 75 | case 1: // left
|
---|
| 76 | [GreenstoneApplication setInCollection:nil];
|
---|
| 77 | [GreenstoneApplication transitionView:UITransitionBothShiftRight
|
---|
| 78 | fromView:self toView:_parent];
|
---|
| 79 | break;
|
---|
| 80 |
|
---|
| 81 | default:
|
---|
| 82 | NSLog(@"Unrecognised navbar button = %d",button);
|
---|
| 83 | break;
|
---|
| 84 | }
|
---|
| 85 |
|
---|
| 86 | }
|
---|
| 87 |
|
---|
| 88 |
|
---|
| 89 | -(void) dealloc
|
---|
| 90 | {
|
---|
| 91 | [_collection release];
|
---|
| 92 |
|
---|
| 93 | [super dealloc];
|
---|
| 94 | }
|
---|
| 95 |
|
---|
| 96 | @end
|
---|
| 97 |
|
---|