Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //
- // AdvanceSearchViewController.m
- // %%%
- //
- // Created by %%% on 17/12/08.
- // Copyright 2008 %%%. All rights reserved.
- //
- #import "AdvanceSearchViewController.h"
- #import "CellTextField.h"
- #import "AdvanceSearchDataSource.h"
- #import "CustomRatingPicker.h"
- #import "AdvanceSearchPicker.h"
- #import "BandSearchParser.h"
- #import "SongAndBandSearchParser.h"
- #import "SearchResults.h"
- #import "DisplaySongsWithBands.h"
- #import "DisplaySongDetail.h"
- #import "GuitarAppDelegate.h"
- #import "DisplayBandSongs.h"
- #import "Song.h"
- #import "Band.h"
- #import "DisplayBands.h"
- #import "CreateCustomButton.h"
- #define PARAM_SECTION 3
- @implementation AdvanceSearchViewController
- @synthesize myTableView, songNameTextField , bandNameTextField;
- //@synthesize pickerToolBar;
- //@synthesize tuningPicker , levelPicker, typePicker , type2Picker;
- @synthesize contentView, /*ratingPicker ,*/ searchButton;
- @synthesize dataSource;
- @synthesize activeParamsIndex;
- - (id)init
- {
- if (self = [super init])
- {
- // Initialization code
- ////self.title = @"Advance Search";
- /* UIBarButtonItem *barButton = [[UIBarButtonItem alloc] initWithTitle:@"Search" style:UIBarButtonItemStyleBordered
- target:self action:@selector(startSearching)];
- self.navigationItem.rightBarButtonItem = barButton;
- [barButton release];
- */
- //alreadyUp=NO;
- }
- return self;
- }
- - (id)initWithDataSource:(id<ElementsDataSource>)theDataSource
- {
- if ([self init])
- {
- rowH = 0.0;
- self.dataSource = theDataSource;
- self.title = [dataSource name];
- self.tabBarItem.image = [dataSource tabBarImage];
- self.navigationItem.title=[dataSource navigationBarName];
- UIBarButtonItem *temporaryBarButtonItem=[[UIBarButtonItem alloc] init];
- temporaryBarButtonItem.title=@"Back";
- self.navigationItem.backBarButtonItem = temporaryBarButtonItem;
- [temporaryBarButtonItem release];
- [AdvanceSearchDataSource sharedAdvanceSearchDataSource];
- alreadyUp=NO;
- advParams = [[NSMutableArray alloc] init];
- [advParams addObject:@"0"];
- [advParams addObject:@"1"];
- [advParams addObject:@"2"];
- [advParams addObject:@"3"];
- [advParams addObject:@"4"];
- typeMenu = [[NSMutableArray alloc] initWithObjects:@"0", @"0", @"0", nil];
- partMenu = [[NSMutableArray alloc] initWithObjects:@"0", @"0", @"0", @"0", nil];
- ratingMenu = [[NSMutableArray alloc] initWithObjects:@"0", @"0", @"0", @"0", @"0", nil];
- difficultyLevelMenu = [[NSMutableArray alloc] initWithObjects:@"0", @"0", @"0", nil];
- tuningMenu = [[NSMutableArray alloc] initWithObjects:@"0", @"0", @"0", @"0", @"0", @"0", @"0", @"0", @"0", @"0", @"0", @"0", @"0", @"0", @"0", nil];
- self.activeParamsIndex = -1;
- [SharedElements sharedSharedElements].activeParamsIndex = -1;
- }
- return self;
- }
- - (NSString *) name
- {
- return @"Advanced";
- }
- - (NSString *) navigationBarName
- {
- return @"Advanced Tab Search";
- }
- - (BOOL) showDisclosureIcon
- {
- return NO;
- }
- - (UIImage *) tabBarImage
- {
- return [UIImage imageNamed:@"2_.png"];
- }
- /*
- Implement loadView if you want to create a view hierarchy programmatically
- */
- - (void) loadView
- {
- contentView = [[UIView alloc] initWithFrame:CGRectMake(0,0,320,480)];
- self.view = [[UIView alloc] initWithFrame:CGRectMake(0,0,320,480)];
- /*UIImage *buttonBackgroundPressed = [UIImage imageNamed:@"whiteButton.png"];
- UIImage *buttonBackground = [UIImage imageNamed:@"blueButton.png"];
- self.searchButton = [CreateCustomButton buttonWithTitle:@"SEARCH"
- target:self
- selector:@selector(startSearching:)
- frame: CGRectMake(10.0, 5.0, 280.0,35.0)
- image:buttonBackground
- imagePressed:buttonBackgroundPressed
- darkTextColor:NO];*/
- UITableView *tempTable = [[UITableView alloc] initWithFrame:CGRectMake(0, 0, 320, 387) style:UITableViewStyleGrouped];
- //[tempTable setAutoresizingMask:UIViewAutoresizingFlexibleHeight|UIViewAutoresizingFlexibleWidth];
- [self.navigationController.view setBackgroundColor:[UIColor colorWithPatternImage:[UIImage imageNamed:@"bg_new.png"]]];
- //tempTable.backgroundColor = [UIColor colorWithPatternImage:[UIImage imageNamed:@"bg_new.png"]];
- self.myTableView = tempTable;
- myTableView.delegate=self;
- myTableView.dataSource=self;
- //myTableView.rowHeight = 43;
- //myTableView.separatorStyle = UITableViewCellSeparatorStyleNone;
- myTableView.separatorColor = [UIColor clearColor];
- [tempTable release];
- UIImage *imgSearchBG = [UIImage imageNamed:@"search-bg2.png"];
- UIImageView *imgSearchBGView = [[UIImageView alloc] initWithImage:imgSearchBG];
- imgSearchBGView.frame = CGRectMake(9.0, 10.0, 302.0, 137.0);
- [myTableView addSubview:imgSearchBGView];
- [imgSearchBGView release];
- myTableView.backgroundColor = [UIColor clearColor];
- [contentView addSubview:myTableView];
- self.bandNameTextField = [self createTextField];
- bandNameTextField.placeholder = @"Band Name";
- bandNameTextField.contentVerticalAlignment = UIControlContentVerticalAlignmentCenter;
- bandNameTextField.text=@"";
- bandNameTextField.delegate=self;
- self.songNameTextField = [self createTextField];
- songNameTextField.placeholder = @"Song Name";
- songNameTextField.contentVerticalAlignment = UIControlContentVerticalAlignmentCenter;
- songNameTextField.text = @"";
- songNameTextField.delegate=self;
- /*pickerToolBar = [[UIToolbar alloc] initWithFrame:CGRectMake(0,206,320,44)];
- UIBarButtonItem *systemItem = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemCancel target:self action:@selector(cancelPicker:)];
- systemItem.style = UIBarButtonItemStylePlain;
- UIBarButtonItem *systemItem1 = [[UIBarButtonItem alloc]
- initWithBarButtonSystemItem:UIBarButtonSystemItemDone
- target:self action:@selector(donePicker:)];
- systemItem1.style = UIBarButtonItemStylePlain;
- NSArray *items = [NSArray arrayWithObjects: systemItem, systemItem1, nil];
- [systemItem release];
- [systemItem1 release];
- [pickerToolBar setItems:items animated:NO];
- pickerToolBar.barStyle = UIBarStyleBlackOpaque;
- pickerToolBar.hidden=YES;*/
- [self.view addSubview:contentView];
- //[self.view addSubview:pickerToolBar];
- //[self createPicker];
- [contentView release];
- }
- -(void) donePicker:(id)sender
- {
- /*pickerToolBar.hidden=YES;
- [self hideAllPickers];
- alreadyUp=NO;
- [self setViewMovedUp:NO];
- [self.myTableView reloadData];
- [self.myTableView deselectRowAtIndexPath:[self.myTableView indexPathForSelectedRow] animated:YES];*/
- }
- -(void) cancelPicker:(id)sender
- {
- /*if(selectedIndex.row==TUNING_PICKER){
- [tuningPicker resetPickerTicks];
- } else if(selectedIndex.row==TYPE_PICKER){
- [typePicker resetPickerTicks];
- }else if(selectedIndex.row==TYPE2_PICKER){
- [type2Picker resetPickerTicks];
- }else if(selectedIndex.row==RATING_PICKER){
- [ratingPicker resetPickerTicks];
- }else if(selectedIndex.row==DIFFICULTY_PICKER){
- [levelPicker resetPickerTicks];
- }*/
- /*Need to clear all selected values here*/
- /*[[AdvanceSearchDataSource sharedAdvanceSearchDataSource] cancelParametersFor:selectedIndex.row];
- [self hideAllPickers];
- pickerToolBar.hidden=YES;
- [self setViewMovedUp:NO];
- [self.myTableView reloadData];
- [self.myTableView deselectRowAtIndexPath:[self.myTableView indexPathForSelectedRow] animated:YES];*/
- }
- - (void) createPicker
- {
- /*CGRect pickerFrame = CGRectMake(0,250,320,230);
- tuningPicker = [[AdvanceSearchPicker alloc] initWithType:TUNING_PICKER];
- tuningPicker.frame = pickerFrame;
- [self.view addSubview:tuningPicker];
- levelPicker = [[AdvanceSearchPicker alloc] initWithType:DIFFICULTY_PICKER];
- levelPicker.frame = pickerFrame;
- [self.view addSubview:levelPicker];
- typePicker = [[AdvanceSearchPicker alloc] initWithType:TYPE_PICKER];
- typePicker.frame = pickerFrame;
- [self.view addSubview:typePicker];
- type2Picker = [[AdvanceSearchPicker alloc] initWithType:TYPE2_PICKER];
- type2Picker.frame = pickerFrame;
- [self.view addSubview:type2Picker];
- ratingPicker = [[CustomRatingPicker alloc] init];
- ratingPicker.frame = pickerFrame;
- [self.view addSubview:ratingPicker];
- [self hideAllPickers];*/
- }
- -(void) hideAllPickers
- {
- /*tuningPicker.hidden=YES;
- levelPicker.hidden=YES;
- typePicker.hidden=YES;
- type2Picker.hidden=YES;
- ratingPicker.hidden=YES;*/
- }
- - (UITextField *) createTextField
- {
- CGRect frame = CGRectMake(10.0, 0.0, 280,30);
- UITextField *returnTextField = [[UITextField alloc] initWithFrame:frame];
- returnTextField.borderStyle = UITextBorderStyleRoundedRect;
- returnTextField.textColor = [UIColor blackColor];
- returnTextField.font = [UIFont systemFontOfSize:17.0];
- returnTextField.backgroundColor = [UIColor clearColor];
- returnTextField.autocorrectionType = UITextAutocorrectionTypeDefault; // no auto correction support
- returnTextField.keyboardType = UIKeyboardTypeDefault; // use the default type input method (entire keyboard)
- returnTextField.returnKeyType = UIReturnKeyDone;
- returnTextField.clearButtonMode = UITextFieldViewModeWhileEditing; // has a clear 'x' button to the right
- return [returnTextField autorelease];
- }
- /*Whenever a row is selected within Type or Type , row number would be incremented and then
- added in the datasource*/
- -(void) startSearching:(id) sender
- {
- //if ([[SharedElements sharedSharedElements] isInternetAvailable] == NO)
- if ([[SharedElements sharedSharedElements].statusConnection isEqualToString:@"Offline"])
- {
- GuitarAppDelegate *appDelegate = (GuitarAppDelegate*)[[UIApplication sharedApplication] delegate];
- [appDelegate displayAlertOnNetworkError];
- }
- else
- {
- // [SharedElements sharedSharedElements].isBandSearch = NO;
- // [SharedElements sharedSharedElements].isSongWithBandSearch =NO;
- [[SearchResults sharedSearchResults] resetAllData];
- [[SharedElements sharedSharedElements] setBandName:@""];
- [[SharedElements sharedSharedElements] setSongName:@""];
- NSString *bandName = (![bandNameTextField text] || [[bandNameTextField text] isEqualToString:@""]) ? @"" : [bandNameTextField text];
- NSString *songName = (![songNameTextField text] || [[songNameTextField text] isEqualToString:@""]) ? @"" : [songNameTextField text];
- BOOL paramSelected = NO;
- BOOL songOrBandNameEntered=YES;
- if ([bandName length] > 0)
- {
- [[SharedElements sharedSharedElements] setBandName:bandName];
- }
- if ([songName length] >= 3)
- {
- [[SharedElements sharedSharedElements] setSongName:songName];
- }
- if ([bandNameTextField.text isEqualToString:@""] && [songNameTextField.text isEqualToString:@""])
- {
- /*UIAlertView* dialog = [[[UIAlertView alloc] init] retain];
- [dialog setDelegate:self];
- [dialog setTitle:@"Notification"];
- [dialog setMessage:@"Fields for search is empty."];
- [dialog addButtonWithTitle:@"OK"];
- [dialog show];
- return;*/
- UIAlertView* dialog = [[[UIAlertView alloc] init] retain];
- [dialog setDelegate:self];
- [dialog setTitle:@"Search"];
- [dialog setMessage:@"Please enter search query."];
- [dialog addButtonWithTitle:@"OK"];
- [dialog show];
- songOrBandNameEntered = NO;
- return;
- }
- if ([songNameTextField.text length] >= 1 && [songNameTextField.text length] < 3)
- {
- //Show Alert View Here
- UIAlertView* dialog = [[[UIAlertView alloc] init] retain];
- [dialog setDelegate:self];
- [dialog setTitle:@"Search"];
- [dialog setMessage:@"The song name must be at least 3 letters long."];
- [dialog addButtonWithTitle:@"OK"];
- [dialog show];
- return;
- }
- NSString *url = [NSString stringWithFormat: @"http://%%%/search.php?band_name=%@&song_name=%@&iphone=1", bandNameTextField.text, songNameTextField.text];
- NSLog(@"URL BEFORE: \n%@", url);
- //==========
- //Need to create the search url here!
- //NSString *eachParam;
- //NSMutableArray *paramValuesArray;
- //NSString *currParamForUrl=@"";
- //int index=0;
- //NSString *currParam;
- /*for (eachParam in [[AdvanceSearchDataSource sharedAdvanceSearchDataSource] paramNames])
- {
- if (paramValuesArray = [[[AdvanceSearchDataSource sharedAdvanceSearchDataSource] paramSelectedValues] valueForKey:eachParam])
- {
- for (currParam in paramValuesArray)
- {
- currParamForUrl = [[[AdvanceSearchDataSource sharedAdvanceSearchDataSource] parameterNamesForUrl] objectAtIndex:index];
- currParamForUrl = [currParamForUrl stringByAppendingString:currParam];
- url = [url stringByAppendingString:currParamForUrl];
- paramSelected=YES;
- }
- }
- index++;
- }*/
- //==========
- if ([self paramValueExistsAtIndex:0]) // 200/400/300
- {
- for (int i=0; i<[typeMenu count]; i++)
- if ([[typeMenu objectAtIndex:i] isEqualToString:@"1"])
- {
- url = [url stringByAppendingString:@"&"];
- url = [url stringByAppendingString:@"type[]="];
- if (i==0)
- url = [url stringByAppendingString:[NSString stringWithFormat:@"%d", 200]];
- else
- if (i==1)
- url = [url stringByAppendingString:[NSString stringWithFormat:@"%d", 400]];
- else
- if (i==2)
- url = [url stringByAppendingString:[NSString stringWithFormat:@"%d", 300]];
- paramSelected=YES;
- }
- [[SharedElements sharedSharedElements] setTypeMenu:typeMenu];
- }
- if ([self paramValueExistsAtIndex:1])
- {
- for (int i=0; i<[partMenu count]; i++)
- if ([[partMenu objectAtIndex:i] isEqualToString:@"1"])
- {
- url = [url stringByAppendingString:@"&"];
- url = [url stringByAppendingString:@"type2[]="];
- if (i==0)
- url = [url stringByAppendingString:[NSString stringWithFormat:@"%d", 40000]];
- else
- if (i==1)
- url = [url stringByAppendingString:[NSString stringWithFormat:@"%d", 20000]];
- else
- if (i==2)
- url = [url stringByAppendingString:[NSString stringWithFormat:@"%d", 30000]];
- else
- if (i==3)
- url = [url stringByAppendingString:[NSString stringWithFormat:@"%d", 10000]];
- //url = [url stringByAppendingString:[NSString stringWithFormat:@"%d", i+1]];
- paramSelected=YES;
- }
- [[SharedElements sharedSharedElements] setPartMenu:partMenu];
- }
- if ([self paramValueExistsAtIndex:2])
- {
- for (int i=0; i<[ratingMenu count]; i++)
- if ([[ratingMenu objectAtIndex:i] isEqualToString:@"1"])
- {
- int h = 0;
- if (i==0) h = 5; else
- if (i==1) h = 4; else
- if (i==2) h = 3; else
- if (i==3) h = 2; else
- if (i==4) h = 1;
- url = [url stringByAppendingString:@"&"];
- url = [url stringByAppendingString:@"rating[]="];
- url = [url stringByAppendingString:[NSString stringWithFormat:@"%d", h]];
- paramSelected=YES;
- }
- [[SharedElements sharedSharedElements] setRatingMenu:ratingMenu];
- }
- if ([self paramValueExistsAtIndex:3])
- {
- for (int i=0; i<[difficultyLevelMenu count]; i++)
- if ([[difficultyLevelMenu objectAtIndex:i] isEqualToString:@"1"])
- {
- url = [url stringByAppendingString:@"&"];
- url = [url stringByAppendingString:@"level[]="];
- url = [url stringByAppendingString:[NSString stringWithFormat:@"%d", i+1]];
- //url = [url stringByAppendingString:[[AdvanceSearchDataSource sharedAdvanceSearchDataSource].levelParams objectAtIndex:i]];
- paramSelected=YES;
- }
- [[SharedElements sharedSharedElements] setDifficultyLevelMenu:difficultyLevelMenu];
- }
- if ([self paramValueExistsAtIndex:4])
- {
- for (int i=0; i<[tuningMenu count]; i++)
- if ([[tuningMenu objectAtIndex:i] isEqualToString:@"1"])
- {
- url = [url stringByAppendingString:@"&"];
- url = [url stringByAppendingString:@"tuning[]="];
- url = [url stringByAppendingString:[[AdvanceSearchDataSource sharedAdvanceSearchDataSource].tuningParams objectAtIndex:i]];
- paramSelected=YES;
- }
- [[SharedElements sharedSharedElements] setTuningMenu:tuningMenu];
- }
- url = [url stringByReplacingOccurrencesOfString:@" " withString:@"+"];
- url = [url stringByReplacingOccurrencesOfString:@"#" withString:@"%23"];
- //[SearchResults sharedSearchResults].currentSearchUrl = url;
- if (paramSelected == NO && songOrBandNameEntered == NO)
- {
- return;
- }
- //url = [url stringByAppendingString:@"&results_format=xml"];
- NSLog(@"URL AFTER: \n%@", url);
- if (![songNameTextField.text isEqualToString:@""])
- {
- NSLog(@"DISPLAY_MODE_SONGS");
- [SharedElements sharedSharedElements].isSongWithBandSearch = NO;
- [SharedElements sharedSharedElements].searchMode = 1;
- [SearchResults sharedSearchResults].searchMode = SEARCH_MODE_SONG;
- [SearchResults sharedSearchResults].displayMode = DISPLAY_MODE_SONGS;
- /* SongAndBandSearchParser *songAndBandSearchParser = [[SongAndBandSearchParser alloc] init];
- [songAndBandSearchParser search%%%With:url andPage:1 sortMode:0];
- [songAndBandSearchParser release];*/
- }
- else
- {
- if (![bandNameTextField.text isEqualToString:@""])
- {
- if (paramSelected == YES)
- {
- NSLog(@"DISPLAY_MODE_BANDS");
- [SharedElements sharedSharedElements].isSongWithBandSearch =NO;
- [SharedElements sharedSharedElements].searchMode = 1;
- [SearchResults sharedSearchResults].searchMode = SEARCH_MODE_SONG;
- [SearchResults sharedSearchResults].displayMode = DISPLAY_MODE_SONGS;
- /* SongAndBandSearchParser *songAndBandSearchParser = [[SongAndBandSearchParser alloc] init];
- [songAndBandSearchParser search%%%With:url andPage:1 sortMode:0];
- [songAndBandSearchParser release];*/
- }
- else
- {
- NSLog(@"DISPLAY_MODE_BANDS");
- [SharedElements sharedSharedElements].isBandSearch = NO;
- [SharedElements sharedSharedElements].searchMode = 2;
- [SearchResults sharedSearchResults].searchMode = SEARCH_MODE_BAND;
- [SearchResults sharedSearchResults].displayMode = DISPLAY_MODE_BANDS;
- /* BandSearchParser *bandSearchParser = [[BandSearchParser alloc] init];
- [bandSearchParser search%%%With:url andPage:1 sortMode:1];
- [bandSearchParser release];*/
- }
- }
- else
- {
- //Both are entered
- NSLog(@"SEARCH_MODE_BANDANDSONG");
- [SharedElements sharedSharedElements].isBandSearch = NO;
- [SharedElements sharedSharedElements].searchMode = 2;
- [SearchResults sharedSearchResults].searchMode = SEARCH_MODE_BANDANDSONG;
- //[SearchResults sharedSearchResults].displayMode = DISPLAY_MODE_SONGS;
- /* SongAndBandSearchParser *songAndBandSearchParser = [[SongAndBandSearchParser alloc] init];
- [songAndBandSearchParser search%%%With:url andPage:1 sortMode:0];
- [songAndBandSearchParser release];*/
- }
- }
- /*
- if (![songNameTextField.text isEqualToString:@""] || paramSelected==YES)
- {
- NSLog(@"DISPLAY_MODE_SONGS");
- [SharedElements sharedSharedElements].searchMode = 1;
- [SearchResults sharedSearchResults].searchMode = SEARCH_MODE_SONG;
- [SearchResults sharedSearchResults].displayMode = DISPLAY_MODE_SONGS;
- SongAndBandSearchParser *songAndBandSearchParser = [[SongAndBandSearchParser alloc] init];
- [songAndBandSearchParser search%%%With:url andPage:1 sortMode:0];
- [songAndBandSearchParser release];
- }
- else
- {
- // comes here only and only IF Band Name is entered.
- NSLog(@"DISPLAY_MODE_BANDS");
- [SharedElements sharedSharedElements].searchMode = 2;
- [SearchResults sharedSearchResults].searchMode = SEARCH_MODE_BAND;
- [SearchResults sharedSearchResults].displayMode = DISPLAY_MODE_BANDS;
- BandSearchParser *bandSearchParser = [[BandSearchParser alloc] init];
- [bandSearchParser search%%%With:url andPage:1 sortMode:1];
- [bandSearchParser release];
- }
- if (![songNameTextField.text isEqualToString:@""] && ![bandNameTextField.text isEqualToString:@""])
- {
- //Both are entered
- NSLog(@"SEARCH_MODE_BANDANDSONG");
- [SearchResults sharedSearchResults].searchMode = SEARCH_MODE_BANDANDSONG;
- [SharedElements sharedSharedElements].searchMode = 2;
- }*/
- //[SharedElements sharedSharedElements].activeParamsIndex = self.activeParamsIndex;
- [SharedElements sharedSharedElements].selParam = paramSelected;
- [SearchResults sharedSearchResults].currentSearchUrl = url;
- [self displaySearchResults];
- }
- }
- -(void) searchInfo
- {
- BOOL paramSelected = [SharedElements sharedSharedElements].selParam;
- NSString *url = [SearchResults sharedSearchResults].currentSearchUrl;
- if (![[[SharedElements sharedSharedElements] getSongName] isEqualToString:@""])
- {
- NSLog(@"DISPLAY_MODE_SONGS");
- SongAndBandSearchParser *songAndBandSearchParser = [[SongAndBandSearchParser alloc] init];
- [songAndBandSearchParser search%%%With:url andPage:1 sortMode:0];
- [songAndBandSearchParser release];
- }
- else
- {
- if (![[[SharedElements sharedSharedElements] getBandName] isEqualToString:@""])
- {
- if (paramSelected == YES)
- {
- SongAndBandSearchParser *songAndBandSearchParser = [[SongAndBandSearchParser alloc] init];
- [songAndBandSearchParser search%%%With:url andPage:1 sortMode:0];
- [songAndBandSearchParser release];
- }
- else
- {
- BandSearchParser *bandSearchParser = [[BandSearchParser alloc] init];
- [bandSearchParser search%%%With:url andPage:1 sortMode:1];
- [bandSearchParser release];
- }
- }
- else
- {
- //Both are entered
- //[SearchResults sharedSearchResults].displayMode = DISPLAY_MODE_SONGS;
- SongAndBandSearchParser *songAndBandSearchParser = [[SongAndBandSearchParser alloc] init];
- [songAndBandSearchParser search%%%With:url andPage:1 sortMode:0];
- [songAndBandSearchParser release];
- }
- }
- }
- /*Copied Exactly From SimpleSearch*/
- - (void) displaySearchResults
- {
- @try
- {
- //[songNameTextField setText:@""];
- //[bandNameTextField setText:@""];
- [[AdvanceSearchDataSource sharedAdvanceSearchDataSource] clearAll];
- //Remove Picker Ticks As Well
- /*[tuningPicker resetPickerTicks];
- [levelPicker resetPickerTicks];
- [typePicker resetPickerTicks];
- [type2Picker resetPickerTicks];
- [ratingPicker resetPickerTicks];*/
- [self.myTableView reloadData];
- /* if([[SearchResults sharedSearchResults] didParseErrorOccur])
- {
- GuitarAppDelegate *appDelegate = (GuitarAppDelegate*)[[UIApplication sharedApplication] delegate];
- [appDelegate displayAlertOnNoResultFound];
- [SearchResults sharedSearchResults].noResultsFound = NO;
- //[appDelegate displayAlertOnNetworkError];
- return;
- }
- if([[SearchResults sharedSearchResults] noResultsFound])
- {
- GuitarAppDelegate *appDelegate = (GuitarAppDelegate*)[[UIApplication sharedApplication] delegate];
- [appDelegate displayAlertOnNoResultFound];
- [SearchResults sharedSearchResults].noResultsFound = NO;
- return;
- }*/
- if([SearchResults sharedSearchResults].searchMode == SEARCH_MODE_BAND)
- {
- if([SearchResults sharedSearchResults].displayMode == DISPLAY_MODE_SONGS)
- {
- Band *tempBand = [[[SearchResults sharedSearchResults] bandObjects] objectAtIndex:0];
- [self displaySongForBandName:tempBand.bandName];
- return;
- }
- if ([[[SearchResults sharedSearchResults] bandObjects] count] == 1)
- {
- [SearchResults sharedSearchResults].displayMode = DISPLAY_MODE_SONGS;
- NSLog(@"Display Mode is Now %@" , [SearchResults sharedSearchResults].displayMode);
- Band *tempBand = [[[SearchResults sharedSearchResults] bandObjects] objectAtIndex:0];
- SongAndBandSearchParser *songAndBandSearchParser = [[SongAndBandSearchParser alloc] init];
- [songAndBandSearchParser search%%%With:tempBand.url andPage:1 sortMode:0];
- [self displaySongForBandName:tempBand.bandName];
- [songAndBandSearchParser release];
- }
- else
- {
- DisplayBands *allBands = [[DisplayBands alloc] initWithStyle:UITableViewStylePlain];
- [self.navigationController pushViewController:allBands animated:YES];
- [allBands release];
- }
- }
- else
- if([SearchResults sharedSearchResults].searchMode == SEARCH_MODE_SONG || [SearchResults sharedSearchResults].searchMode == SEARCH_MODE_BANDANDSONG)
- {
- if ([[[SearchResults sharedSearchResults] songObjects] count] == 1)
- {
- DisplaySongDetail *songTabsList = [[DisplaySongDetail alloc] initWithStyle:UITableViewStylePlain];
- songTabsList.songName = [(Song*)[[[SearchResults sharedSearchResults] songObjects] objectAtIndex:0] songName];
- songTabsList.songArtist = [(Song*)[[[SearchResults sharedSearchResults] songObjects] objectAtIndex:0] songArtist];
- songTabsList.title = [NSString stringWithFormat:@"%@ Tabs", songTabsList.songName];
- [self.navigationController.view setBackgroundColor:[UIColor colorWithPatternImage:[UIImage imageNamed:@"bg_new.png"]]];
- [self.navigationController pushViewController:songTabsList animated:YES];
- [songTabsList release];
- }
- else
- {
- DisplaySongsWithBands *tempView = [[DisplaySongsWithBands alloc] initWithStyle:UITableViewStylePlain];
- [self.navigationController.view setBackgroundColor:[UIColor colorWithPatternImage:[UIImage imageNamed:@"bg_new.png"]]];
- [self.navigationController pushViewController:tempView animated:YES];
- [tempView release];
- }
- }
- else
- {
- NSLog(@"Yikes !! Error in Search Mode !!!!");
- }
- }
- @catch (NSException *exception)
- {
- NSLog (@"!!! Caught %@%@", [exception name], [exception reason]);
- }
- }
- -(void) displaySongForBandName:(NSString*)name
- {
- DisplayBandSongs *temp = [[DisplayBandSongs alloc] initWithStyle:UITableViewStylePlain];
- temp.band = name;
- [self.navigationController pushViewController:temp animated:YES];
- [temp release];
- }
- -(CGFloat) tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section
- {
- if (section==0)
- {
- //tableView.separatorColor = [UIColor clearColor];
- tableView.sectionHeaderHeight = 19;
- tableView.sectionFooterHeight = 9;
- }
- else
- if (section==1)
- {
- //tableView.separatorColor = [UIColor clearColor];
- tableView.sectionHeaderHeight = 0;
- tableView.sectionFooterHeight = 0;
- }
- else
- if (section==2)
- {
- //tableView.separatorColor = [UIColor clearColor];
- tableView.sectionHeaderHeight = 10;
- tableView.sectionFooterHeight = 12;
- }
- return 10.0;
- }
- -(CGFloat) tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
- {
- if (indexPath.section==0 || indexPath.section==1)
- return 30.0;
- else
- if (indexPath.section==2)
- return 35.0;
- else
- {
- if (self.activeParamsIndex == 0)
- {
- if (indexPath.row > 0 && indexPath.row <= 3)
- {
- return 35.0;
- }
- }
- if (self.activeParamsIndex == 1)
- {
- if (indexPath.row > 1 && indexPath.row <= 5)
- {
- return 35.0;
- }
- }
- if (self.activeParamsIndex == 2)
- {
- if (indexPath.row > 2 && indexPath.row <= 7)
- {
- return 35.0;
- }
- }
- if (self.activeParamsIndex == 3)
- {
- if (indexPath.row > 3 && indexPath.row <= 6)
- {
- return 35.0;
- }
- }
- if (self.activeParamsIndex == 4)
- {
- if (indexPath.row > 4 && indexPath.row <= 19)
- {
- return 35.0;
- }
- }
- return 43.0;
- }
- }
- -(NSInteger) numberOfSectionsInTableView:(UITableView *)tableView
- {
- return 4;
- }
- -(NSInteger) tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
- {
- if (section == PARAM_SECTION)
- {
- return [advParams count];
- /*if (self.activeParamsIndex == 1)
- {
- return [advParams count];
- }
- else
- if (self.activeParamsIndex == -1)
- {
- return [advParams count];
- }*/
- }
- return 1;
- }
- -(void) setStars:(UITableViewCell *)aCell atIndex:(int)ind_
- {
- int min = [self getMinArrayIndex:2];
- UIImage *img;
- UIImageView *imgV;
- UILabel *lbl;
- if (min == 0)
- {
- img = [[UIImage imageNamed:@"5s.png"] retain];
- }
- else
- if (min == 1)
- {
- img = [[UIImage imageNamed:@"4s.png"] retain];
- //imgV = [[UIImageView alloc] initWithFrame:CGRectMake(72.0, 15.0, 58.0, 13.0)];
- }
- else
- if (min == 2)
- {
- img = [[UIImage imageNamed:@"3s.png"] retain];
- //imgV = [[UIImageView alloc] initWithFrame:CGRectMake(72.0, 15.0, 43.0, 13.0)];
- }
- else
- if (min == 3)
- {
- img = [[UIImage imageNamed:@"2s.png"] retain];
- //imgV = [[UIImageView alloc] initWithFrame:CGRectMake(72.0, 15.0, 28.0, 13.0)];
- }
- else
- if (min == 4)
- {
- img = [[UIImage imageNamed:@"1s.png"] retain];
- //imgV = [[UIImageView alloc] initWithFrame:CGRectMake(72.0, 15.0, 13.0, 13.0)];
- }
- //imgV.autoresizingMask = UIViewAutoresizingFlexibleLeftMargin | UIViewAutoresizingFlexibleHeight;
- imgV = [[UIImageView alloc] initWithFrame:CGRectMake(115.0, 15.0, 75.0, 13.0)];
- [imgV setContentMode:UIViewContentModeRight];
- if (min == 0)
- {
- imgV.frame = CGRectMake(193.0, 15.0, 75.0, 13.0);
- }
- imgV.image = img;
- lbl = [[UILabel alloc] init];
- lbl.frame = CGRectMake(97.0f, 9.0f, 181.0f, 30.0f);
- [lbl setText:@"AND HIGHER"];
- [lbl setTextAlignment:UITextAlignmentRight];
- [lbl setFont: [UIFont fontWithName:@"Arial-BoldMT" size:11.0f]];
- [lbl setTextColor:[UIColor colorWithRed:61.0/255.0 green:96.0/255.0 blue:131.0/255.0 alpha:1.0]];
- [lbl setBackgroundColor:[UIColor clearColor]];
- if (min != 0)
- [aCell addSubview:lbl];
- [aCell.contentView addSubview:imgV];
- [lbl release];
- [img release];
- [imgV release];
- }
- -(void) setLabels:(UITableViewCell *)aCell atIndex:(int)ind_
- {
- UILabel *params = [[UILabel alloc] init];
- /*if (ind_ == 0)
- params.frame = CGRectMake(66.0f, 8.0f, 200.0f, 30.0f);
- else
- if (ind_ == 1)
- params.frame = CGRectMake(63.0f, 8.0f, 200.0f, 30.0f);
- else
- if (ind_ == 2)
- params.frame = CGRectMake(79.0f, 8.0f, 200.0f, 30.0f);
- else
- if (ind_ == 3)
- params.frame = CGRectMake(146.0f, 8.0f, 140.0f, 30.0f);
- else
- if (ind_ == 4)
- params.frame = CGRectMake(83.0f, 8.0f, 200.0f, 30.0f);*/
- params.frame = CGRectMake(97.0f, 9.0f, 181.0f, 30.0f);
- params.textAlignment = UITextAlignmentRight;
- [params setText:[[self getParamString:ind_] uppercaseString]];
- [params setFont: [UIFont fontWithName:@"Arial-BoldMT" size:11.0f]];
- //[params setFont: [UIFont boldSystemFontOfSize:14.0f]];
- [params setTextColor:[UIColor colorWithRed:61.0/255.0 green:96.0/255.0 blue:131.0/255.0 alpha:1.0]];
- params.highlightedTextColor = [UIColor whiteColor];
- [params setBackgroundColor:[UIColor clearColor]];
- [aCell addSubview:params];
- [params release];
- }
- -(void) setImages:(UITableViewCell *)aCell atIndex:(int)ind_
- {
- UIImage *img;
- UIImageView *imgV;
- if (ind_ == 3)
- {
- if ([[ratingMenu objectAtIndex:0] isEqualToString:@"0"])
- {
- img = [[UIImage imageNamed:@"5bw.png"] retain];
- imgV = [[UIImageView alloc] initWithFrame:CGRectMake(10.0, 8.0, 111.0, 18.0)];
- }
- else
- {
- img = [[UIImage imageNamed:@"5.png"] retain];
- imgV = [[UIImageView alloc] initWithFrame:CGRectMake(10.0, 8.0, 111.0, 18.0)];
- }
- }
- else
- if (ind_ == 4)
- {
- if ([[ratingMenu objectAtIndex:1] isEqualToString:@"0"])
- {
- img = [[UIImage imageNamed:@"4bw.png"] retain];
- imgV = [[UIImageView alloc] initWithFrame:CGRectMake(10.0, 8.0, 111.0, 18.0)];
- }
- else
- {
- img = [[UIImage imageNamed:@"4.png"] retain];
- imgV = [[UIImageView alloc] initWithFrame:CGRectMake(10.0, 8.0, 111.0, 18.0)];
- }
- }
- else
- if (ind_ == 5)
- {
- if ([[ratingMenu objectAtIndex:2] isEqualToString:@"0"])
- {
- img = [[UIImage imageNamed:@"3bw.png"] retain];
- imgV = [[UIImageView alloc] initWithFrame:CGRectMake(10.0, 8.0, 111.0, 18.0)];
- }
- else
- {
- img = [[UIImage imageNamed:@"3.png"] retain];
- imgV = [[UIImageView alloc] initWithFrame:CGRectMake(10.0, 8.0, 111.0, 18.0)];
- }
- }
- else
- if (ind_ == 6)
- {
- if ([[ratingMenu objectAtIndex:3] isEqualToString:@"0"])
- {
- img = [[UIImage imageNamed:@"2bw.png"] retain];
- imgV = [[UIImageView alloc] initWithFrame:CGRectMake(10.0, 8.0, 111.0, 18.0)];
- }
- else
- {
- img = [[UIImage imageNamed:@"2.png"] retain];
- imgV = [[UIImageView alloc] initWithFrame:CGRectMake(10.0, 8.0, 111.0, 18.0)];
- }
- }
- else
- if (ind_ == 7)
- {
- if ([[ratingMenu objectAtIndex:4] isEqualToString:@"0"])
- {
- img = [[UIImage imageNamed:@"1bw.png"] retain];
- imgV = [[UIImageView alloc] initWithFrame:CGRectMake(10.0, 8.0, 111.0, 18.0)];
- }
- else
- {
- img = [[UIImage imageNamed:@"1.png"] retain];
- imgV = [[UIImageView alloc] initWithFrame:CGRectMake(10.0, 8.0, 111.0, 18.0)];
- }
- }
- //imgV.autoresizingMask = UIViewAutoresizingFlexibleLeftMargin | UIViewAutoresizingFlexibleHeight;
- imgV.image = img;
- [aCell.contentView addSubview:imgV];
- [img release];
- [imgV release];
- }
- -(NSString*) getParamString:(int)ind_
- {
- if (ind_ == 0)
- {
- NSString *str = [[[NSString alloc] init] autorelease];
- for (int i=0; i<[typeMenu count]; i++)
- if ([[typeMenu objectAtIndex:i] isEqualToString:@"1"])
- {
- str = [str stringByAppendingString:[[AdvanceSearchDataSource sharedAdvanceSearchDataSource].typeParams objectAtIndex:i]];
- str = [str stringByAppendingString:@", "];
- }
- str = [str substringToIndex:[str length]-2];
- return str;
- }
- else
- if (ind_ == 1)
- {
- NSString *str = [[[NSString alloc] init] autorelease];
- for (int i=0; i<[partMenu count]; i++)
- if ([[partMenu objectAtIndex:i] isEqualToString:@"1"])
- {
- str = [str stringByAppendingString:[[AdvanceSearchDataSource sharedAdvanceSearchDataSource].type2Params objectAtIndex:i]];
- str = [str stringByAppendingString:@", "];
- }
- str = [str substringToIndex:[str length]-2];
- return str;
- }
- else
- if (ind_ == 2)
- {
- NSString *str = [[[NSString alloc] init] autorelease];
- for (int i=0; i<[ratingMenu count]; i++)
- if ([[ratingMenu objectAtIndex:i] isEqualToString:@"1"])
- {
- str = [str stringByAppendingString:@"*"];
- str = [str stringByAppendingString:@", "];
- }
- str = [str substringToIndex:[str length]-2];
- return str;
- }
- else
- if (ind_ == 3)
- {
- NSString *str = [[[NSString alloc] init] autorelease];
- for (int i=0; i<[difficultyLevelMenu count]; i++)
- if ([[difficultyLevelMenu objectAtIndex:i] isEqualToString:@"1"])
- {
- str = [str stringByAppendingString:[[AdvanceSearchDataSource sharedAdvanceSearchDataSource].levelParams objectAtIndex:i]];
- str = [str stringByAppendingString:@", "];
- }
- str = [str substringToIndex:[str length]-2];
- return str;
- }
- else
- if (ind_ == 4)
- {
- NSString *str = [[[NSString alloc] init] autorelease];
- for (int i=0; i<[tuningMenu count]; i++)
- if ([[tuningMenu objectAtIndex:i] isEqualToString:@"1"])
- {
- str = [str stringByAppendingString:[[AdvanceSearchDataSource sharedAdvanceSearchDataSource].tuningParams objectAtIndex:i]];
- str = [str stringByAppendingString:@", "];
- }
- str = [str substringToIndex:[str length]-2];
- return str;
- }
- return @"none";
- }
- ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
- ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
- ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
- -(UITableViewCell *) tableView:(UITableView *)aTableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
- {
- NSString *identifier = @"the-cell";
- //UITableViewCell *cell = (UITableViewCell *)[aTableView dequeueReusableCellWithIdentifier:identifier];
- UITableViewCell *cell = [[[UITableViewCell alloc] initWithFrame:CGRectZero reuseIdentifier:@"just-cell"] autorelease];
- if (indexPath.section==2)
- {
- ////[cell addSubview:searchButton];
- cell = [[[CellTextField alloc] initWithFrame:CGRectZero reuseIdentifier:identifier forButton:YES] autorelease];
- //searchButton.frame = CGRectMake(0.0, 0.0, 100.0, 35.0);
- UIImage *buttonBackgroundPressed = [UIImage imageNamed:@"whiteButton.png"];
- UIImage *buttonBackground = [UIImage imageNamed:@"blueButton.png"];
- self.searchButton = [CreateCustomButton buttonWithTitle:@"SEARCH"
- target:self
- selector:@selector(startSearching:)
- frame: CGRectMake(10.0, 0.0, 280.0,35.0)
- image:buttonBackground
- imagePressed:buttonBackgroundPressed
- darkTextColor:NO];
- self.searchButton.contentVerticalAlignment = UIControlContentVerticalAlignmentFill;
- [cell.contentView addSubview:self.searchButton];
- cell.backgroundColor = [UIColor clearColor];
- //((CellTextField *)cell).backgroundColor = [UIColor clearColor];
- }
- else
- if (indexPath.section==PARAM_SECTION)
- {
- //[cell setText:[[[AdvanceSearchDataSource sharedAdvanceSearchDataSource] paramNames] objectAtIndex:indexPath.row]];
- cell.contentView.center = CGPointMake(50.0, 10.0);
- [cell.textLabel setFont: [UIFont fontWithName:@"Arial-BoldMT" size:15.0f]];
- //[cell.textLabel setFont: [UIFont boldSystemFontOfSize:16.0f]];
- cell.textLabel.text = [self getRowText:indexPath.row];
- int pos;// = [cell.textLabel.text rangeOfString:@" "].location;
- if (![cell.textLabel.text isEqual:@"Type"] && ![cell.textLabel.text isEqual:@"Part"] && ![cell.textLabel.text isEqual:@"Rating"] && ![cell.textLabel.text isEqual:@"Difficulty"] && ![cell.textLabel.text isEqual:@"Tuning"])
- pos = 0;
- else
- pos = 1;
- //if ([[aTableView cellForRowAtIndexPath:indexPath] accessoryType] == UITableViewCellAccessoryDisclosureIndicator)
- ////if ([[aTableView cellForRowAtIndexPath:indexPath] accessoryType] != UITableViewCellAccessoryNone || [[aTableView cellForRowAtIndexPath:indexPath] accessoryType] != UITableViewCellAccessoryCheckmark)
- if ([self paramValueExistsAtIndex:indexPath.row] && self.activeParamsIndex == -1)
- {
- if ([self paramValueExistsAtIndex:2] && indexPath.row == 2) // If there is a rating we draw stars on the first cell
- {
- [self setStars:cell atIndex:indexPath.row];
- }
- else
- {
- [self setLabels:cell atIndex:indexPath.row]; // For others we write the text
- }
- }
- /*if ([self paramValueExistsAtIndex:0] && [[aTableView cellForRowAtIndexPath:indexPath] accessoryType] == UITableViewCellAccessoryDisclosureIndicator)
- {
- [self setLabels:cell atIndex:0];
- }*/
- if (self.activeParamsIndex == 2 && (indexPath.row >= 3 && indexPath.row <= 7))
- {
- [self setImages:cell atIndex:indexPath.row];
- }
- if ([self paramValueExistsAtIndex:indexPath.row])
- {
- //CGColorSpaceRef rgb = CGColorSpaceCreateDeviceRGB();
- //const CGFloat myColor[] = {0.0, 0.32, 0.96, 1.0};
- [cell.textLabel setTextColor:[UIColor colorWithRed:189.0/255.0 green:213.0/255.0 blue:253.0/255.0 alpha:1.0]];//[[[UIColor alloc] initWithCGColor:CGColorCreate(rgb, myColor)] autorelease];
- //CGColorSpaceRelease(rgb);
- }
- else
- {
- //cell.textColor = [UIColor blackColor];
- [cell.textLabel setTextColor:[UIColor colorWithRed:189.0/255.0 green:213.0/255.0 blue:253.0/255.0 alpha:1.0]];
- }
- if (pos == 0)
- {
- //rowH = 25.0;
- //aTableView.rowHeight = 25.0;
- //NSLog(@"ROW HEIGHT: %f", aTableView.rowHeight);
- UIImageView *imgView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"bg_cell_filter_item.png"]];
- cell.backgroundView = imgView;
- [imgView release];
- UIImageView *imgView1 = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"bg_cell_filter_item_act.png"]];
- cell.selectedBackgroundView = imgView1;
- [imgView1 release];
- if (self.activeParamsIndex == 0)
- {
- if (indexPath.row == 1)
- {
- if (![[typeMenu objectAtIndex:0] isEqualToString:@"1"]) [cell setAccessoryType:UITableViewCellAccessoryNone];
- else
- {
- [cell setAccessoryType:UITableViewCellAccessoryCheckmark];
- cell.textLabel.textColor = [UIColor whiteColor];
- UIImageView *imgView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"checkbox.png"]];
- cell.accessoryView = imgView;
- [imgView release];
- }
- UIImageView *imgView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"bg_cell_filter_shadow.png"]];
- cell.backgroundView = imgView;
- [imgView release];
- UIImageView *imgView1 = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"bg_cell_filter_shadow_act.png"]];
- cell.selectedBackgroundView = imgView1;
- [imgView1 release];
- }
- else
- if (indexPath.row == 2)
- {
- if (![[typeMenu objectAtIndex:1] isEqualToString:@"1"]) [cell setAccessoryType:UITableViewCellAccessoryNone];
- else
- {
- [cell setAccessoryType:UITableViewCellAccessoryCheckmark];
- cell.textLabel.textColor = [UIColor whiteColor];
- UIImageView *imgView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"checkbox.png"]];
- cell.accessoryView = imgView;
- [imgView release];
- }
- }
- else
- if (indexPath.row == 3)
- {
- if (![[typeMenu objectAtIndex:2] isEqualToString:@"1"]) [cell setAccessoryType:UITableViewCellAccessoryNone];
- else
- {
- [cell setAccessoryType:UITableViewCellAccessoryCheckmark];
- cell.textLabel.textColor = [UIColor whiteColor];
- UIImageView *imgView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"checkbox.png"]];
- cell.accessoryView = imgView;
- [imgView release];
- }
- }
- }
- else
- if (self.activeParamsIndex == 1)
- {
- if (indexPath.row == 2)
- {
- if (![[partMenu objectAtIndex:0] isEqualToString:@"1"]) [cell setAccessoryType:UITableViewCellAccessoryNone];
- else
- {
- [cell setAccessoryType:UITableViewCellAccessoryCheckmark];
- cell.textLabel.textColor = [UIColor whiteColor];
- UIImageView *imgView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"checkbox.png"]];
- cell.accessoryView = imgView;
- [imgView release];
- }
- UIImageView *imgView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"bg_cell_filter_shadow.png"]];
- cell.backgroundView = imgView;
- [imgView release];
- UIImageView *imgView1 = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"bg_cell_filter_shadow_act.png"]];
- cell.selectedBackgroundView = imgView1;
- [imgView1 release];
- }
- else
- if (indexPath.row == 3)
- {
- if (![[partMenu objectAtIndex:1] isEqualToString:@"1"]) [cell setAccessoryType:UITableViewCellAccessoryNone];
- else
- {
- [cell setAccessoryType:UITableViewCellAccessoryCheckmark];
- cell.textLabel.textColor = [UIColor whiteColor];
- UIImageView *imgView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"checkbox.png"]];
- cell.accessoryView = imgView;
- [imgView release];
- }
- }
- else
- if (indexPath.row == 4)
- {
- if (![[partMenu objectAtIndex:2] isEqualToString:@"1"]) [cell setAccessoryType:UITableViewCellAccessoryNone];
- else
- {
- [cell setAccessoryType:UITableViewCellAccessoryCheckmark];
- cell.textLabel.textColor = [UIColor whiteColor];
- UIImageView *imgView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"checkbox.png"]];
- cell.accessoryView = imgView;
- [imgView release];
- }
- }
- else
- if (indexPath.row == 5)
- {
- if (![[partMenu objectAtIndex:3] isEqualToString:@"1"]) [cell setAccessoryType:UITableViewCellAccessoryNone];
- else
- {
- [cell setAccessoryType:UITableViewCellAccessoryCheckmark];
- cell.textLabel.textColor = [UIColor whiteColor];
- UIImageView *imgView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"checkbox.png"]];
- cell.accessoryView = imgView;
- [imgView release];
- }
- }
- }
- else
- if (self.activeParamsIndex == 2)
- {
- if (indexPath.row == 3)
- {
- if (![[ratingMenu objectAtIndex:0] isEqualToString:@"1"]) [cell setAccessoryType:UITableViewCellAccessoryNone];
- else
- {
- [cell setAccessoryType:UITableViewCellAccessoryCheckmark];
- cell.textLabel.textColor = [UIColor whiteColor];
- UIImageView *imgView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"checkbox.png"]];
- cell.accessoryView = imgView;
- [imgView release];
- }
- UIImageView *imgView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"bg_cell_filter_shadow.png"]];
- cell.backgroundView = imgView;
- [imgView release];
- UIImageView *imgView1 = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"bg_cell_filter_shadow_act.png"]];
- cell.selectedBackgroundView = imgView1;
- [imgView1 release];
- }
- else
- if (indexPath.row == 4)
- {
- if (![[ratingMenu objectAtIndex:1] isEqualToString:@"1"]) [cell setAccessoryType:UITableViewCellAccessoryNone];
- else
- {
- [cell setAccessoryType:UITableViewCellAccessoryCheckmark];
- cell.textLabel.textColor = [UIColor whiteColor];
- UIImageView *imgView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"checkbox.png"]];
- cell.accessoryView = imgView;
- [imgView release];
- }
- }
- else
- if (indexPath.row == 5)
- {
- if (![[ratingMenu objectAtIndex:2] isEqualToString:@"1"]) [cell setAccessoryType:UITableViewCellAccessoryNone];
- else
- {
- [cell setAccessoryType:UITableViewCellAccessoryCheckmark];
- cell.textLabel.textColor = [UIColor whiteColor];
- UIImageView *imgView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"checkbox.png"]];
- cell.accessoryView = imgView;
- [imgView release];
- }
- }
- else
- if (indexPath.row == 6)
- {
- if (![[ratingMenu objectAtIndex:3] isEqualToString:@"1"]) [cell setAccessoryType:UITableViewCellAccessoryNone];
- else
- {
- [cell setAccessoryType:UITableViewCellAccessoryCheckmark];
- cell.textLabel.textColor = [UIColor whiteColor];
- UIImageView *imgView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"checkbox.png"]];
- cell.accessoryView = imgView;
- [imgView release];
- }
- }
- else
- if (indexPath.row == 7)
- {
- if (![[ratingMenu objectAtIndex:4] isEqualToString:@"1"]) [cell setAccessoryType:UITableViewCellAccessoryNone];
- else
- {
- [cell setAccessoryType:UITableViewCellAccessoryCheckmark];
- cell.textLabel.textColor = [UIColor whiteColor];
- UIImageView *imgView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"checkbox.png"]];
- cell.accessoryView = imgView;
- [imgView release];
- }
- }
- }
- else
- if (self.activeParamsIndex == 3)
- {
- if (indexPath.row == 4)
- {
- if (![[difficultyLevelMenu objectAtIndex:0] isEqualToString:@"1"]) [cell setAccessoryType:UITableViewCellAccessoryNone];
- else
- {
- [cell setAccessoryType:UITableViewCellAccessoryCheckmark];
- cell.textLabel.textColor = [UIColor whiteColor];
- UIImageView *imgView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"checkbox.png"]];
- cell.accessoryView = imgView;
- [imgView release];
- }
- UIImageView *imgView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"bg_cell_filter_shadow.png"]];
- cell.backgroundView = imgView;
- [imgView release];
- UIImageView *imgView1 = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"bg_cell_filter_shadow_act.png"]];
- cell.selectedBackgroundView = imgView1;
- [imgView1 release];
- }
- else
- if (indexPath.row == 5)
- {
- if (![[difficultyLevelMenu objectAtIndex:1] isEqualToString:@"1"]) [cell setAccessoryType:UITableViewCellAccessoryNone];
- else
- {
- [cell setAccessoryType:UITableViewCellAccessoryCheckmark];
- cell.textLabel.textColor = [UIColor whiteColor];
- UIImageView *imgView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"checkbox.png"]];
- cell.accessoryView = imgView;
- [imgView release];
- }
- }
- else
- if (indexPath.row == 6)
- {
- if (![[difficultyLevelMenu objectAtIndex:2] isEqualToString:@"1"]) [cell setAccessoryType:UITableViewCellAccessoryNone];
- else
- {
- [cell setAccessoryType:UITableViewCellAccessoryCheckmark];
- cell.textLabel.textColor = [UIColor whiteColor];
- UIImageView *imgView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"checkbox.png"]];
- cell.accessoryView = imgView;
- [imgView release];
- }
- }
- }
- else
- if (self.activeParamsIndex == 4)
- {
- if (indexPath.row == 5)
- {
- if (![[tuningMenu objectAtIndex:0] isEqualToString:@"1"]) [cell setAccessoryType:UITableViewCellAccessoryNone];
- else
- {
- [cell setAccessoryType:UITableViewCellAccessoryCheckmark];
- cell.textLabel.textColor = [UIColor whiteColor];
- UIImageView *imgView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"checkbox.png"]];
- cell.accessoryView = imgView;
- [imgView release];
- }
- UIImageView *imgView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"bg_cell_filter_shadow.png"]];
- cell.backgroundView = imgView;
- [imgView release];
- UIImageView *imgView1 = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"bg_cell_filter_shadow_act.png"]];
- cell.selectedBackgroundView = imgView1;
- [imgView1 release];
- }
- else
- if (indexPath.row == 6)
- {
- if (![[tuningMenu objectAtIndex:1] isEqualToString:@"1"]) [cell setAccessoryType:UITableViewCellAccessoryNone];
- else
- {
- [cell setAccessoryType:UITableViewCellAccessoryCheckmark];
- cell.textLabel.textColor = [UIColor whiteColor];
- UIImageView *imgView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"checkbox.png"]];
- cell.accessoryView = imgView;
- [imgView release];
- }
- }
- else
- if (indexPath.row == 7)
- {
- if (![[tuningMenu objectAtIndex:2] isEqualToString:@"1"]) [cell setAccessoryType:UITableViewCellAccessoryNone];
- else
- {
- [cell setAccessoryType:UITableViewCellAccessoryCheckmark];
- cell.textLabel.textColor = [UIColor whiteColor];
- UIImageView *imgView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"checkbox.png"]];
- cell.accessoryView = imgView;
- [imgView release];
- }
- }
- else
- if (indexPath.row == 8)
- {
- if (![[tuningMenu objectAtIndex:3] isEqualToString:@"1"]) [cell setAccessoryType:UITableViewCellAccessoryNone];
- else
- {
- [cell setAccessoryType:UITableViewCellAccessoryCheckmark];
- cell.textLabel.textColor = [UIColor whiteColor];
- UIImageView *imgView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"checkbox.png"]];
- cell.accessoryView = imgView;
- [imgView release];
- }
- }
- else
- if (indexPath.row == 9)
- {
- if (![[tuningMenu objectAtIndex:4] isEqualToString:@"1"]) [cell setAccessoryType:UITableViewCellAccessoryNone];
- else
- {
- [cell setAccessoryType:UITableViewCellAccessoryCheckmark];
- cell.textLabel.textColor = [UIColor whiteColor];
- UIImageView *imgView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"checkbox.png"]];
- cell.accessoryView = imgView;
- [imgView release];
- }
- }
- else
- if (indexPath.row == 10)
- {
- if (![[tuningMenu objectAtIndex:5] isEqualToString:@"1"]) [cell setAccessoryType:UITableViewCellAccessoryNone];
- else
- {
- [cell setAccessoryType:UITableViewCellAccessoryCheckmark];
- cell.textLabel.textColor = [UIColor whiteColor];
- UIImageView *imgView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"checkbox.png"]];
- cell.accessoryView = imgView;
- [imgView release];
- }
- }
- else
- if (indexPath.row == 11)
- {
- if (![[tuningMenu objectAtIndex:6] isEqualToString:@"1"]) [cell setAccessoryType:UITableViewCellAccessoryNone];
- else
- {
- [cell setAccessoryType:UITableViewCellAccessoryCheckmark];
- cell.textLabel.textColor = [UIColor whiteColor];
- UIImageView *imgView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"checkbox.png"]];
- cell.accessoryView = imgView;
- [imgView release];
- }
- }
- else
- if (indexPath.row == 12)
- {
- if (![[tuningMenu objectAtIndex:7] isEqualToString:@"1"]) [cell setAccessoryType:UITableViewCellAccessoryNone];
- else
- {
- [cell setAccessoryType:UITableViewCellAccessoryCheckmark];
- cell.textLabel.textColor = [UIColor whiteColor];
- UIImageView *imgView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"checkbox.png"]];
- cell.accessoryView = imgView;
- [imgView release];
- }
- }
- else
- if (indexPath.row == 13)
- {
- if (![[tuningMenu objectAtIndex:8] isEqualToString:@"1"]) [cell setAccessoryType:UITableViewCellAccessoryNone];
- else
- {
- [cell setAccessoryType:UITableViewCellAccessoryCheckmark];
- cell.textLabel.textColor = [UIColor whiteColor];
- UIImageView *imgView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"checkbox.png"]];
- cell.accessoryView = imgView;
- [imgView release];
- }
- }
- else
- if (indexPath.row == 14)
- {
- if (![[tuningMenu objectAtIndex:9] isEqualToString:@"1"]) [cell setAccessoryType:UITableViewCellAccessoryNone];
- else
- {
- [cell setAccessoryType:UITableViewCellAccessoryCheckmark];
- cell.textLabel.textColor = [UIColor whiteColor];
- UIImageView *imgView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"checkbox.png"]];
- cell.accessoryView = imgView;
- [imgView release];
- }
- }
- else
- if (indexPath.row == 15)
- {
- if (![[tuningMenu objectAtIndex:10] isEqualToString:@"1"]) [cell setAccessoryType:UITableViewCellAccessoryNone];
- else
- {
- [cell setAccessoryType:UITableViewCellAccessoryCheckmark];
- cell.textLabel.textColor = [UIColor whiteColor];
- UIImageView *imgView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"checkbox.png"]];
- cell.accessoryView = imgView;
- [imgView release];
- }
- }
- else
- if (indexPath.row == 16)
- {
- if (![[tuningMenu objectAtIndex:11] isEqualToString:@"1"]) [cell setAccessoryType:UITableViewCellAccessoryNone];
- else
- {
- [cell setAccessoryType:UITableViewCellAccessoryCheckmark];
- cell.textLabel.textColor = [UIColor whiteColor];
- UIImageView *imgView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"checkbox.png"]];
- cell.accessoryView = imgView;
- [imgView release];
- }
- }
- else
- if (indexPath.row == 17)
- {
- if (![[tuningMenu objectAtIndex:12] isEqualToString:@"1"]) [cell setAccessoryType:UITableViewCellAccessoryNone];
- else
- {
- [cell setAccessoryType:UITableViewCellAccessoryCheckmark];
- cell.textLabel.textColor = [UIColor whiteColor];
- UIImageView *imgView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"checkbox.png"]];
- cell.accessoryView = imgView;
- [imgView release];
- }
- }
- else
- if (indexPath.row == 18)
- {
- if (![[tuningMenu objectAtIndex:13] isEqualToString:@"1"]) [cell setAccessoryType:UITableViewCellAccessoryNone];
- else
- {
- [cell setAccessoryType:UITableViewCellAccessoryCheckmark];
- cell.textLabel.textColor = [UIColor whiteColor];
- UIImageView *imgView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"checkbox.png"]];
- cell.accessoryView = imgView;
- [imgView release];
- }
- }
- else
- if (indexPath.row == 19)
- {
- if (![[tuningMenu objectAtIndex:14] isEqualToString:@"1"]) [cell setAccessoryType:UITableViewCellAccessoryNone];
- else
- {
- [cell setAccessoryType:UITableViewCellAccessoryCheckmark];
- cell.textLabel.textColor = [UIColor whiteColor];
- UIImageView *imgView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"checkbox.png"]];
- cell.accessoryView = imgView;
- [imgView release];
- }
- }
- }
- cell.backgroundColor = [UIColor clearColor];
- if ([[aTableView cellForRowAtIndexPath:indexPath] accessoryType] == UITableViewCellAccessoryNone)
- {
- if (![cell.textLabel.textColor isEqual:[UIColor whiteColor]])
- [cell.textLabel setTextColor:[UIColor colorWithRed:121.0/255.0 green:154.0/255.0 blue:236.0/255.0 alpha:1.0]];
- }
- cell.textLabel.font = [UIFont fontWithName:@"Arial-BoldMT" size:15];
- cell.textLabel.textColor = [UIColor colorWithRed:189.0/255.0 green:213.0/255.0 blue:253.0/255.0 alpha:1.0];
- }
- else
- {
- //rowH = 42.0;
- //aTableView.rowHeight = 42.0;
- cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
- cell.backgroundColor = [UIColor clearColor];
- UIImageView *imgView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"bg_cell_filter.png"]];
- cell.backgroundView = imgView;
- [imgView release];
- UIImageView *imgView1 = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"bg_cell_filter.png"]];
- cell.selectedBackgroundView = imgView1;
- [imgView1 release];
- cell.textLabel.textColor = [UIColor whiteColor];
- if ((self.activeParamsIndex == 0 && indexPath.row == 0) || (self.activeParamsIndex == 1 && indexPath.row == 1) || (self.activeParamsIndex == 2 && indexPath.row == 2) || (self.activeParamsIndex == 3 && indexPath.row == 3) || (self.activeParamsIndex == 4 && indexPath.row == 4))
- {
- CGRect frame = CGRectMake(20, 20, 30, 30);
- UIView *v = [[UIView alloc] initWithFrame:frame];
- CGRect accessoryCustomFrame = CGRectMake(5, 4, 30, 30);
- UILabel *accessoryCustomView = [[UILabel alloc] initWithFrame:accessoryCustomFrame];
- accessoryCustomView.backgroundColor = [UIColor clearColor];
- accessoryCustomView.font = [UIFont fontWithName:@"CourierNewPS-BoldMT" size:26];
- accessoryCustomView.textColor = [UIColor colorWithRed:255.0/255.0 green:198.0/255.0 blue:0.0/255.0 alpha:1.0];
- accessoryCustomView.highlightedTextColor = [UIColor whiteColor];
- accessoryCustomView.textAlignment = UITextAlignmentCenter;
- accessoryCustomView.text = @"^";
- [v addSubview:accessoryCustomView];
- [accessoryCustomView release];
- cell.accessoryView = v;
- [v release];
- }
- else
- {
- CGRect frame = CGRectMake(20, 20, 30, 30);
- UIView *v = [[UIView alloc] initWithFrame:frame];
- CGRect accessoryCustomFrame = CGRectMake(5, -4, 30, 30);
- UILabel *accessoryCustomView = [[UILabel alloc] initWithFrame:accessoryCustomFrame];
- accessoryCustomView.backgroundColor = [UIColor clearColor];
- accessoryCustomView.font = [UIFont fontWithName:@"CourierNewPS-BoldMT" size:26];
- accessoryCustomView.textColor = [UIColor colorWithRed:255.0/255.0 green:198.0/255.0 blue:0.0/255.0 alpha:1.0];
- accessoryCustomView.highlightedTextColor = [UIColor whiteColor];
- accessoryCustomView.textAlignment = UITextAlignmentCenter;
- accessoryCustomView.text = @"^";
- accessoryCustomView.transform = CGAffineTransformMakeRotation(1.0*M_PI);
- [v addSubview:accessoryCustomView];
- [accessoryCustomView release];
- cell.accessoryView = v;
- [v release];
- }
- }
- }
- else
- {
- if (indexPath.section==0)
- {
- cell = [[[CellTextField alloc] initWithFrame:CGRectZero reuseIdentifier:identifier forButton:NO] autorelease];
- [cell.contentView addSubview:bandNameTextField];
- cell.backgroundColor = [UIColor clearColor];
- //((CellTextField *)cell).view = bandNameTextField;
- //((CellTextField *)cell).backgroundColor = [UIColor clearColor];
- }
- else
- if (indexPath.section==1)
- {
- cell = [[[CellTextField alloc] initWithFrame:CGRectZero reuseIdentifier:identifier forButton:NO] autorelease];
- [cell.contentView addSubview:songNameTextField];
- cell.backgroundColor = [UIColor clearColor];
- //((CellTextField *)cell).view = songNameTextField;
- //((CellTextField *)cell).backgroundColor = [UIColor clearColor];
- }
- }
- return cell;
- }
- -(BOOL)paramValueExistsAtIndex:(int)rowIndex
- {
- if (rowIndex == 0)
- {
- for (int i=0; i<[typeMenu count]; i++)
- if ([[typeMenu objectAtIndex:i] isEqualToString:@"1"])
- return YES;
- }
- else
- if (rowIndex == 1)
- {
- for (int i=0; i<[partMenu count]; i++)
- if ([[partMenu objectAtIndex:i] isEqualToString:@"1"])
- return YES;
- }
- else
- if (rowIndex == 2)
- {
- for (int i=0; i<[ratingMenu count]; i++)
- if ([[ratingMenu objectAtIndex:i] isEqualToString:@"1"])
- return YES;
- }
- else
- if (rowIndex == 3)
- {
- for (int i=0; i<[difficultyLevelMenu count]; i++)
- if ([[difficultyLevelMenu objectAtIndex:i] isEqualToString:@"1"])
- return YES;
- }
- else
- if (rowIndex == 4)
- {
- for (int i=0; i<[tuningMenu count]; i++)
- if ([[tuningMenu objectAtIndex:i] isEqualToString:@"1"])
- return YES;
- }
- return NO;
- }
- #pragma mark UITableViewDelegateMethods
- - (void) deselect
- {
- [self.myTableView deselectRowAtIndexPath:[self.myTableView indexPathForSelectedRow] animated:YES];
- }
- ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
- ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
- ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
- -(void) tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
- {
- selectedIndex = indexPath;
- if (indexPath.section==PARAM_SECTION)
- {
- /*if ([[tableView cellForRowAtIndexPath:indexPath] accessoryType] == UITableViewCellAccessoryDisclosureIndicator)
- {
- if (self.activeParamsIndex == 0)
- }*/
- if ([[tableView cellForRowAtIndexPath:indexPath] accessoryType] == UITableViewCellAccessoryNone)
- {
- [[tableView cellForRowAtIndexPath:indexPath] setAccessoryType:UITableViewCellAccessoryCheckmark];
- [self performSelector:@selector(deselect) withObject:nil afterDelay:0.02f];
- NSLog(@"SELECT");
- if (self.activeParamsIndex == 0)
- {
- if (indexPath.row == 1)
- [typeMenu replaceObjectAtIndex:0 withObject:@"1"];
- else
- if (indexPath.row == 2)
- [typeMenu replaceObjectAtIndex:1 withObject:@"1"];
- else
- if (indexPath.row == 3)
- [typeMenu replaceObjectAtIndex:2 withObject:@"1"];
- [self reloadType:tableView];
- }
- else
- if (self.activeParamsIndex == 1)
- {
- if (indexPath.row == 2)
- [partMenu replaceObjectAtIndex:0 withObject:@"1"];
- else
- if (indexPath.row == 3)
- [partMenu replaceObjectAtIndex:1 withObject:@"1"];
- else
- if (indexPath.row == 4)
- [partMenu replaceObjectAtIndex:2 withObject:@"1"];
- else
- if (indexPath.row == 5)
- [partMenu replaceObjectAtIndex:3 withObject:@"1"];
- [self reloadPart:tableView];
- }
- else
- if (self.activeParamsIndex == 2)
- {
- if (indexPath.row == 2)
- [ratingMenu replaceObjectAtIndex:0 withObject:@"1"];
- else
- if (indexPath.row == 3)
- [ratingMenu replaceObjectAtIndex:1 withObject:@"1"];
- else
- if (indexPath.row == 4)
- [ratingMenu replaceObjectAtIndex:2 withObject:@"1"];
- else
- if (indexPath.row == 5)
- [ratingMenu replaceObjectAtIndex:3 withObject:@"1"];
- else
- if (indexPath.row ==6)
- [ratingMenu replaceObjectAtIndex:4 withObject:@"1"];
- [self reloadRating:tableView];
- }
- else
- if (self.activeParamsIndex == 3)
- {
- if (indexPath.row == 4)
- [difficultyLevelMenu replaceObjectAtIndex:0 withObject:@"1"];
- else
- if (indexPath.row == 5)
- [difficultyLevelMenu replaceObjectAtIndex:1 withObject:@"1"];
- else
- if (indexPath.row == 6)
- [difficultyLevelMenu replaceObjectAtIndex:2 withObject:@"1"];
- [self reloadLevel:tableView];
- }
- else
- if (self.activeParamsIndex == 4)
- {
- if (indexPath.row == 5)
- [tuningMenu replaceObjectAtIndex:0 withObject:@"1"];
- else
- if (indexPath.row == 6)
- [tuningMenu replaceObjectAtIndex:1 withObject:@"1"];
- else
- if (indexPath.row == 7)
- [tuningMenu replaceObjectAtIndex:2 withObject:@"1"];
- else
- if (indexPath.row == 8)
- [tuningMenu replaceObjectAtIndex:3 withObject:@"1"];
- else
- if (indexPath.row == 9)
- [tuningMenu replaceObjectAtIndex:4 withObject:@"1"];
- else
- if (indexPath.row == 10)
- [tuningMenu replaceObjectAtIndex:5 withObject:@"1"];
- else
- if (indexPath.row == 11)
- [tuningMenu replaceObjectAtIndex:6 withObject:@"1"];
- else
- if (indexPath.row == 12)
- [tuningMenu replaceObjectAtIndex:7 withObject:@"1"];
- else
- if (indexPath.row == 13)
- [tuningMenu replaceObjectAtIndex:8 withObject:@"1"];
- else
- if (indexPath.row == 14)
- [tuningMenu replaceObjectAtIndex:9 withObject:@"1"];
- else
- if (indexPath.row == 15)
- [tuningMenu replaceObjectAtIndex:10 withObject:@"1"];
- else
- if (indexPath.row == 16)
- [tuningMenu replaceObjectAtIndex:11 withObject:@"1"];
- else
- if (indexPath.row == 17)
- [tuningMenu replaceObjectAtIndex:12 withObject:@"1"];
- else
- if (indexPath.row == 18)
- [tuningMenu replaceObjectAtIndex:13 withObject:@"1"];
- else
- if (indexPath.row == 19)
- [tuningMenu replaceObjectAtIndex:14 withObject:@"1"];
- [self reloadTuning:tableView];
- } //if (self.activeParamsIndex == 4)
- }
- else
- if ([[tableView cellForRowAtIndexPath:indexPath] accessoryType] == UITableViewCellAccessoryCheckmark)
- {
- [[tableView cellForRowAtIndexPath:indexPath] setAccessoryType:UITableViewCellAccessoryNone];
- [self performSelector:@selector(deselect) withObject:nil afterDelay:0.02f];
- if (self.activeParamsIndex == 0)
- {
- if (indexPath.row == 1)
- [typeMenu replaceObjectAtIndex:0 withObject:@"0"];
- else
- if (indexPath.row == 2)
- [typeMenu replaceObjectAtIndex:1 withObject:@"0"];
- else
- if (indexPath.row == 3)
- [typeMenu replaceObjectAtIndex:2 withObject:@"0"];
- [self reloadType:tableView];
- }
- else
- if (self.activeParamsIndex == 1)
- {
- if (indexPath.row == 2)
- [partMenu replaceObjectAtIndex:0 withObject:@"0"];
- else
- if (indexPath.row == 3)
- [partMenu replaceObjectAtIndex:1 withObject:@"0"];
- else
- if (indexPath.row == 4)
- [partMenu replaceObjectAtIndex:2 withObject:@"0"];
- else
- if (indexPath.row == 5)
- [partMenu replaceObjectAtIndex:3 withObject:@"0"];
- [self reloadPart:tableView];
- }
- else
- if (self.activeParamsIndex == 2)
- {
- if (indexPath.row == 2)
- [ratingMenu replaceObjectAtIndex:0 withObject:@"0"];
- else
- if (indexPath.row == 3)
- [ratingMenu replaceObjectAtIndex:1 withObject:@"0"];
- else
- if (indexPath.row == 4)
- [ratingMenu replaceObjectAtIndex:2 withObject:@"0"];
- else
- if (indexPath.row == 5)
- [ratingMenu replaceObjectAtIndex:3 withObject:@"0"];
- else
- if (indexPath.row ==6)
- [ratingMenu replaceObjectAtIndex:4 withObject:@"0"];
- [self reloadRating:tableView];
- }
- else
- if (self.activeParamsIndex == 3)
- {
- if (indexPath.row == 4)
- [difficultyLevelMenu replaceObjectAtIndex:0 withObject:@"0"];
- else
- if (indexPath.row == 5)
- [difficultyLevelMenu replaceObjectAtIndex:1 withObject:@"0"];
- else
- if (indexPath.row == 6)
- [difficultyLevelMenu replaceObjectAtIndex:2 withObject:@"0"];
- [self reloadLevel:tableView];
- }
- else
- if (self.activeParamsIndex == 4)
- {
- if (indexPath.row == 5)
- [tuningMenu replaceObjectAtIndex:0 withObject:@"0"];
- else
- if (indexPath.row == 6)
- [tuningMenu replaceObjectAtIndex:1 withObject:@"0"];
- else
- if (indexPath.row == 7)
- [tuningMenu replaceObjectAtIndex:2 withObject:@"0"];
- else
- if (indexPath.row == 8)
- [tuningMenu replaceObjectAtIndex:3 withObject:@"0"];
- else
- if (indexPath.row == 9)
- [tuningMenu replaceObjectAtIndex:4 withObject:@"0"];
- else
- if (indexPath.row == 10)
- [tuningMenu replaceObjectAtIndex:5 withObject:@"0"];
- else
- if (indexPath.row == 11)
- [tuningMenu replaceObjectAtIndex:6 withObject:@"0"];
- else
- if (indexPath.row == 12)
- [tuningMenu replaceObjectAtIndex:7 withObject:@"0"];
- else
- if (indexPath.row == 13)
- [tuningMenu replaceObjectAtIndex:8 withObject:@"0"];
- else
- if (indexPath.row == 14)
- [tuningMenu replaceObjectAtIndex:9 withObject:@"0"];
- else
- if (indexPath.row == 15)
- [tuningMenu replaceObjectAtIndex:10 withObject:@"0"];
- else
- if (indexPath.row == 16)
- [tuningMenu replaceObjectAtIndex:11 withObject:@"0"];
- else
- if (indexPath.row == 17)
- [tuningMenu replaceObjectAtIndex:12 withObject:@"0"];
- else
- if (indexPath.row == 18)
- [tuningMenu replaceObjectAtIndex:13 withObject:@"0"];
- else
- if (indexPath.row == 19)
- [tuningMenu replaceObjectAtIndex:14 withObject:@"0"];
- [self reloadTuning:tableView];
- } //if (self.activeParamsIndex == 4)
- }
- if (self.activeParamsIndex == -1)
- {
- if (indexPath.row == 0)
- {
- self.activeParamsIndex = 0;
- [SharedElements sharedSharedElements].activeParamsIndex = 0;
- if ([advParams count] != 0)
- {
- [advParams insertObject:[[AdvanceSearchDataSource sharedAdvanceSearchDataSource].typeParams objectAtIndex:0] atIndex:1];
- [advParams insertObject:[[AdvanceSearchDataSource sharedAdvanceSearchDataSource].typeParams objectAtIndex:1] atIndex:2];
- [advParams insertObject:[[AdvanceSearchDataSource sharedAdvanceSearchDataSource].typeParams objectAtIndex:2] atIndex:3];
- NSArray *insertIndexPaths = [NSArray arrayWithObjects:
- [NSIndexPath indexPathForRow:1 inSection:3],
- [NSIndexPath indexPathForRow:2 inSection:3],
- [NSIndexPath indexPathForRow:3 inSection:3],
- nil];
- [self.myTableView beginUpdates];
- [self.myTableView insertRowsAtIndexPaths:insertIndexPaths withRowAnimation:UITableViewRowAnimationFade];
- [self.myTableView endUpdates];
- [self reloadType:tableView];
- }
- }
- else
- if (indexPath.row == 1)
- {
- self.activeParamsIndex = 1;
- [SharedElements sharedSharedElements].activeParamsIndex = 1;
- if ([advParams count] != 0)
- {
- [advParams insertObject:[[AdvanceSearchDataSource sharedAdvanceSearchDataSource].type2Params objectAtIndex:0] atIndex:2];
- [advParams insertObject:[[AdvanceSearchDataSource sharedAdvanceSearchDataSource].type2Params objectAtIndex:1] atIndex:3];
- [advParams insertObject:[[AdvanceSearchDataSource sharedAdvanceSearchDataSource].type2Params objectAtIndex:2] atIndex:4];
- [advParams insertObject:[[AdvanceSearchDataSource sharedAdvanceSearchDataSource].type2Params objectAtIndex:3] atIndex:5];
- NSArray *insertIndexPaths = [NSArray arrayWithObjects:
- [NSIndexPath indexPathForRow:2 inSection:3],
- [NSIndexPath indexPathForRow:3 inSection:3],
- [NSIndexPath indexPathForRow:4 inSection:3],
- [NSIndexPath indexPathForRow:5 inSection:3],
- nil];
- [self.myTableView beginUpdates];
- [self.myTableView insertRowsAtIndexPaths:insertIndexPaths withRowAnimation:UITableViewRowAnimationFade];
- [self.myTableView endUpdates];
- [self reloadPart:tableView];
- }
- }
- else
- if (indexPath.row == 2)
- {
- self.activeParamsIndex = 2;
- [SharedElements sharedSharedElements].activeParamsIndex = 2;
- if ([advParams count] != 0)
- {
- [advParams insertObject:@" *****" atIndex:3];
- [advParams insertObject:@" ****" atIndex:4];
- [advParams insertObject:@" ***" atIndex:5];
- [advParams insertObject:@" **" atIndex:6];
- [advParams insertObject:@" *" atIndex:7];
- NSArray *insertIndexPaths = [NSArray arrayWithObjects:
- [NSIndexPath indexPathForRow:3 inSection:3],
- [NSIndexPath indexPathForRow:4 inSection:3],
- [NSIndexPath indexPathForRow:5 inSection:3],
- [NSIndexPath indexPathForRow:6 inSection:3],
- [NSIndexPath indexPathForRow:7 inSection:3],
- nil];
- [self.myTableView beginUpdates];
- [self.myTableView insertRowsAtIndexPaths:insertIndexPaths withRowAnimation:UITableViewRowAnimationFade];
- [self.myTableView endUpdates];
- [self reloadRating:tableView];
- }
- }
- else
- if (indexPath.row == 3)
- {
- self.activeParamsIndex = 3;
- [SharedElements sharedSharedElements].activeParamsIndex = 3;
- if ([advParams count] != 0)
- {
- [advParams insertObject:[[AdvanceSearchDataSource sharedAdvanceSearchDataSource].levelParams objectAtIndex:0] atIndex:4];
- [advParams insertObject:[[AdvanceSearchDataSource sharedAdvanceSearchDataSource].levelParams objectAtIndex:1] atIndex:5];
- [advParams insertObject:[[AdvanceSearchDataSource sharedAdvanceSearchDataSource].levelParams objectAtIndex:2] atIndex:6];
- NSArray *insertIndexPaths = [NSArray arrayWithObjects:
- [NSIndexPath indexPathForRow:4 inSection:3],
- [NSIndexPath indexPathForRow:5 inSection:3],
- [NSIndexPath indexPathForRow:6 inSection:3],
- nil];
- [self.myTableView beginUpdates];
- [self.myTableView insertRowsAtIndexPaths:insertIndexPaths withRowAnimation:UITableViewRowAnimationFade];
- [self.myTableView endUpdates];
- [self reloadLevel:tableView];
- }
- }
- else
- if (indexPath.row == 4)
- {
- self.activeParamsIndex = 4;
- [SharedElements sharedSharedElements].activeParamsIndex = 4;
- if ([advParams count] != 0)
- {
- [advParams insertObject:[[AdvanceSearchDataSource sharedAdvanceSearchDataSource].tuningParams objectAtIndex:0] atIndex:5];
- [advParams insertObject:[[AdvanceSearchDataSource sharedAdvanceSearchDataSource].tuningParams objectAtIndex:1] atIndex:6];
- [advParams insertObject:[[AdvanceSearchDataSource sharedAdvanceSearchDataSource].tuningParams objectAtIndex:2] atIndex:7];
- [advParams insertObject:[[AdvanceSearchDataSource sharedAdvanceSearchDataSource].tuningParams objectAtIndex:3] atIndex:8];
- [advParams insertObject:[[AdvanceSearchDataSource sharedAdvanceSearchDataSource].tuningParams objectAtIndex:4] atIndex:9];
- [advParams insertObject:[[AdvanceSearchDataSource sharedAdvanceSearchDataSource].tuningParams objectAtIndex:5] atIndex:10];
- [advParams insertObject:[[AdvanceSearchDataSource sharedAdvanceSearchDataSource].tuningParams objectAtIndex:6] atIndex:11];
- [advParams insertObject:[[AdvanceSearchDataSource sharedAdvanceSearchDataSource].tuningParams objectAtIndex:7] atIndex:12];
- [advParams insertObject:[[AdvanceSearchDataSource sharedAdvanceSearchDataSource].tuningParams objectAtIndex:8] atIndex:13];
- [advParams insertObject:[[AdvanceSearchDataSource sharedAdvanceSearchDataSource].tuningParams objectAtIndex:9] atIndex:14];
- [advParams insertObject:[[AdvanceSearchDataSource sharedAdvanceSearchDataSource].tuningParams objectAtIndex:10] atIndex:15];
- [advParams insertObject:[[AdvanceSearchDataSource sharedAdvanceSearchDataSource].tuningParams objectAtIndex:11] atIndex:16];
- [advParams insertObject:[[AdvanceSearchDataSource sharedAdvanceSearchDataSource].tuningParams objectAtIndex:12] atIndex:17];
- [advParams insertObject:[[AdvanceSearchDataSource sharedAdvanceSearchDataSource].tuningParams objectAtIndex:13] atIndex:18];
- [advParams insertObject:[[AdvanceSearchDataSource sharedAdvanceSearchDataSource].tuningParams objectAtIndex:14] atIndex:19];
- NSArray *insertIndexPaths = [NSArray arrayWithObjects:
- [NSIndexPath indexPathForRow:5 inSection:3],
- [NSIndexPath indexPathForRow:6 inSection:3],
- [NSIndexPath indexPathForRow:7 inSection:3],
- [NSIndexPath indexPathForRow:8 inSection:3],
- [NSIndexPath indexPathForRow:9 inSection:3],
- [NSIndexPath indexPathForRow:10 inSection:3],
- [NSIndexPath indexPathForRow:11 inSection:3],
- [NSIndexPath indexPathForRow:12 inSection:3],
- [NSIndexPath indexPathForRow:13 inSection:3],
- [NSIndexPath indexPathForRow:14 inSection:3],
- [NSIndexPath indexPathForRow:15 inSection:3],
- [NSIndexPath indexPathForRow:16 inSection:3],
- [NSIndexPath indexPathForRow:17 inSection:3],
- [NSIndexPath indexPathForRow:18 inSection:3],
- [NSIndexPath indexPathForRow:19 inSection:3],
- nil];
- [self.myTableView beginUpdates];
- [self.myTableView insertRowsAtIndexPaths:insertIndexPaths withRowAnimation:UITableViewRowAnimationFade];
- [self.myTableView endUpdates];
- [self reloadTuning:tableView];
- }
- }
- }
- else
- if (self.activeParamsIndex == 0)
- {
- if ([[tableView cellForRowAtIndexPath:indexPath] accessoryType] == UITableViewCellAccessoryDisclosureIndicator)
- {
- [advParams removeObjectAtIndex:3];
- [advParams removeObjectAtIndex:2];
- [advParams removeObjectAtIndex:1];
- NSArray *deleteIndexPaths = [NSArray arrayWithObjects:
- [NSIndexPath indexPathForRow:3 inSection:3],
- [NSIndexPath indexPathForRow:2 inSection:3],
- [NSIndexPath indexPathForRow:1 inSection:3],
- nil];
- [self.myTableView beginUpdates];
- [self.myTableView deleteRowsAtIndexPaths:deleteIndexPaths withRowAnimation:UITableViewRowAnimationFade];
- [self.myTableView endUpdates];
- self.activeParamsIndex = -1;
- [SharedElements sharedSharedElements].activeParamsIndex = -1;
- [self performSelector:@selector(reloadRows) withObject:nil afterDelay:1.0/40.0];
- [self.myTableView deselectRowAtIndexPath:indexPath animated:YES];
- if (indexPath.row == 4)
- ind = 1;
- else
- if (indexPath.row == 5)
- ind = 2;
- else
- if (indexPath.row == 6)
- ind = 3;
- else
- if (indexPath.row == 7)
- ind = 4;
- if (indexPath.row != 0)
- [self performSelector:@selector(expandByArrayNum) withObject:nil afterDelay:1.0/20.0];
- }
- }
- else
- if (self.activeParamsIndex == 1)
- {
- if ([[tableView cellForRowAtIndexPath:indexPath] accessoryType] == UITableViewCellAccessoryDisclosureIndicator)
- {
- [advParams removeObjectAtIndex:5];
- [advParams removeObjectAtIndex:4];
- [advParams removeObjectAtIndex:3];
- [advParams removeObjectAtIndex:2];
- NSArray *deleteIndexPaths = [NSArray arrayWithObjects:
- [NSIndexPath indexPathForRow:5 inSection:3],
- [NSIndexPath indexPathForRow:4 inSection:3],
- [NSIndexPath indexPathForRow:3 inSection:3],
- [NSIndexPath indexPathForRow:2 inSection:3],
- nil];
- [self.myTableView beginUpdates];
- [self.myTableView deleteRowsAtIndexPaths:deleteIndexPaths withRowAnimation:UITableViewRowAnimationFade];
- [self.myTableView endUpdates];
- self.activeParamsIndex = -1;
- [SharedElements sharedSharedElements].activeParamsIndex = -1;
- [self performSelector:@selector(reloadRows) withObject:nil afterDelay:1.0/40.0];
- [self.myTableView deselectRowAtIndexPath:indexPath animated:YES];
- if (indexPath.row == 0)
- ind = 0;
- else
- if (indexPath.row == 6)
- ind = 2;
- else
- if (indexPath.row == 7)
- ind = 3;
- else
- if (indexPath.row == 8)
- ind = 4;
- if (indexPath.row != 1)
- [self performSelector:@selector(expandByArrayNum) withObject:nil afterDelay:1.0/20.0];
- }
- }
- else
- if (self.activeParamsIndex == 2)
- {
- if ([[tableView cellForRowAtIndexPath:indexPath] accessoryType] == UITableViewCellAccessoryDisclosureIndicator)
- {
- [advParams removeObjectAtIndex:7];
- [advParams removeObjectAtIndex:6];
- [advParams removeObjectAtIndex:5];
- [advParams removeObjectAtIndex:4];
- [advParams removeObjectAtIndex:3];
- NSArray *deleteIndexPaths = [NSArray arrayWithObjects:
- [NSIndexPath indexPathForRow:7 inSection:3],
- [NSIndexPath indexPathForRow:6 inSection:3],
- [NSIndexPath indexPathForRow:5 inSection:3],
- [NSIndexPath indexPathForRow:4 inSection:3],
- [NSIndexPath indexPathForRow:3 inSection:3],
- nil];
- [self.myTableView beginUpdates];
- [self.myTableView deleteRowsAtIndexPaths:deleteIndexPaths withRowAnimation:UITableViewRowAnimationFade];
- [self.myTableView endUpdates];
- self.activeParamsIndex = -1;
- [SharedElements sharedSharedElements].activeParamsIndex = -1;
- [self performSelector:@selector(reloadRows) withObject:nil afterDelay:1.0/40.0];
- [self.myTableView deselectRowAtIndexPath:indexPath animated:YES];
- if (indexPath.row == 0)
- ind = 0;
- else
- if (indexPath.row == 1)
- ind = 1;
- else
- if (indexPath.row == 8)
- ind = 3;
- else
- if (indexPath.row == 9)
- ind = 4;
- if (indexPath.row != 2)
- [self performSelector:@selector(expandByArrayNum) withObject:nil afterDelay:1.0/20.0];
- }
- }
- else
- if (self.activeParamsIndex == 3)
- {
- if ([[tableView cellForRowAtIndexPath:indexPath] accessoryType] == UITableViewCellAccessoryDisclosureIndicator)
- {
- [advParams removeObjectAtIndex:6];
- [advParams removeObjectAtIndex:5];
- [advParams removeObjectAtIndex:4];
- NSArray *deleteIndexPaths = [NSArray arrayWithObjects:
- [NSIndexPath indexPathForRow:6 inSection:3],
- [NSIndexPath indexPathForRow:5 inSection:3],
- [NSIndexPath indexPathForRow:4 inSection:3],
- nil];
- [self.myTableView beginUpdates];
- [self.myTableView deleteRowsAtIndexPaths:deleteIndexPaths withRowAnimation:UITableViewRowAnimationFade];
- [self.myTableView endUpdates];
- self.activeParamsIndex = -1;
- [SharedElements sharedSharedElements].activeParamsIndex = -1;
- [self performSelector:@selector(reloadRows) withObject:nil afterDelay:1.0/40.0];
- [self.myTableView deselectRowAtIndexPath:indexPath animated:YES];
- if (indexPath.row == 0)
- ind = 0;
- else
- if (indexPath.row == 1)
- ind = 1;
- else
- if (indexPath.row == 2)
- ind = 2;
- else
- if (indexPath.row == 7)
- ind = 4;
- if (indexPath.row != 3)
- [self performSelector:@selector(expandByArrayNum) withObject:nil afterDelay:1.0/20.0];
- }
- }
- else
- if (self.activeParamsIndex == 4)
- {
- if ([[tableView cellForRowAtIndexPath:indexPath] accessoryType] == UITableViewCellAccessoryDisclosureIndicator)
- {
- [advParams removeObjectAtIndex:19];
- [advParams removeObjectAtIndex:18];
- [advParams removeObjectAtIndex:17];
- [advParams removeObjectAtIndex:16];
- [advParams removeObjectAtIndex:15];
- [advParams removeObjectAtIndex:14];
- [advParams removeObjectAtIndex:13];
- [advParams removeObjectAtIndex:12];
- [advParams removeObjectAtIndex:11];
- [advParams removeObjectAtIndex:10];
- [advParams removeObjectAtIndex:9];
- [advParams removeObjectAtIndex:8];
- [advParams removeObjectAtIndex:7];
- [advParams removeObjectAtIndex:6];
- [advParams removeObjectAtIndex:5];
- NSArray *deleteIndexPaths = [NSArray arrayWithObjects:
- [NSIndexPath indexPathForRow:19 inSection:3],
- [NSIndexPath indexPathForRow:18 inSection:3],
- [NSIndexPath indexPathForRow:17 inSection:3],
- [NSIndexPath indexPathForRow:16 inSection:3],
- [NSIndexPath indexPathForRow:15 inSection:3],
- [NSIndexPath indexPathForRow:14 inSection:3],
- [NSIndexPath indexPathForRow:13 inSection:3],
- [NSIndexPath indexPathForRow:12 inSection:3],
- [NSIndexPath indexPathForRow:11 inSection:3],
- [NSIndexPath indexPathForRow:10 inSection:3],
- [NSIndexPath indexPathForRow:9 inSection:3],
- [NSIndexPath indexPathForRow:8 inSection:3],
- [NSIndexPath indexPathForRow:7 inSection:3],
- [NSIndexPath indexPathForRow:6 inSection:3],
- [NSIndexPath indexPathForRow:5 inSection:3],
- nil];
- [self.myTableView beginUpdates];
- [self.myTableView deleteRowsAtIndexPaths:deleteIndexPaths withRowAnimation:UITableViewRowAnimationFade];
- [self.myTableView endUpdates];
- self.activeParamsIndex = -1;
- [SharedElements sharedSharedElements].activeParamsIndex = -1;
- [self performSelector:@selector(reloadRows) withObject:nil afterDelay:1.0/40.0];
- [self.myTableView deselectRowAtIndexPath:indexPath animated:YES];
- if (indexPath.row == 0)
- ind = 0;
- else
- if (indexPath.row == 1)
- ind = 1;
- else
- if (indexPath.row == 2)
- ind = 2;
- else
- if (indexPath.row == 3)
- ind = 3;
- if (indexPath.row != 4)
- [self performSelector:@selector(expandByArrayNum) withObject:nil afterDelay:1.0/20.0];
- }
- }
- if (self.activeParamsIndex == 2)
- {
- if ([self paramValueExistsAtIndex:2])
- {
- if ([self getRowAsArrayIndex:indexPath.row arrayNum:2] == [self getMinArrayIndex:2])
- {
- [ratingMenu replaceObjectAtIndex:4 withObject:@"0"];
- [ratingMenu replaceObjectAtIndex:3 withObject:@"0"];
- [ratingMenu replaceObjectAtIndex:2 withObject:@"0"];
- [ratingMenu replaceObjectAtIndex:1 withObject:@"0"];
- [ratingMenu replaceObjectAtIndex:0 withObject:@"0"];
- [self reloadRating:tableView];
- return;
- }
- }
- if (indexPath.row == 3)
- {
- [ratingMenu replaceObjectAtIndex:4 withObject:@"0"];
- [ratingMenu replaceObjectAtIndex:3 withObject:@"0"];
- [ratingMenu replaceObjectAtIndex:2 withObject:@"0"];
- [ratingMenu replaceObjectAtIndex:1 withObject:@"0"];
- [ratingMenu replaceObjectAtIndex:0 withObject:@"1"];
- [self reloadRating:tableView];
- }
- else
- if (indexPath.row == 4)
- {
- [ratingMenu replaceObjectAtIndex:4 withObject:@"0"];
- [ratingMenu replaceObjectAtIndex:3 withObject:@"0"];
- [ratingMenu replaceObjectAtIndex:2 withObject:@"0"];
- [ratingMenu replaceObjectAtIndex:1 withObject:@"1"];
- [ratingMenu replaceObjectAtIndex:0 withObject:@"1"];
- [self reloadRating:tableView];
- }
- else
- if (indexPath.row == 5)
- {
- [ratingMenu replaceObjectAtIndex:4 withObject:@"0"];
- [ratingMenu replaceObjectAtIndex:3 withObject:@"0"];
- [ratingMenu replaceObjectAtIndex:2 withObject:@"1"];
- [ratingMenu replaceObjectAtIndex:1 withObject:@"1"];
- [ratingMenu replaceObjectAtIndex:0 withObject:@"1"];
- [self reloadRating:tableView];
- }
- else
- if (indexPath.row == 6)
- {
- [ratingMenu replaceObjectAtIndex:4 withObject:@"0"];
- [ratingMenu replaceObjectAtIndex:3 withObject:@"1"];
- [ratingMenu replaceObjectAtIndex:2 withObject:@"1"];
- [ratingMenu replaceObjectAtIndex:1 withObject:@"1"];
- [ratingMenu replaceObjectAtIndex:0 withObject:@"1"];
- [self reloadRating:tableView];
- }
- else
- if (indexPath.row == 7)
- {
- [ratingMenu replaceObjectAtIndex:4 withObject:@"1"];
- [ratingMenu replaceObjectAtIndex:3 withObject:@"1"];
- [ratingMenu replaceObjectAtIndex:2 withObject:@"1"];
- [ratingMenu replaceObjectAtIndex:1 withObject:@"1"];
- [ratingMenu replaceObjectAtIndex:0 withObject:@"1"];
- [self reloadRating:tableView];
- }
- }
- NSLog(@"row: %D", [selectedIndex row]);
- NSLog(@"table frame: origin: {%D; %D}; size: {%D; %D};; contentOffset: {%F; %F};",
- [myTableView frame].origin.x,
- [myTableView frame].origin.y,
- [myTableView frame].size.width,
- [myTableView frame].size.height,
- [myTableView contentOffset].x,
- [myTableView contentOffset].y);
- [myTableView setContentOffset:CGPointMake(0, -240)];
- //[tableView selectedIndex
- //NSIndexPath *scrollIndexPath = [NSIndexPath indexPathForRow:(1) inSection:1];
- //[tableView scrollToRowAtIndexPath:scrollIndexPath atScrollPosition:UITableViewScrollPositionBottom animated:YES];
- //[tableView scrollRectToVisible:CGRectMake(10,10,10,10) animated:YES];
- [tableView scrollsToTop];
- //[tableView reloadData];
- }
- }
- -(void) expandByArrayNum
- {
- if (ind == 0)
- {
- self.activeParamsIndex = 0;
- [SharedElements sharedSharedElements].activeParamsIndex = 0;
- if ([advParams count] != 0)
- {
- [advParams insertObject:[[AdvanceSearchDataSource sharedAdvanceSearchDataSource].typeParams objectAtIndex:0] atIndex:1];
- [advParams insertObject:[[AdvanceSearchDataSource sharedAdvanceSearchDataSource].typeParams objectAtIndex:1] atIndex:2];
- [advParams insertObject:[[AdvanceSearchDataSource sharedAdvanceSearchDataSource].typeParams objectAtIndex:2] atIndex:3];
- NSArray *insertIndexPaths = [NSArray arrayWithObjects:
- [NSIndexPath indexPathForRow:1 inSection:3],
- [NSIndexPath indexPathForRow:2 inSection:3],
- [NSIndexPath indexPathForRow:3 inSection:3],
- nil];
- [self.myTableView beginUpdates];
- [self.myTableView insertRowsAtIndexPaths:insertIndexPaths withRowAnimation:UITableViewRowAnimationFade];
- [self.myTableView endUpdates];
- [self reloadType:self.myTableView];
- }
- }
- else
- if (ind == 1)
- {
- self.activeParamsIndex = 1;
- [SharedElements sharedSharedElements].activeParamsIndex = 1;
- if ([advParams count] != 0)
- {
- [advParams insertObject:[[AdvanceSearchDataSource sharedAdvanceSearchDataSource].type2Params objectAtIndex:0] atIndex:2];
- [advParams insertObject:[[AdvanceSearchDataSource sharedAdvanceSearchDataSource].type2Params objectAtIndex:1] atIndex:3];
- [advParams insertObject:[[AdvanceSearchDataSource sharedAdvanceSearchDataSource].type2Params objectAtIndex:2] atIndex:4];
- [advParams insertObject:[[AdvanceSearchDataSource sharedAdvanceSearchDataSource].type2Params objectAtIndex:3] atIndex:5];
- NSArray *insertIndexPaths = [NSArray arrayWithObjects:
- [NSIndexPath indexPathForRow:2 inSection:3],
- [NSIndexPath indexPathForRow:3 inSection:3],
- [NSIndexPath indexPathForRow:4 inSection:3],
- [NSIndexPath indexPathForRow:5 inSection:3],
- nil];
- [self.myTableView beginUpdates];
- [self.myTableView insertRowsAtIndexPaths:insertIndexPaths withRowAnimation:UITableViewRowAnimationFade];
- [self.myTableView endUpdates];
- [self reloadPart:self.myTableView];
- }
- }
- else
- if (ind == 2)
- {
- self.activeParamsIndex = 2;
- [SharedElements sharedSharedElements].activeParamsIndex = 2;
- if ([advParams count] != 0)
- {
- [advParams insertObject:@"*****" atIndex:3];
- [advParams insertObject:@"****" atIndex:4];
- [advParams insertObject:@"***" atIndex:5];
- [advParams insertObject:@"**" atIndex:6];
- [advParams insertObject:@"*" atIndex:7];
- NSArray *insertIndexPaths = [NSArray arrayWithObjects:
- [NSIndexPath indexPathForRow:3 inSection:3],
- [NSIndexPath indexPathForRow:4 inSection:3],
- [NSIndexPath indexPathForRow:5 inSection:3],
- [NSIndexPath indexPathForRow:6 inSection:3],
- [NSIndexPath indexPathForRow:7 inSection:3],
- nil];
- [self.myTableView beginUpdates];
- [self.myTableView insertRowsAtIndexPaths:insertIndexPaths withRowAnimation:UITableViewRowAnimationFade];
- [self.myTableView endUpdates];
- [self reloadRating:self.myTableView];
- }
- }
- else
- if (ind == 3)
- {
- self.activeParamsIndex = 3;
- [SharedElements sharedSharedElements].activeParamsIndex = 3;
- if ([advParams count] != 0)
- {
- [advParams insertObject:[[AdvanceSearchDataSource sharedAdvanceSearchDataSource].levelParams objectAtIndex:0] atIndex:4];
- [advParams insertObject:[[AdvanceSearchDataSource sharedAdvanceSearchDataSource].levelParams objectAtIndex:1] atIndex:5];
- [advParams insertObject:[[AdvanceSearchDataSource sharedAdvanceSearchDataSource].levelParams objectAtIndex:2] atIndex:6];
- NSArray *insertIndexPaths = [NSArray arrayWithObjects:
- [NSIndexPath indexPathForRow:4 inSection:3],
- [NSIndexPath indexPathForRow:5 inSection:3],
- [NSIndexPath indexPathForRow:6 inSection:3],
- nil];
- [self.myTableView beginUpdates];
- [self.myTableView insertRowsAtIndexPaths:insertIndexPaths withRowAnimation:UITableViewRowAnimationFade];
- [self.myTableView endUpdates];
- [self reloadLevel:self.myTableView];
- }
- }
- else
- if (ind == 4)
- {
- self.activeParamsIndex = 4;
- [SharedElements sharedSharedElements].activeParamsIndex = 4;
- if ([advParams count] != 0)
- {
- [advParams insertObject:[[AdvanceSearchDataSource sharedAdvanceSearchDataSource].tuningParams objectAtIndex:0] atIndex:5];
- [advParams insertObject:[[AdvanceSearchDataSource sharedAdvanceSearchDataSource].tuningParams objectAtIndex:1] atIndex:6];
- [advParams insertObject:[[AdvanceSearchDataSource sharedAdvanceSearchDataSource].tuningParams objectAtIndex:2] atIndex:7];
- [advParams insertObject:[[AdvanceSearchDataSource sharedAdvanceSearchDataSource].tuningParams objectAtIndex:3] atIndex:8];
- [advParams insertObject:[[AdvanceSearchDataSource sharedAdvanceSearchDataSource].tuningParams objectAtIndex:4] atIndex:9];
- [advParams insertObject:[[AdvanceSearchDataSource sharedAdvanceSearchDataSource].tuningParams objectAtIndex:5] atIndex:10];
- [advParams insertObject:[[AdvanceSearchDataSource sharedAdvanceSearchDataSource].tuningParams objectAtIndex:6] atIndex:11];
- [advParams insertObject:[[AdvanceSearchDataSource sharedAdvanceSearchDataSource].tuningParams objectAtIndex:7] atIndex:12];
- [advParams insertObject:[[AdvanceSearchDataSource sharedAdvanceSearchDataSource].tuningParams objectAtIndex:8] atIndex:13];
- [advParams insertObject:[[AdvanceSearchDataSource sharedAdvanceSearchDataSource].tuningParams objectAtIndex:9] atIndex:14];
- [advParams insertObject:[[AdvanceSearchDataSource sharedAdvanceSearchDataSource].tuningParams objectAtIndex:10] atIndex:15];
- [advParams insertObject:[[AdvanceSearchDataSource sharedAdvanceSearchDataSource].tuningParams objectAtIndex:11] atIndex:16];
- [advParams insertObject:[[AdvanceSearchDataSource sharedAdvanceSearchDataSource].tuningParams objectAtIndex:12] atIndex:17];
- [advParams insertObject:[[AdvanceSearchDataSource sharedAdvanceSearchDataSource].tuningParams objectAtIndex:13] atIndex:18];
- [advParams insertObject:[[AdvanceSearchDataSource sharedAdvanceSearchDataSource].tuningParams objectAtIndex:14] atIndex:19];
- NSArray *insertIndexPaths = [NSArray arrayWithObjects:
- [NSIndexPath indexPathForRow:5 inSection:3],
- [NSIndexPath indexPathForRow:6 inSection:3],
- [NSIndexPath indexPathForRow:7 inSection:3],
- [NSIndexPath indexPathForRow:8 inSection:3],
- [NSIndexPath indexPathForRow:9 inSection:3],
- [NSIndexPath indexPathForRow:10 inSection:3],
- [NSIndexPath indexPathForRow:11 inSection:3],
- [NSIndexPath indexPathForRow:12 inSection:3],
- [NSIndexPath indexPathForRow:13 inSection:3],
- [NSIndexPath indexPathForRow:14 inSection:3],
- [NSIndexPath indexPathForRow:15 inSection:3],
- [NSIndexPath indexPathForRow:16 inSection:3],
- [NSIndexPath indexPathForRow:17 inSection:3],
- [NSIndexPath indexPathForRow:18 inSection:3],
- [NSIndexPath indexPathForRow:19 inSection:3],
- nil];
- [self.myTableView beginUpdates];
- [self.myTableView insertRowsAtIndexPaths:insertIndexPaths withRowAnimation:UITableViewRowAnimationFade];
- [self.myTableView endUpdates];
- [self reloadTuning:self.myTableView];
- }
- }
- }
- ///////////////////////////////////////// reload headers
- -(void) reloadHeader0:(UITableView*)tblView
- {
- [tblView reloadRowsAtIndexPaths:[NSArray arrayWithObjects:[NSIndexPath indexPathForRow:0 inSection:3],nil] withRowAnimation:UITableViewRowAnimationNone];
- }
- -(void) reloadHeader1:(UITableView*)tblView
- {
- [tblView reloadRowsAtIndexPaths:[NSArray arrayWithObjects:[NSIndexPath indexPathForRow:1 inSection:3],nil] withRowAnimation:UITableViewRowAnimationNone];
- }
- -(void) reloadHeader2:(UITableView*)tblView
- {
- [tblView reloadRowsAtIndexPaths:[NSArray arrayWithObjects:[NSIndexPath indexPathForRow:2 inSection:3],nil] withRowAnimation:UITableViewRowAnimationNone];
- }
- -(void) reloadHeader3:(UITableView*)tblView
- {
- [tblView reloadRowsAtIndexPaths:[NSArray arrayWithObjects:[NSIndexPath indexPathForRow:3 inSection:3],nil] withRowAnimation:UITableViewRowAnimationNone];
- }
- -(void) reloadHeader4:(UITableView*)tblView
- {
- [tblView reloadRowsAtIndexPaths:[NSArray arrayWithObjects:[NSIndexPath indexPathForRow:4 inSection:3],nil] withRowAnimation:UITableViewRowAnimationNone];
- }
- //////////////////////////////////////// end of reload headers
- -(void) reloadType:(UITableView*)tblView
- {
- [self reloadHeader0:tblView];
- [tblView reloadRowsAtIndexPaths:[NSArray arrayWithObjects:[NSIndexPath indexPathForRow:1 inSection:3],nil] withRowAnimation:UITableViewRowAnimationNone];
- [tblView reloadRowsAtIndexPaths:[NSArray arrayWithObjects:[NSIndexPath indexPathForRow:2 inSection:3],nil] withRowAnimation:UITableViewRowAnimationNone];
- [tblView reloadRowsAtIndexPaths:[NSArray arrayWithObjects:[NSIndexPath indexPathForRow:3 inSection:3],nil] withRowAnimation:UITableViewRowAnimationNone];
- }
- -(void) reloadPart:(UITableView*)tblView
- {
- [self reloadHeader1:tblView];
- [tblView reloadRowsAtIndexPaths:[NSArray arrayWithObjects:[NSIndexPath indexPathForRow:2 inSection:3],nil] withRowAnimation:UITableViewRowAnimationNone];
- [tblView reloadRowsAtIndexPaths:[NSArray arrayWithObjects:[NSIndexPath indexPathForRow:3 inSection:3],nil] withRowAnimation:UITableViewRowAnimationNone];
- [tblView reloadRowsAtIndexPaths:[NSArray arrayWithObjects:[NSIndexPath indexPathForRow:4 inSection:3],nil] withRowAnimation:UITableViewRowAnimationNone];
- [tblView reloadRowsAtIndexPaths:[NSArray arrayWithObjects:[NSIndexPath indexPathForRow:5 inSection:3],nil] withRowAnimation:UITableViewRowAnimationNone];
- }
- -(void) reloadRating:(UITableView*)tblView
- {
- [self reloadHeader2:tblView];
- [tblView reloadRowsAtIndexPaths:[NSArray arrayWithObjects:[NSIndexPath indexPathForRow:3 inSection:3],nil] withRowAnimation:UITableViewRowAnimationNone];
- [tblView reloadRowsAtIndexPaths:[NSArray arrayWithObjects:[NSIndexPath indexPathForRow:4 inSection:3],nil] withRowAnimation:UITableViewRowAnimationNone];
- [tblView reloadRowsAtIndexPaths:[NSArray arrayWithObjects:[NSIndexPath indexPathForRow:5 inSection:3],nil] withRowAnimation:UITableViewRowAnimationNone];
- [tblView reloadRowsAtIndexPaths:[NSArray arrayWithObjects:[NSIndexPath indexPathForRow:6 inSection:3],nil] withRowAnimation:UITableViewRowAnimationNone];
- [tblView reloadRowsAtIndexPaths:[NSArray arrayWithObjects:[NSIndexPath indexPathForRow:7 inSection:3],nil] withRowAnimation:UITableViewRowAnimationNone];
- }
- -(void) reloadLevel:(UITableView*)tblView
- {
- [self reloadHeader3:tblView];
- [tblView reloadRowsAtIndexPaths:[NSArray arrayWithObjects:[NSIndexPath indexPathForRow:4 inSection:3],nil] withRowAnimation:UITableViewRowAnimationNone];
- [tblView reloadRowsAtIndexPaths:[NSArray arrayWithObjects:[NSIndexPath indexPathForRow:5 inSection:3],nil] withRowAnimation:UITableViewRowAnimationNone];
- [tblView reloadRowsAtIndexPaths:[NSArray arrayWithObjects:[NSIndexPath indexPathForRow:6 inSection:3],nil] withRowAnimation:UITableViewRowAnimationNone];
- }
- -(void) reloadTuning:(UITableView*)tblView
- {
- [self reloadHeader4:tblView];
- [tblView reloadRowsAtIndexPaths:[NSArray arrayWithObjects:[NSIndexPath indexPathForRow:5 inSection:3],nil] withRowAnimation:UITableViewRowAnimationNone];
- [tblView reloadRowsAtIndexPaths:[NSArray arrayWithObjects:[NSIndexPath indexPathForRow:6 inSection:3],nil] withRowAnimation:UITableViewRowAnimationNone];
- [tblView reloadRowsAtIndexPaths:[NSArray arrayWithObjects:[NSIndexPath indexPathForRow:7 inSection:3],nil] withRowAnimation:UITableViewRowAnimationNone];
- [tblView reloadRowsAtIndexPaths:[NSArray arrayWithObjects:[NSIndexPath indexPathForRow:8 inSection:3],nil] withRowAnimation:UITableViewRowAnimationNone];
- [tblView reloadRowsAtIndexPaths:[NSArray arrayWithObjects:[NSIndexPath indexPathForRow:9 inSection:3],nil] withRowAnimation:UITableViewRowAnimationNone];
- [tblView reloadRowsAtIndexPaths:[NSArray arrayWithObjects:[NSIndexPath indexPathForRow:10 inSection:3],nil] withRowAnimation:UITableViewRowAnimationNone];
- [tblView reloadRowsAtIndexPaths:[NSArray arrayWithObjects:[NSIndexPath indexPathForRow:11 inSection:3],nil] withRowAnimation:UITableViewRowAnimationNone];
- [tblView reloadRowsAtIndexPaths:[NSArray arrayWithObjects:[NSIndexPath indexPathForRow:12 inSection:3],nil] withRowAnimation:UITableViewRowAnimationNone];
- [tblView reloadRowsAtIndexPaths:[NSArray arrayWithObjects:[NSIndexPath indexPathForRow:13 inSection:3],nil] withRowAnimation:UITableViewRowAnimationNone];
- [tblView reloadRowsAtIndexPaths:[NSArray arrayWithObjects:[NSIndexPath indexPathForRow:14 inSection:3],nil] withRowAnimation:UITableViewRowAnimationNone];
- [tblView reloadRowsAtIndexPaths:[NSArray arrayWithObjects:[NSIndexPath indexPathForRow:15 inSection:3],nil] withRowAnimation:UITableViewRowAnimationNone];
- [tblView reloadRowsAtIndexPaths:[NSArray arrayWithObjects:[NSIndexPath indexPathForRow:16 inSection:3],nil] withRowAnimation:UITableViewRowAnimationNone];
- [tblView reloadRowsAtIndexPaths:[NSArray arrayWithObjects:[NSIndexPath indexPathForRow:17 inSection:3],nil] withRowAnimation:UITableViewRowAnimationNone];
- [tblView reloadRowsAtIndexPaths:[NSArray arrayWithObjects:[NSIndexPath indexPathForRow:18 inSection:3],nil] withRowAnimation:UITableViewRowAnimationNone];
- [tblView reloadRowsAtIndexPaths:[NSArray arrayWithObjects:[NSIndexPath indexPathForRow:19 inSection:3],nil] withRowAnimation:UITableViewRowAnimationNone];
- }
- -(int) getRowAsArrayIndex:(int)rowIndex arrayNum:(int)aIndex
- {
- int res = 0;
- if (aIndex == 2)
- {
- if (rowIndex == 3)
- res = 0;
- else
- if (rowIndex == 4)
- res = 1;
- else
- if (rowIndex == 5)
- res = 2;
- else
- if (rowIndex == 6)
- res = 3;
- else
- if (rowIndex == 7)
- res = 4;
- }
- return res;
- }
- -(int) getMinArrayIndex:(int)arrayIndex
- {
- int res = 0;
- if (arrayIndex == 2)
- for (int i=[ratingMenu count]-1; i != -1; i--)
- if ([[ratingMenu objectAtIndex:i] isEqualToString:@"1"])
- {
- res = i;
- break;
- }
- return res;
- }
- -(void) reloadRows
- {
- NSArray *reloadIndexPaths = [NSArray arrayWithObjects:
- [NSIndexPath indexPathForRow:0 inSection:3],
- [NSIndexPath indexPathForRow:1 inSection:3],
- [NSIndexPath indexPathForRow:2 inSection:3],
- [NSIndexPath indexPathForRow:3 inSection:3],
- [NSIndexPath indexPathForRow:4 inSection:3],
- nil];
- [self.myTableView reloadRowsAtIndexPaths:reloadIndexPaths withRowAnimation:UITableViewRowAnimationNone];
- }
- -(NSString*) getRowText:(int)rowIndex
- {
- if (self.activeParamsIndex == 0)
- {
- switch (rowIndex)
- {
- case 0:
- return @"Type";
- case 1:
- return @"Tab";
- case 2:
- return @"Bass Tab";
- case 3:
- return @"Chords";
- case 4:
- return @"Part";
- case 5:
- return @"Rating";
- case 6:
- return @"Difficulty";
- case 7:
- return @"Tuning";
- }
- }
- else
- if (self.activeParamsIndex == 1)
- {
- switch (rowIndex)
- {
- case 0:
- return @"Type";
- case 1:
- return @"Part";
- case 2:
- return @"Whole Song";
- case 3:
- return @"Intro";
- case 4:
- return @"Solo";
- case 5:
- return @"Album";
- case 6:
- return @"Rating";
- case 7:
- return @"Difficulty";
- case 8:
- return @"Tuning";
- }
- }
- else
- if (self.activeParamsIndex == 2)
- {
- switch (rowIndex)
- {
- case 0:
- return @"Type";
- case 1:
- return @"Part";
- case 2:
- return @"Rating";
- case 3:
- return @"";
- case 4:
- return @"";
- case 5:
- return @"";
- case 6:
- return @"";
- case 7:
- return @"";
- case 8:
- return @"Difficulty";
- case 9:
- return @"Tuning";
- }
- }
- else
- if (self.activeParamsIndex == 3)
- {
- switch (rowIndex)
- {
- case 0:
- return @"Type";
- case 1:
- return @"Part";
- case 2:
- return @"Rating";
- case 3:
- return @"Difficulty";
- case 4:
- return @"Novice";
- case 5:
- return @"Intermediate";
- case 6:
- return @"Advance";
- case 7:
- return @"Tuning";
- }
- }
- else
- if (self.activeParamsIndex == 4)
- {
- switch (rowIndex)
- {
- case 0:
- return @"Type";
- case 1:
- return @"Part";
- case 2:
- return @"Rating";
- case 3:
- return @"Difficulty";
- case 4:
- return @"Tuning";
- case 5:
- return @"Standard";
- case 6:
- return @"Half-Step Down";
- case 7:
- return @"B Tuning";
- case 8:
- return @"C Tuning";
- case 9:
- return @"D Tuning";
- case 10:
- return @"Drop A";
- case 11:
- return @"Drop A#";
- case 12:
- return @"Drop B";
- case 13:
- return @"Drop C";
- case 14:
- return @"Drop C#";
- case 15:
- return @"Drop D";
- case 16:
- return @"Open C";
- case 17:
- return @"Open D";
- case 18:
- return @"Open E";
- case 19:
- return @"Open G";
- }
- }
- else
- if (self.activeParamsIndex == -1)
- {
- switch (rowIndex)
- {
- case 0:
- return @"Type";
- case 1:
- return @"Part";
- case 2:
- return @"Rating";
- case 3:
- return @"Difficulty";
- case 4:
- return @"Tuning";
- }
- }
- return @"none";
- }
- // Animate the entire view up or down, to prevent the keyboard from covering the author field.
- -(void) setViewMovedUp:(BOOL)movedUp
- {
- [UIView beginAnimations:nil context:NULL];
- [UIView setAnimationDuration:0.3];
- // Make changes to the view's frame inside the animation block. They will be animated instead
- // of taking place immediately.
- CGRect rect = contentView.frame;
- if (movedUp)
- {
- // If moving up, not only decrease the origin but increase the height so the view
- // covers the entire screen behind the keyboard.
- rect.origin.y -= kOFFSET_FOR_KEYBOARD;
- rect.size.height += kOFFSET_FOR_KEYBOARD;
- }
- else
- {
- // If moving down, not only increase the origin but decrease the height.
- rect.origin.y += kOFFSET_FOR_KEYBOARD;
- rect.size.height -= kOFFSET_FOR_KEYBOARD;
- alreadyUp=NO;
- }
- contentView.frame = rect;
- [UIView commitAnimations];
- }
- -(BOOL) textFieldShouldReturn:(UITextField *)textField
- {
- [songNameTextField resignFirstResponder];
- [bandNameTextField resignFirstResponder];
- return YES;
- }
- -(void) viewWillAppear:(BOOL)animated
- {
- if ([advParams count] == 0)
- {
- [advParams addObject:@"0"];
- [advParams addObject:@"1"];
- [advParams addObject:@"2"];
- [advParams addObject:@"3"];
- [advParams addObject:@"4"];
- typeMenu = [[NSMutableArray alloc] initWithObjects:@"0", @"0", @"0", nil];
- partMenu = [[NSMutableArray alloc] initWithObjects:@"0", @"0", @"0", @"0", nil];
- ratingMenu = [[NSMutableArray alloc] initWithObjects:@"0", @"0", @"0", @"0", @"0", nil];
- difficultyLevelMenu = [[NSMutableArray alloc] initWithObjects:@"0", @"0", @"0", nil];
- tuningMenu = [[NSMutableArray alloc] initWithObjects:@"0", @"0", @"0", @"0", @"0", @"0", @"0", @"0", @"0", @"0", @"0", @"0", @"0", @"0", @"0", nil];
- self.activeParamsIndex = -1;
- }
- NSLog(@"INDEX_____________%d", self.activeParamsIndex );
- [self.myTableView reloadData];
- if ([[[SharedElements sharedSharedElements] getBandName] length] > 0)
- bandNameTextField.text = [[SharedElements sharedSharedElements] getBandName];
- if ([[[SharedElements sharedSharedElements] getSongName] length] > 0)
- songNameTextField.text = [[SharedElements sharedSharedElements] getSongName];
- }
- -(void)viewDidAppear:(BOOL)animated
- {
- [super viewDidAppear:animated];;
- //return;
- }
- -(void)viewWillDisappear:(BOOL)animated
- {
- [[SharedElements sharedSharedElements] setAdvParams:advParams];
- [[SharedElements sharedSharedElements] setTypeMenu:typeMenu];
- [[SharedElements sharedSharedElements] setPartMenu:partMenu];
- [[SharedElements sharedSharedElements] setRatingMenu:ratingMenu];
- [[SharedElements sharedSharedElements] setDifficultyLevelMenu:difficultyLevelMenu];
- [[SharedElements sharedSharedElements] setTuningMenu:tuningMenu];
- }
- /*
- - (void)keyboardWillShow:(NSNotification *)notif{
- //The keyboard will be shown.
- [self setViewMovedUp:YES];
- }
- - (void)keyboardWillHide:(NSNotification *)notif{
- //The keyboard will now be removed.
- [self setViewMovedUp:NO];
- }
- #pragma mark - UIViewController delegate methods
- - (void)viewWillDisappear:(BOOL)animated{
- //unregister for keyboard notifications while not visible.
- [[NSNotificationCenter defaultCenter] removeObserver:self name:UIKeyboardWillShowNotification object:nil];
- //unregister for keyboard notifications while not visible.
- [[NSNotificationCenter defaultCenter] removeObserver:self name:UIKeyboardWillHideNotification object:nil];
- [songNameTextField resignFirstResponder];
- [bandNameTextField resignFirstResponder];
- }
- */
- /*
- If you need to do additional setup after loading the view, override viewDidLoad.
- - (void)viewDidLoad {
- }
- */
- /*
- - (void)willAnimateFirstHalfOfRotationFromInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation duration:(NSTimeInterval)duration
- {
- NSLog(@"wilRotateFromInterfaceOrientation 3.0: %d", interfaceOrientation);
- }
- - (void)wilRotateFromInterfaceOrientation:(UIInterfaceOrientation)fromInterfaceOrientation
- {
- NSLog(@"wilRotateFromInterfaceOrientation: %d", fromInterfaceOrientation);
- }*/
- /*
- - (void)willRotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration
- {
- NSLog(@"1");
- }
- - (void)willAnimateRotationToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation duration:(NSTimeInterval)duration
- {
- NSLog(@"2");
- }
- - (void)didRotateFromInterfaceOrientation:(UIInterfaceOrientation)fromInterfaceOrientation
- {
- NSLog(@"3");
- }
- - (void)willAnimateFirstHalfOfRotationToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration
- {
- NSLog(@"4");
- }
- - (void)didAnimateFirstHalfOfRotationToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation
- {
- NSLog(@"5");
- }
- - (void)willAnimateSecondHalfOfRotationFromInterfaceOrientation:(UIInterfaceOrientation)fromInterfaceOrientation duration:(NSTimeInterval)duration
- {
- NSLog(@"6");
- }
- */
- -(BOOL) shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
- {
- return NO;
- //NSLog(@"Say from Advanced view controller");
- //(interfaceOrientation == UIInterfaceOrientationPortrait || interfaceOrientation == UIInterfaceOrientationLandscapeLeft
- //|| interfaceOrientation == UIInterfaceOrientationLandscapeRight);
- // Return YES for supported orientations
- //return YES;//(interfaceOrientation == UIInterfaceOrientationPortrait);
- }
- -(void) didReceiveMemoryWarning
- {
- [super didReceiveMemoryWarning]; // Releases the view if it doesn't have a superview
- // Release anything that's not essential, such as cached data
- }
- -(void) dealloc
- {
- [advParams release];
- [typeMenu release];
- [partMenu release];
- [ratingMenu release];
- [difficultyLevelMenu release];
- [tuningMenu release];
- [dataSource release];
- [searchButton release];
- [contentView release];
- [myTableView release];
- [super dealloc];
- //[ratingPicker release];
- //[typePicker release];
- //[type2Picker release];
- //[levelPicker release];
- //[tuningPicker release];
- //[pickerToolBar release];
- }
- @end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement