I’ve made a Folder in my application via JWFolders. My problem is that I’ve set up some code to get some strings from parse.com and if there’s no connection it diplays some text in a CLTickerview. However, if I open the folder a few times the text duplicates every time I open the folder. Here some Images:
After opening first time: 
After about 5 times: 
After 10 times: 
My code:
PFQuery *query = [PFQuery queryWithClassName:@"TestObject"];
[query getObjectInBackgroundWithId:@"object1"
block:^(PFObject *textu, NSError *error) {
if (!error) {
// start the tickerview
CLTickerView *ticker = [[CLTickerView alloc] initWithFrame:CGRectMake(0, 35, 320, 35)];
ticker.marqueeStr = [textu objectForKey:@"text"];
ticker.marqueeFont = [UIFont systemFontOfSize:26];
[self.view addSubview:ticker];
// if there's connection
} else {
// Log details of our failure
CLTickerView *ticker = [[CLTickerView alloc] initWithFrame:CGRectMake(0, 35, 320, 35)];
ticker.marqueeStr = @"Keine Internet Verbindung";
ticker.marqueeFont = [UIFont systemFontOfSize:26];
[self.view addSubview:ticker];
//if there's no connection;
}
}];
Is there a way to delete the stuff inside the tickerview, after the folder is closed or something like that?
Does have anyone suggestios or solutions for me?
Thanks.
Each and every time you open the folder, you are creating separate instances of
CLTickerView *tickerand adding to the view as subview using this line[self.view addSubview:ticker];. If you want to add that only once, you need to create the ticker in a place where you wont call theallocmethod repeatedly.Create in
viewDidLoador so,Then use it as,
Remember that whenever you call
CLTickerView *ticker = [[CLTickerView alloc] initWithFrame:CGRectMake(0, 35, 320, 35)];, it creates separate copies and you cant access the previous one, once the new one is created.Whenever you want to remove it just use
[ticker removeFromSuperview];