in my app i got a TTLauncher Object with some TTLauncherItems in it.
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. (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?
Thanks for help :)
so i finally used a simple plist to store my items.
every time my items get new arranged or an item gets added, i update my plist with this new data. when the view gets initialised, i building all this items out of my plist.
a better way would be to store it in a database i think, but for me, a plist is enough.
I have ran out in the same issue as I told you earlier: so
You store your additional icons in a table.
on 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
[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.
Related
I'm currently developing and iOS app in Swift 2.0 and I'm running into the following issue:
I have a custom query that fetches a list of items that populate a UITableView. When tapping the cell I get the ( values[indexPath.row] ) Object and segue it to another view controller for display as well as the list of items (for other actions like swipe to move to the next one).
My issue comes from a background process that fetches periodically new data and saves it to Realm.
Since Realm keeps all nice and updated, the indexPath.row will fetch a different value (the list of values has changed in the meantime due to the automatic updater) resulting in showing something that is not quite what was tapped.
Both Realm and the updater are working, but this results in a confusing experience for the user.
Am I missing something obvious?
Thanks a lot for the help!
PS: I've looked also at ABFRealmTableViewController, but I'm not displaying the whole data but a filtered (and ordered) subset.
Probably the easiest way of preventing this issue is to observe notifications sent out by Realm whenever a write transaction (i.e. an update) occurs and update your UI accordingly:
// Observe Realm Notifications
let token = realm.addNotificationBlock { notification, realm in
viewController.updateUI()
}
ABFRealmTableViewController supports filters via NSPredicate and sort descriptors as well. So you might want to give it another try.
I have a login page with two button one for facebook login one with email and pass login,after login I will load some information in table, my question is what is the best way to load this information, create two .xib file tableView for each login, or just one .xib file.
Thanks in advance!
I would suggest the following solution :
1 create a second view, call it something like ListVC.xib.
2 in ListVC add a member NSMutableArray called listData.
3 in your first window, said loginVC.xib, each of your button will load data in an NSMutableArray, each in its own way. then each open ListVC.xib, and set listData member to the array it just load.
If you use this solution, or something close, you will not create 2 ViewController, with nearly the same code. Basically, copy and pasting your code is bad. If you need to modify it, it will become much more complicated.
I have a basic RSS Reader I made from three20 tutorials using TTLauncherView as a menu to different feeds and TTTableViewController to show the feed list.
However, I am stuck at the point where from the feed list I click to view the feed item details. I use TTTableImageItem to display my feed items and I'm clueless as to how I am to use the URL variable in said TTTableImageItem to pass objects to the view controller showing the feed item.
I did some searching and I am lead to think that this cannot be done except via TTURLRequest, which leaves me even more confused.
Most of my code is adapted from IOSGuys tutorial, which uses a custom data source, data model and parser. I have tried making the data source and data model a singleton but to no avail and I'm unsure if that's even the best way to proceed for something as (presumably) simple as this.
Ideally I intend to pass the entire array of feed items with another argument for the index so that I can make use of UIPageControl to swipe between feeds when I'm at a more in-depth view.
Much help is appreciated! I have been spending too long looming around already!
The usual way of doing this is to have some sort of global singleton Data Manager class that manages the data models through Core Data, In-Memory Stores or other ways. Each model would have some sort of unique identifier. Doing it this way lends itself to a URL only stack needed to recover your navigation history without having to write state out to file in order to restore. You also can bring up any page in the app at any place with only a single URL. Using a URL scheme only then becomes trivial as you can do something like:
yourapp://blogs/jd82kd9
and have the blog view controller's init method contact the Data Manager for the blog with the unique identifier of jd82kd9
In your navigator's mappings, you would have something like this:
[map from:#"yourapp://blogs/(initWithBlogID:)") toViewController:[MyBlogViewController class]];
and then the initWithBlogID method would have the signature:
- (id)initWithBlogID:(NSString *)blogID;
see also Three20 : how to pass a class of objects between 2 views
Basically I want to recreate the "filebrowser" ("drilldown" Tableview) from the DropBox iPhone app using a UITableview and the DropBox SDK.
The SDK has a method restClient which, if called, returns the paths for all the files and folders at a given path. E.g. [self.restClient loadMetadata:#"/"]; or [self.restClient loadMetadata:#"/Photos"];
Currently the table gets populated by an array filePaths wich in its turn get's populated with paths by a call to the restClient method.
My initial idea was to create an array which helped me find out if a selected cell contained a path for a file or a folder - and in case of the latter would use pushViewController to load the same view but would populate filePaths by doing this [self.restClient loadMetadata:pathInSelectedCell];
I found out that this isn't the right way at all to tackle this problem (for numerous reasons), but I wouldn't know a way to do it differently.
What would be the right architecture for this problem?
Thanks in advance!
N.B. DropBox doesn't allow recursive directory/file listing.
I fixed it!
Turns out the best way for me was to pass the filePath to the newly created object thru a constructor.
Got a conceptual question: If I got a tableview with about 100 items and the user can check as many as he wants from that list, how and where do I save the checked status of each individual item for later reuse?
In your own internal structures. UITableView isn't a database. It merely is an interface to your data. Any selection, deletion, addition, etc. will have to be handled by your code and stored. Typically you have some sort of a database or structure associated with the UITableView elements. When you get a check action, you can update a variable in that structure.
For an example of an SQL database backed UITableView app, see here.
For storing the checked elements of tableview, you have to maintain your code in didselectRow mthos of tableview. So, whenever you check the tableview row you can save it in an array. And save that array in the "NSUSerDefaul". So, that whenever you close the application, you can get back your selected tableview row array from "NSUserDefault". Or you can use sqlite database but it is better to use NSUserDefault as there is simple thing to do.
Please give your response if you find any problem.
You can use NSUSerDefault in your application from the following link: click here