how to remove a Item after add this in the Pages-Array?
I tried it here:
launcherView.pages = [NSArray arrayWithObjects:
[NSArray arrayWithObjects:
[self launcherItemWithTitle:@"Pers. Starts."
image:@"bundle://animexx-72.png"
URL:@"tt://startseite"],
[self launcherItemWithTitle:@"ENS"
image:@"bundle://animexx-72.png"
URL:@"tt://ens"],
[self launcherItemWithTitle:@"Kontakte"
image:@"bundle://animexx-72.png"
URL:@"tt://kontakte"],
[self launcherItemWithTitle:@"Einstellungen"
image:@"bundle://animexx-72.png"
URL:@"tt://einstellungen"],
[self launcherItemWithTitle:@"Admin"
image:@"bundle://animexx-72.png"
URL:@"tt://admin"]
, nil]
, nil];
//Check if ENS-Admin enabled
if ([SelfViewHandler IsENSAdminSet])
{
TTLauncherItem* item;
item = [launcherView itemWithURL:@"tt://admin"];
[launcherView removeItem:item animated:false];
}
But the Item is still there.
(If-Clause is true, checked it in Debugger and Breakpoint)
The object
item = [launcherView itemWithURL:@"tt://admin"]is actually doesn’t exists in yourTTLauncherViewand isn’t being removed because of that.Each object gets a reference when it’s being created so the object you’re adding when creating the pages array and the object you’re creating in your if statement are different.
In order to remove an object from
TTLauncherView, you need a reference to it. You can do something like that:It makes sense to have a function that removes a launcher item based on the URL, like
(but there isn’t yet 🙂 )