Add support to addItem and removeItem to DashboardView #87

Closed
wants to merge 1 commit into
from
View
18 iphone/Classes/TiUIDashboardViewProxy.m
@@ -8,6 +8,7 @@
#import "TiUIDashboardViewProxy.h"
#import "TiUIDashboardView.h"
+#import "TiUIDashboardItemProxy.h"
#import "TiUtils.h"
#import "LauncherItem.h"
#import "LauncherButton.h"
@@ -27,6 +28,23 @@ -(void)stopEditing:(id)args
[[self view] performSelectorOnMainThread:@selector(stopEditing) withObject:nil waitUntilDone:NO];
}
+-(void)addItem:(id)item
+{
+ ENSURE_UI_THREAD_1_ARG(item);
+ ENSURE_SINGLE_ARG(item, TiUIDashboardItemProxy);
+ TiUIDashboardView *v = (TiUIDashboardView*)[self view];
+ LauncherView *launcher = [v launcher];
+ [launcher addItem:((TiUIDashboardItemProxy *)item).item animated:YES];
+}
+
+-(void)removeItem:(id)item
+{
+ ENSURE_UI_THREAD_1_ARG(item);
+ ENSURE_SINGLE_ARG(item, TiUIDashboardItemProxy);
+ TiUIDashboardView *v = (TiUIDashboardView*)[self view];
+ LauncherView *launcher = [v launcher];
+ [launcher removeItem:((TiUIDashboardItemProxy *)item).item animated:YES];
+}
-(void)fireEvent:(NSString *)type withObject:(id)obj withSource:(id)source propagate:(BOOL)propagate
{