Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'An instance 0x7fb0d15ce510 of class WYPopoverTheme was deallocated while key ... #86

Open
JulesMoorhouse opened this issue Oct 8, 2016 · 5 comments
Labels
Milestone

Comments

@JulesMoorhouse
Copy link

JulesMoorhouse commented Oct 8, 2016

Any suggested fixes on this error ?

2016-10-08 22:03:36.304 MyApp[27679:296018] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'An instance 0x7fb0d15ce510 of class WYPopoverTheme was deallocated while key value observers were still registered with it. Current observation info: <NSKeyValueObservationInfo 0x7fb0d15d9e50> (
< NSKeyValueObservance 0x7fb0d15cf460: Observer: 0x7fb0d15d5010, Key path: tintColor, Options: <New: YES, Old: NO, Prior: NO> Context: 0x0, Property: 0x7fb0d15d5120>
< NSKeyValueObservance 0x7fb0d15d3c90: Observer: 0x7fb0d15d5010, Key path: outerStrokeColor, Options: <New: YES, Old: NO, Prior: NO> Context: 0x0, Property: 0x7fb0d15d3c60>
< NSKeyValueObservance 0x7fb0d15d6760: Observer: 0x7fb0d15d5010, Key path: innerStrokeColor, Options: <New: YES, Old: NO, Prior: NO> Context: 0x0, Property: 0x7fb0d15d6490>
< NSKeyValueObservance 0x7fb0d15d6c50: Observer: 0x7fb0d15d5010, Key path: fillTopColor, Options: <New: YES, Old: NO, Prior: NO> Context: 0x0, Property: 0x7fb0d15d6b90>
< NSKeyValueObservance 0x7fb0d15d72c0: Observer: 0x7fb0d15d5010, Key path: fillBottomColor, Options: <New: YES, Old: NO, Prior: NO> Context: 0x0, Property: 0x7fb0d15d64c0>
< NSKeyValueObservance 0x7fb0d15d7870: Observer: 0x7fb0d15d5010, Key path: glossShadowColor, Options: <New: YES, Old: NO, Prior: NO> Context: 0x0, Property: 0x7fb0d15d4090>
< NSKeyValueObservance 0x7fb0d15d7d60: Observer: 0x7fb0d15d5010, Key path: glossShadowOffset, Options: <New: YES, Old: NO, Prior: NO> Context: 0x0, Property: 0x7fb0d15d7ca0>
< NSKeyValueObservance 0x7fb0d15d8340: Observer: 0x7fb0d15d5010, Key path: glossShadowBlurRadius, Options: <New: YES, Old: NO, Prior: NO> Context: 0x0, Property: 0x7fb0d15d8280>
< NSKeyValueObservance 0x7fb0d15d88d0: Observer: 0x7fb0d15d5010, Key path: borderWidth, Options: <New: YES, Old: NO, Prior: NO> Context: 0x0, Property: 0x7fb0d15d87f0>
< NSKeyValueObservance 0x7fb0d15d8d80: Observer: 0x7fb0d15d5010, Key path: arrowBase, Options: <New: YES, Old: NO, Prior: NO> Context: 0x0, Property: 0x7fb0d15d8cc0>
< NSKeyValueObservance 0x7fb0d15d9310: Observer: 0x7fb0d15d5010, Key path: arrowHeight, Options: <New: YES, Old: NO, Prior: NO> Context: 0x0, Property: 0x7fb0d15d7790>
< NSKeyValueObservance 0x7fb0d15d9850: Observer: 0x7fb0d15d5010, Key path: outerShadowColor, Options: <New: YES, Old: NO, Prior: NO> Context: 0x0, Property: 0x7fb0d15d9770>
< NSKeyValueObservance 0x7fb0d15d9f00: Observer: 0x7fb0d15d5010, Key path: outerShadowBlurRadius, Options: <New: YES, Old: NO, Prior: NO> Context: 0x0, Property: 0x7fb0d15d9e20>
< NSKeyValueObservance 0x7fb0d15da460: Observer: 0x7fb0d15d5010, Key path: outerShadowOffset, Options: <New: YES, Old: NO, Prior: NO> Context: 0x0, Property: 0x7fb0d15da3a0>
< NSKeyValueObservance 0x7fb0d15da970: Observer: 0x7fb0d15d5010, Key path: outerCornerRadius, Options: <New: YES, Old: NO, Prior: NO> Context: 0x0, Property: 0x7fb0d15d9fb0>
< NSKeyValueObservance 0x7fb0d15daea0: Observer: 0x7fb0d15d5010, Key path: innerShadowColor, Options: <New: YES, Old: NO, Prior: NO> Context: 0x0, Property: 0x7fb0d15da510>
< NSKeyValueObservance 0x7fb0d15db3b0: Observer: 0x7fb0d15d5010, Key path: innerShadowBlurRadius, Options: <New: YES, Old: NO, Prior: NO> Context: 0x0, Property: 0x7fb0d15db2f0>
< NSKeyValueObservance 0x7fb0d15db9f0: Observer: 0x7fb0d15d5010, Key path: innerShadowOffset, Options: <New: YES, Old: NO, Prior: NO> Context: 0x0, Property: 0x7fb0d15db930>
<NSKeyValueObservance 0x7fb0d15d9060: Observer: 0x7fb0d15d5010, Key path: innerCornerRadius, Options: <New: YES, Old: NO, Prior: NO> Context: 0x0, Property: 0x7fb0d15d91c0>
< NSKeyValueObservance 0x7fb0d15dc620: Observer: 0x7fb0d15d5010, Key path: viewContentInsets, Options: <New: YES, Old: NO, Prior: NO> Context: 0x0, Property: 0x7fb0d15dc560>
< NSKeyValueObservance 0x7fb0d15dcdc0: Observer: 0x7fb0d15d5010, Key path: overlayColor, Options: <New: YES, Old: NO, Prior: NO> Context: 0x0, Property: 0x7fb0d15dcd00>
)'

@JulesMoorhouse JulesMoorhouse changed the title Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'An instance xx of class WYPopoverTheme was deallocated while key Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'An instance 0x7fb0d15ce510 of class WYPopoverTheme was deallocated while key Oct 8, 2016
@JulesMoorhouse JulesMoorhouse changed the title Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'An instance 0x7fb0d15ce510 of class WYPopoverTheme was deallocated while key Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'An instance 0x7fb0d15ce510 of class WYPopoverTheme was deallocated while key ... Oct 8, 2016
@vitalys
Copy link
Collaborator

vitalys commented Oct 9, 2016

Could you share some code? How do you use WYPopoverController?

@JulesMoorhouse
Copy link
Author

Let me know if you need any more


- (IBAction)btnPopoverTapped:(id)sender
{
    //-- popover common --
    if (popoverController == nil)
    {
        UIView* btn = (UIView*)sender;

        PopoverHandlerController* pop = [[PopoverHandlerController alloc] init];

        pop.preferredContentSize = CGSizeMake(popoverContentMainWidth, popoverContentMainheight_Portrait);

        pop.title = @"Actions";
        pop.popDelegate = self;
        pop.intPopoverStyle = [self selfPopoverStyle];
        pop.strContentType = [self selfContentType];

        [pop.navigationItem setLeftBarButtonItem:[[UIBarButtonItem alloc] initWithTitle:@"Apply" style:UIBarButtonItemStyleDone target:self action:@selector(btnPopoverDone:)]];

        [pop.navigationItem.leftBarButtonItem setTitleTextAttributes:@{
                                                                        NSFontAttributeName: [UIFont fontWithName:gstrDefaultFontName size:gintNavigationBarFontSize]
                                                                        } forState:UIControlStateNormal];

        UINavigationController* contentViewController = [[UINavigationController alloc] initWithRootViewController:pop];
        [PopoverInstance setup];

        popoverController = [[WYPopoverController alloc] initWithContentViewController:contentViewController];

        popoverController.delegate = self;
        popoverController.passthroughViews = @[btn];
        popoverController.popoverLayoutMargins = UIEdgeInsetsMake(10, 10, 10, 10);
        popoverController.wantsDefaultContentAppearance = NO;

        [popoverController presentPopoverFromBarButtonItem:sender permittedArrowDirections:WYPopoverArrowDirectionAny animated:YES options:WYPopoverAnimationOptionFadeWithScale];
    }
    else
    {
        [self btnPopoverDone:nil];
    }
    return;
    //-- popover common --
    NSString *msg;
    if (intSelViewRow == 0)
    {
        msg = @"Select 'Current' Sorting";
    }
    else
    {
        msg = @"Select 'Ended' Sorting";
    }

}
---
#import <UIKit/UIKit.h>
//#import "WYPopoverController.h"
#import "Constants.h"
#import <WYPopoverController/WYPopoverController.h>

#define popoverItemAccountSelect 1000
#define popoverItemSortCurrent 1010
#define popoverItemSortEnded 1020
#define popoverItemDateFilterFuture 1030
#define popoverItemDateFilterPast 1040
#define popoverItemDateFilterBoth 1050
#define popoverItemCSVExport 1060

@protocol PopoverHandlerControllerDelegate;

@interface PopoverHandlerController : UITableViewController;

@property (nonatomic, weak) id<PopoverHandlerControllerDelegate> popDelegate; // if you use ARC
@property (nonatomic, assign) ePopoverStyle intPopoverStyle;
@property (nonatomic, strong) NSString* strContentType;

@property (nonatomic, strong) NSMutableArray *arrRows;

@end

@protocol PopoverHandlerControllerDelegate <NSObject>;
@optional
- (void)popoverHandler:(PopoverHandlerController*)controller didSelectItem:(NSUInteger)row;
@end

------

#import "PopoverHandlerController.h"
#import "AccountSelTableViewController.h"
#import "SortingTableViewController.h"
#import "DateFilterTableViewController.h"
#import "General.h"
#import "Styles.h"
#import "Prefs.h"
#import "PopoverInstance.h"
#import "ManageDateRange.h"
#import <QuartzCore/QuartzCore.h>

@interface PopoverHandlerController ()

@end

@implementation PopoverHandlerController
@synthesize popDelegate;
@synthesize intPopoverStyle;
@synthesize arrRows;
@synthesize strContentType;

- (id)initWithStyle:(UITableViewStyle)style
{
    self = [super initWithStyle:style];
    if (self) {
        // Custom initialization
    }
    return self;
}

- (void)viewDidLoad
{
    [super viewDidLoad];

    self.tableView.separatorStyle = UITableViewCellSeparatorStyleNone;

    self.tableView.alwaysBounceVertical = NO;

    self.tableView.backgroundColor = [General colorFromHexString:iOS7_gray_light];//[UIColor lightGrayColor]; //PopBG

    [self.navigationController.navigationBar setTitleTextAttributes:@{NSFontAttributeName: [UIFont fontWithName:gstrDefaultFontName size:gintNavigationBarFontSize]}];

    // --- accessibility ---
    self.tableView.accessibilityTraits = UIAccessibilityTraitStaticText;
    self.tableView.accessibilityLabel = @"Actions Selection";
    self.tableView.accessibilityElementsHidden = NO;
    self.tableView.isAccessibilityElement = YES;
    // --- accessibility ---

    self.accessibilityTraits = UIAccessibilityTraitStaticText;
    self.accessibilityLabel = @"Actions";
    self.accessibilityElementsHidden = NO;
    self.isAccessibilityElement = YES;

    self.arrRows = [[NSMutableArray alloc] init];

    [self.arrRows addObject:[NSDictionary dictionaryWithObjectsAndKeys:[NSNumber numberWithInteger: popoverItemAccountSelect], @"item", nil]];

    switch (self.intPopoverStyle) {
        case ePopoverStyle_ACSel_Sort_Current_Portrait:
            [self.arrRows addObject:[NSDictionary dictionaryWithObjectsAndKeys:[NSNumber numberWithInteger: popoverItemSortCurrent], @"item", nil]];
            break;
---snip ---
    }

    [PopoverInstance setTemporaryOptions:self.intPopoverStyle content_type:self.strContentType];

}

-(void)viewDidAppear:(BOOL)animated {
    [super viewDidAppear:YES];


    [self.tableView reloadData];

    switch (self.intPopoverStyle) {
        case ePopoverStyle_ACSel_Portrait:
        case ePopoverStyle_ACSel_Sort_Current_Portrait:
        case ePopoverStyle_ACSel_Sort_Ended_Portrait:
        case ePopoverStyle_ACSel_DateSel_Future_Portrait:
        case ePopoverStyle_ACSel_DateSel_Past_Portrait:
        case ePopoverStyle_ACSel_DateSel_Both_Portrait:
        case ePopoverStyle_ACSel_DateSel_Both_CSV_Portrait:
            self.preferredContentSize = CGSizeMake(popoverContentMainWidth, popoverContentMainheight_Portrait);
            DLog(@"PoperHandlerController viewDidAppear PORT w=%d h=%d", popoverContentMainWidth, popoverContentMainheight_Portrait);
            break;
        case ePopoverStyle_ACSel_DateSel_Future_Landscape:
        case ePopoverStyle_ACSel_DateSel_Past_Landscape:
        case ePopoverStyle_ACSel_DateSel_Both_Landscape:
        case ePopoverStyle_ACSel_DateSel_Both_CSV_Landscape:
            self.preferredContentSize = CGSizeMake(popoverContentMainheight_Landscape, popoverContentMainWidth);
            DLog(@"PoperHandlerController viewDidAppear LAND w=%d h=%d", popoverContentMainheight_Landscape, popoverContentMainWidth);
            break;
        default:
            break;
    }

}

-(void)viewDidDisappear:(BOOL)animated {
    [super viewDidDisappear:YES];

    self.preferredContentSize = CGSizeZero;

}

- (void)didReceiveMemoryWarning
{
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

#pragma mark - Table view data source

- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
    // Return the number of sections.
    return 1;
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    // Return the number of rows in the section.
    return [arrRows count];
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    static NSString *CellIdentifier = @"Cell";
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
    if (cell == nil) {
        cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:CellIdentifier];
    }

    cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
    cell.selectionStyle = UITableViewCellSelectionStyleNone;

    NSInteger rowitem = [[[self.arrRows objectAtIndex:indexPath.row] objectForKey:@"item"] integerValue];

    NSUserDefaults *myDefaults = [NSUserDefaults standardUserDefaults];

    Styles *ap = [[Styles alloc] init];
    eScreenChoice screen = ScreenChoice_Calculate_Balance;

    switch (rowitem) {
        case popoverItemAccountSelect:
        {
            cell.textLabel.text = @"Account Select";

            cell.textLabel.font = [UIFont fontWithName:gstrDefaultFontName size:gintDefaultFontSize];

            cell.detailTextLabel.font = [UIFont fontWithName:gstrDefaultFontName size:gintDefaultFontSize];

            [ap setLabelColour:cell.textLabel screen:screen controlChoice:con_lblAccountNameCB style:addi_None];

            General *gen = [General alloc];
            NSInteger intAppSelectedACID = [Prefs returnSettingInt:kNSU_pfAppSelectedAccountID_candidate defaultValue:1];
            cell.detailTextLabel.text = [gen getAccountName:intAppSelectedACID];
            //cell.detailTextLabel.text = [NSString stringWithFormat:@"%@ ", cell.detailTextLabel.text];
            cell.detailTextLabel.adjustsFontSizeToFitWidth = YES;
            [cell.detailTextLabel sizeToFit];

            break;
        }
--snip---
        default:
            break;
    }

    // --- accessibility ---
    cell.textLabel.accessibilityTraits = UIAccessibilityTraitSelected;
    //cell.textLabel.accessibilityTraits = UIAccessibilityTraitUpdatesFrequently;
    cell.textLabel.accessibilityLabel = cell.textLabel.text;
    cell.textLabel.accessibilityElementsHidden = NO;
    cell.textLabel.isAccessibilityElement = YES;
    // --- accessibility ---

    // --- accessibility ---
    cell.detailTextLabel.accessibilityTraits = UIAccessibilityTraitSelected;
    //cell.detailTextLabel.accessibilityTraits = UIAccessibilityTraitUpdatesFrequently;
    cell.detailTextLabel.accessibilityLabel = cell.detailTextLabel.text;
    cell.detailTextLabel.accessibilityElementsHidden = NO;
    cell.detailTextLabel.isAccessibilityElement = YES;
    // --- accessibility ---


    // --- accessibility ---
    //cell.accessibilityTraits = UIAccessibilityTraitSelected;
    cell.accessibilityTraits = UIAccessibilityTraitUpdatesFrequently;
    cell.accessibilityLabel = cell.textLabel.text;
    cell.accessibilityElementsHidden = NO;
    cell.isAccessibilityElement = YES;
    // --- accessibility ---

    return cell;
}

- (void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath
{
    cell.backgroundColor = [General colorFromHexString:iOS7_gray_light];//[UIColor lightGrayColor]; //PopBG
}

#pragma mark - Table view delegate
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{

    if (self.popDelegate != nil && [self.popDelegate respondsToSelector:@selector(popoverHandler:didSelectItem:)] == YES) {

        NSInteger rowitem = [[[self.arrRows objectAtIndex:indexPath.row] objectForKey:@"item"] integerValue];

        //LEAVE THIS COMMENTED YOU WILL NEED IT IF YOU ADD A TAPABLE FEATURE HERE, AKA WITHOUT HAVING TO USE THE DONE BUTTON @!@
        //[self.popDelegate popoverHandler:self didSelectItem:rowitem];

        switch (rowitem) {
            case popoverItemAccountSelect: {

                NSInteger intAppSelectedACID = [Prefs returnSettingInt:kNSU_pfAppSelectedAccountID_candidate defaultValue:1];

                AccountSelTableViewController *nextController = [[AccountSelTableViewController alloc] initWithNibName:@"AccountSelTableView" bundle:nil];
                nextController.title = @"Accounts";
                nextController.intAppSelectedACID = intAppSelectedACID;

                switch (self.intPopoverStyle) {
                    case ePopoverStyle_ACSel_Portrait:
                    case ePopoverStyle_ACSel_Sort_Current_Portrait:
                    case ePopoverStyle_ACSel_Sort_Ended_Portrait:
                    case ePopoverStyle_ACSel_DateSel_Future_Portrait:
                    case ePopoverStyle_ACSel_DateSel_Past_Portrait:
                    case ePopoverStyle_ACSel_DateSel_Both_Portrait:
                    case ePopoverStyle_ACSel_DateSel_Both_CSV_Portrait:
                        nextController.preferredContentSize = CGSizeMake(popoverContentMainWidth, popoverContentMainheight_Portrait);
                        DLog(@"PoperHandlerController didSelectRow ActSel PORT w=%d h=%d", popoverContentMainWidth, popoverContentMainheight_Portrait);
                        break;
                    case ePopoverStyle_ACSel_DateSel_Future_Landscape:
                    case ePopoverStyle_ACSel_DateSel_Past_Landscape:
                    case ePopoverStyle_ACSel_DateSel_Both_Landscape:
                    case ePopoverStyle_ACSel_DateSel_Both_CSV_Landscape:
                        nextController.preferredContentSize = CGSizeMake(popoverContentMainheight_Landscape, popoverContentMainWidth);
                        DLog(@"PoperHandlerController didSelectRow ActSel LAND w=%d h=%d", popoverContentMainheight_Landscape, popoverContentMainWidth);
                        break;
                    default:
                        break;
                }

                self.navigationController.navigationBar.translucent = NO; //TEST THIS
                [General transitionOpen:self option:eTransitionOption_Ease_Vertical_All];
                [self.navigationController pushViewController:nextController animated:NO]; //POPANIM

                break;
            }
            case popoverItemSortEnded:
            case popoverItemSortCurrent: {

                SortingTableViewController *sortTVC = [[SortingTableViewController alloc] initWithNibName:@"SortingTableViewController" bundle:nil];

                //SortingTableViewController *sortTVC = [[SortingTableViewController alloc] initWithStyle:UITableViewStyleGrouped];

                switch (self.intPopoverStyle) {
                    case ePopoverStyle_ACSel_Portrait:
                    case ePopoverStyle_ACSel_Sort_Current_Portrait:
                    case ePopoverStyle_ACSel_Sort_Ended_Portrait:
                    case ePopoverStyle_ACSel_DateSel_Future_Portrait:
                    case ePopoverStyle_ACSel_DateSel_Past_Portrait:
                    case ePopoverStyle_ACSel_DateSel_Both_Portrait:
                    case ePopoverStyle_ACSel_DateSel_Both_CSV_Portrait:
                        sortTVC.preferredContentSize = CGSizeMake(popoverContentMainWidth, popoverContentSortHeight_Portrait);
                        DLog(@"PoperHandlerController didSelectRow SortTbl PORT w=%d h=%d", popoverContentMainWidth, popoverContentSortHeight_Portrait);
                        break;
                    case ePopoverStyle_ACSel_DateSel_Future_Landscape:
                    case ePopoverStyle_ACSel_DateSel_Past_Landscape:
                    case ePopoverStyle_ACSel_DateSel_Both_Landscape:
                    case ePopoverStyle_ACSel_DateSel_Both_CSV_Landscape:
                        sortTVC.preferredContentSize = CGSizeMake(popoverContentSortHeight_Landscape, popoverContentMainWidth);
                        DLog(@"PoperHandlerController didSelectRow SortTbl LAND w=%d h=%d", popoverContentSortHeight_Landscape, popoverContentMainWidth);
                        break;
                    default:
                        break;
                }

                sortTVC.intPopoverStyle = self.intPopoverStyle;

                self.navigationController.navigationBar.translucent = NO; //TEST THIS
                [General transitionOpen:self option:eTransitionOption_Ease_Vertical_All];
                [self.navigationController pushViewController:sortTVC animated:NO]; //POPANIM

                break;
            }
            case popoverItemDateFilterFuture:
            case popoverItemDateFilterPast:
            case popoverItemDateFilterBoth: {

                DateFilterTableViewController *dfTV = [[DateFilterTableViewController alloc] initWithNibName:@"DateFilterTableViewController" bundle:nil];

                //DateFilterTableViewController *dfTV = [[DateFilterTableViewController alloc] initWithStyle:UITableViewStyleGrouped];

                dfTV.strContentType = self.strContentType;
                dfTV.intPopoverStyle = self.intPopoverStyle;

                switch (self.intPopoverStyle) {
                    case ePopoverStyle_ACSel_Portrait:
                    case ePopoverStyle_ACSel_Sort_Current_Portrait:
                    case ePopoverStyle_ACSel_Sort_Ended_Portrait:
                    case ePopoverStyle_ACSel_DateSel_Future_Portrait:
                    case ePopoverStyle_ACSel_DateSel_Past_Portrait:
                    case ePopoverStyle_ACSel_DateSel_Both_Portrait:
                    case ePopoverStyle_ACSel_DateSel_Both_CSV_Portrait:
                        dfTV.preferredContentSize = CGSizeMake(popoverContentMainWidth, popoverContentDateFilerHeight_Portrait);
                        DLog(@"PoperHandlerController didSelectRow DateFil PORT w=%d h=%d", popoverContentMainWidth, popoverContentDateFilerHeight_Portrait);
                        break;
                    case ePopoverStyle_ACSel_DateSel_Future_Landscape:
                    case ePopoverStyle_ACSel_DateSel_Past_Landscape:
                    case ePopoverStyle_ACSel_DateSel_Both_Landscape:
                    case ePopoverStyle_ACSel_DateSel_Both_CSV_Landscape:
                        dfTV.preferredContentSize = CGSizeMake(popoverContentDateFilerHeight_Landscape, popoverContentMainWidth);
                        DLog(@"PoperHandlerController didSelectRow DateFil LAND w=%d h=%d", popoverContentDateFilerHeight_Landscape, popoverContentMainWidth);
                        break;
                    default:
                        break;
                }

                self.navigationController.navigationBar.translucent = NO; //TEST THIS
                [General transitionOpen:self option:eTransitionOption_Ease_Vertical_All];
                [self.navigationController pushViewController:dfTV animated:NO]; //POPANIM

                break;
            }
            case popoverItemCSVExport:
            {
                [self.popDelegate popoverHandler:self didSelectItem:rowitem];
                break;
            }
            default:
                break;
        }

    }

}


- (NSString *)tableView:(UITableView *)tableView titleForFooterInSection:(NSInteger)section {

    NSString *ret;
    ret= nil;
    return ret;

}

- (CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section {

    CGFloat ret = nanf(NULL);

    switch (self.intPopoverStyle) {
        case ePopoverStyle_ACSel_DateSel_Both_CSV_Landscape:
        case ePopoverStyle_ACSel_DateSel_Both_CSV_Portrait:
            ret = 60.0f;
            break;
        default:
            break;
    }

    return ret;
}


- (UIView *)tableView:(UITableView *)tv viewForFooterInSection:(NSInteger)section
{
    UIView *ret = nil;

    switch (self.intPopoverStyle) {
        case ePopoverStyle_ACSel_DateSel_Both_CSV_Landscape:
        case ePopoverStyle_ACSel_DateSel_Both_CSV_Portrait:
        {
            CGRect footerRect = [self.tableView rectForFooterInSection:section];
            UIView *footer = [[UIView alloc] initWithFrame:CGRectMake(0, 0, footerRect.size.width, 20.0)];
            footer.autoresizesSubviews = YES;
            footer.autoresizingMask = UIViewAutoresizingFlexibleWidth;
            footer.userInteractionEnabled = YES;

            footer.hidden = NO;
            footer.multipleTouchEnabled = NO;
            footer.opaque = NO;
            footer.contentMode = UIViewContentModeScaleToFill;

            UILabel *footerLabel = [[UILabel alloc] initWithFrame:CGRectMake(10, 10, footerRect.size.width - 20, 20.0)];
            footerLabel.backgroundColor = [UIColor clearColor];

            footerLabel.text = @"Tap 'Apply' to set filters";

            footerLabel.font = [UIFont fontWithName:gstrDefaultFontName size:gintFooterNoteFontSize];

            Styles *ap = [[Styles alloc] init];
            eScreenChoice screen = ScreenChoice_Category_Maint;
            footerLabel.textColor = [UIColor whiteColor];
            footerLabel.textColor = [ap setColour:screen controlChoice:con_tableFooter style:addi_None];

            footerLabel.numberOfLines = 0;
            footerLabel.textAlignment = NSTextAlignmentCenter;

            [footer addSubview:footerLabel];
            //xxxds;
            return footer;
        }
        default:
            return ret;
            break;
    }

}

@end
-----

#import <Foundation/Foundation.h>
#import "Constants.h"

@interface PopoverInstance : NSObject

+(void)setup;
+(void)setTemporaryOptions:(ePopoverStyle)intPopoverStyle content_type:(NSString*)strContentType;
+(BOOL)haveOptionsChanged:(ePopoverStyle)intPopoverStyle content_type:(NSString*)strContentType;

@end
-----


#import "PopoverInstance.h"
//#import "WYPopoverController.h"
#import "General.h"
#import "Styles.h"
#import "ManageDateRange.h"
#import "BalanceGuideAppDelegate.h"
#import <WYPopoverController/WYPopoverController.h>

@implementation PopoverInstance

+(void)setup
{
    [WYPopoverController setDefaultTheme:[WYPopoverTheme theme]];

    [[WYPopoverBackgroundView appearance] setViewContentInsets:UIEdgeInsetsMake(0, 1, 0, 1)];
    [[WYPopoverBackgroundView appearance] setOuterCornerRadius:10];
    [[WYPopoverBackgroundView appearance] setMinOuterCornerRadius:10];

    [[WYPopoverBackgroundView appearance] setOuterShadowBlurRadius:6];
    [[WYPopoverBackgroundView appearance] setOuterShadowColor:[UIColor colorWithWhite:0 alpha:0.65]];
    [[WYPopoverBackgroundView appearance] setOuterShadowOffset:CGSizeMake(0, 2)];

}

+(void)setTemporaryOptions:(ePopoverStyle)intPopoverStyle content_type:(NSString*)strContentType {

    NSUserDefaults *myDefaults = [NSUserDefaults standardUserDefaults];
    NSString *sort_current = [myDefaults stringForKey: kNSU_SortingCurrent];
    NSString *sort_ended = [myDefaults   stringForKey: kNSU_SortingEnded];
    NSString *account = [myDefaults stringForKey: kNSU_pfAppSelectedAccountID];

    [myDefaults setObject:sort_current   forKey: kNSU_SortingCurrent_candidate];
    [myDefaults setObject:sort_ended     forKey: kNSU_SortingEnded_candidate];
    [myDefaults setObject:account   forKey: kNSU_pfAppSelectedAccountID_candidate];

    [myDefaults synchronize];


    ManageDateRange *candidate = [[ManageDateRange alloc] init];
    [candidate setStrPrivateContentType:@"TEMP"];
    [candidate setStrPrivateDateCustomType:intPopoverStyle];

    ManageDateRange *current = [[ManageDateRange alloc] init];
    [current setStrPrivateContentType:strContentType];
    [current setStrPrivateDateCustomType:intPopoverStyle];
    [current getGoodDates];

    NSDate* currentStartDate = [current getStartNSDate];
    NSDate* currentEndDate = [current getEndNSDate];

    [candidate setDatPrivateStartDate:currentStartDate];
    [candidate setDatPrivateEndDate:currentEndDate];
    [candidate checkDates];

    if ([candidate badDateSelected] == TRUE) {

        // hmmmm
    }

    [candidate saveDateRangeDate];

}

+(BOOL)haveOptionsChanged:(ePopoverStyle)intPopoverStyle content_type:(NSString*)strContentType {

    BOOL changed = NO;

    //CHECK CURRENT OR ENDED SORTING
    NSUserDefaults *myDefaults = [NSUserDefaults standardUserDefaults];
    NSString *current_sort = [myDefaults stringForKey:kNSU_SortingCurrent];
    NSString *ended = [myDefaults stringForKey:kNSU_SortingEnded];
    NSString *account = [myDefaults stringForKey:kNSU_pfAppSelectedAccountID];

    NSString *current_candidate = [myDefaults stringForKey:kNSU_SortingCurrent_candidate];
    NSString *ended_candidate = [myDefaults stringForKey:kNSU_SortingEnded_candidate];
    NSString *account_candidate = [myDefaults stringForKey:kNSU_pfAppSelectedAccountID_candidate];

    //WORK OUT IF ANYTHING HAS CHANGED, THEN UPDATE THE UI IF THERE IS A CHANGE
    //SO CANDIDATES WILL HAVE VALUES!!

    if (current_sort != current_candidate) {
        [myDefaults setObject:current_candidate forKey:kNSU_SortingCurrent];
        changed = YES;
    }

    if (ended != ended_candidate)
    {
        [myDefaults setObject:ended_candidate forKey:kNSU_SortingEnded];
        changed = YES;
    }

    if (account != account_candidate) {
        [myDefaults setObject:account_candidate forKey:kNSU_pfAppSelectedAccountID];
        changed = YES;
    }

    [myDefaults synchronize];

    if (![strContentType isEqualToString:@""]) {

        ManageDateRange *candidate = [[ManageDateRange alloc] init];
        [candidate setStrPrivateContentType:@"TEMP"];
        [candidate setStrPrivateDateCustomType:intPopoverStyle];

        [candidate getGoodDates];
        NSDate* candidateStartDate = [candidate getStartNSDate];
        NSDate* candidareEndDate = [candidate getEndNSDate];


        ManageDateRange *current = [[ManageDateRange alloc] init];
        [current setStrPrivateContentType:strContentType];
        [current setStrPrivateDateCustomType:intPopoverStyle];
        [current getGoodDates];
        NSDate* currentStartDate = [current getStartNSDate];
        NSDate* currentEndDate = [current getEndNSDate];

        if (![candidateStartDate isEqualToDate:currentStartDate] ||
            ![candidareEndDate isEqualToDate:currentEndDate])
        {
            [current setDatPrivateStartDate:candidateStartDate];
            [current setDatPrivateEndDate:candidareEndDate];
            [current checkDates];

            if ([current badDateSelected] == TRUE) {

                // hmmmm
            }

            [current saveDateRangeDate];
            changed = YES;

            BalanceGuideAppDelegate *appDel = (BalanceGuideAppDelegate*) [[UIApplication sharedApplication] delegate];
            appDel.gbooForecastRefreshNeeded = TRUE;
            appDel.gbooCategoriesHorizGrahRefreshNeeded = TRUE;
        }
        //Read these dates on the parent screen


    }


    return changed;
}

@end

@JulesMoorhouse
Copy link
Author

I will try going back to 0.3.8, I will let you know if that fixes it.
I'm pretty sure it will as the issue only started occurring after updating pods, now I think about it.

@JulesMoorhouse
Copy link
Author

Yep that fixed it, so there must be an issue with the new release ?

@vitalys
Copy link
Collaborator

vitalys commented Oct 10, 2016

Thank you for the confirmation. I'll take a look.

@vitalys vitalys added the bug label Oct 10, 2016
@vitalys vitalys added this to the 0.4.0 milestone Oct 10, 2016
vince4 added a commit to vince4/WYPopoverController that referenced this issue Oct 31, 2017
vince4 added a commit to vince4/WYPopoverController that referenced this issue Oct 31, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants