MichaelAngelo
MichaelAngelo

Reputation: 375

Splitviewcontroller logic is not right, duplicate content

I am trying to port my iphone app to Ipad, the logic does not work with splitviewcontroller.

In viewDidLoad i call a function that updates the view and with setSearchResult (overriding the setters)

the problem is everytime when i select a row in the masterviewcontroller the contents of the detailviewcontroller get added to it instead of removing the old contents..

i think this gives me the problem:

        CGRect framephoto = CGRectMake(0, 85, 320, 186);
        carousel = [[iCarousel alloc] initWithFrame:framephoto];
        [self.scrollview addSubview:carousel];

and this table (custom mg)

    // the tables grid
    CGSize tablesGridSize = IPAD_TABLES_GRID;
    tablesGrid = [MGBox boxWithSize:tablesGridSize];
    tablesGrid.contentLayoutMode = MGLayoutGridStyle;
    [self.scrollview.boxes addObject:tablesGrid];

I think because everytime when i select a row and it gets to these codes it adds another one.

I am not a pro so maybe this question is stupid, but every tip is welcome.. Whats the best way to handle this ?

Upvotes: 0

Views: 69

Answers (1)

Thomas Kekeisen
Thomas Kekeisen

Reputation: 4406

Unfortunately, the best way to handle this is to use the UINavigationController you should already have in use in your application. A easy solution for your problem is to just remove all subviews before you are adding new ones (maybe you have to safe the references to the iCarousel and the tablesGrid for this). A even better way is to just update the data of the views you already have allocated.

Upvotes: 1

Related Questions