#import // can remove?? ***** #import #import "GreenstoneApplication.h" #import "PrefTable.h" #import "PrefView.h" @implementation PrefView - (id)initWithFrame:(struct CGRect)frame withParent:(UIView*)parent withCollection:(NSString*)collection withTitle:(NSString*)title { self = [super initWithFrame:frame]; _parent = parent; _collection = collection; // Create the storage array. // _cellResultList = [[NSMutableArray alloc] init]; // **** // Create the navigation bar. _navbar = [[UINavigationBar alloc] initWithFrame: CGRectMake(0, 0, 320, 45)]; [_navbar showLeftButton:@"Back" withStyle:2 rightButton:nil withStyle:0]; // 2 = arrow left. // *** do enum for "2" [_navbar setBarStyle: barstyleBlue]; [_navbar setDelegate:self]; [_navbar enableAnimation]; [self setTitle:title]; CGRect pref_rect = frame; pref_rect.origin.y += 45; pref_rect.size.height -= 45; _prefTable = [ [ PrefTable alloc ] initWithFrame: pref_rect ]; [_prefTable reloadData]; // [self setTitle:collection]; // ***** can't seem to be this to work!!!! but does in MenuCascadeView [self addSubview: _navbar]; [self addSubview: _prefTable]; return self; } -(void) setTitle:(NSString*)title { UINavigationItem* navtitle = [UINavigationItem alloc]; [_navbar pushNavigationItem: [navtitle initWithTitle: title]]; } -(NSString*) languagePref { return [_prefTable languagePref]; } //*********** //* Delegates //*********** - (void)navigationBar:(UINavigationBar*)navbar buttonClicked:(int)button { switch (button) { case 1: // left [GreenstoneApplication setInCollection:nil]; [GreenstoneApplication transitionView:UITransitionBothShiftRight fromView:self toView:_parent]; break; default: NSLog(@"Unrecognised navbar button = %d",button); break; } } -(void) dealloc { [_collection release]; [super dealloc]; } @end