简体   繁体   English

动态将项目添加到TTLauncher

[英]dynamically add Items to TTLauncher

in my app i got a TTLauncher Object with some TTLauncherItems in it. 在我的应用中,我得到了一个带有一些TTLauncherItems的TTLauncher对象。 Now i want to add some Items dynamically inside my App by pressing a button. 现在,我想通过按一个按钮在我的应用程序内部动态添加一些项目。

Is there a simple way to do that or do i have to create my own methods? 有没有简单的方法可以做到这一点,或者我必须创建自己的方法? In the original facebook application there is already something like that implemented. 在原始的Facebook应用程序中,已经实现了类似的功能。 (You can add your Friends to the Launcher) (您可以将您的朋友添加到启动器中)

If not, what would be the best thing to do something like that? 如果没有,那么做这样的最好的选择是什么? Store all "extra items" in a plist oder even in a database and query them, each time TTLauncher object is initialized? 每次初始化TTLauncher对象时,将所有“额外项目”存储在plist oder甚至数据库中,并对其进行查询?

Thanks for help :) 感谢帮助 :)

so i finally used a simple plist to store my items. 所以我终于用一个简单的plist来存储我的物品。 every time my items get new arranged or an item gets added, i update my plist with this new data. 每次我的项目获得新的时间安排或项目被添加,我用这个新的数据更新我的plist。 when the view gets initialised, i building all this items out of my plist. 当初始化视图时,我将所有这些项都构建在我的plist中。

a better way would be to store it in a database i think, but for me, a plist is enough. 更好的方法是将其存储在数据库中,我认为,但对我来说,一个的plist就足够了。

I have ran out in the same issue as I told you earlier: so 我已经遇到了我之前告诉您的同一问题:

  1. You store your additional icons in a table. 您将其他图标存储在表中。

on LoadView() 在LoadView()上

you try to use a dynamic array like this: 您尝试使用这样的动态数组:

_launcherView.pages = [NSArray arrayWithObjects: dynamicArr1];

Where your dynamic Array is filled like this: 您的动态数组填充如下:

caching of images of each icon here: 缓存每个图标的图像在这里:

http://groups.google.com/group/three20/msg/66ec114401af3b06 http://groups.google.com/group/three20/msg/66ec114401af3b06

[dynamicArr1 insertObject:[[[TTLauncherItem alloc] initWithTitle:name
                                                                              image:name
                                                                                URL:url canDelete:YES] autorelease] atIndex:i];

Let me know if that's what you were looking for. 让我知道您是否在寻找。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM