iPhone: Grouping records in multiple UITableView views - iphone

Let me first say, I know how to create sections and group records within a UITableView.
What I am wanting to do is something similar to creating a photo album. So, I have all my data objects coming from core data, and, I want to be able to create a custom group, such as "My Trip to Mexico" and "First Birthday". Then, the user should be able to add objects/records into new sections/albums. So, basically the user is creating custom sections with their own custom names, and then choosing what records should go into that section/album.
So, I am just wondering what is the best way to do this? I am thinking that I would just create some extra attributes for my core data model. Or, would I create a whole new "Album Section" object, and somehow use that?
Point me in the right direction. :)

I Would not recommend defining the album as an attribute within the image object, as the image could then only be part of a single album
datamodel http://www.freeimagehosting.net/uploads/d961b23681.png
I would recommend the datamodel above.
With this datamodel you could add images to multiple albums.
I assume groups albums and sections within your description are the same.
If not you should create an additional entity and relation for different "meanings"
for example: an image always has to be Part of one single Event, but can be added to multiple custom groups (like in iPhoto)

Related

Including list view of relationship entity on update page

I am trying to extend an update view to include a list view of some related items below the edit form.
I have two models, Publishers and Volumes, which have a many to many relationship. What I am trying to do is this.... when a user clicks on the edit button for a publisher, I want them to go to a page with the standard edit fields, but also have a list view below the form that lists all of the volumes that are connected to that publisher via their relationship.
Is there an easy way to do this?
I hope this makes sense.
As #tabacitu mentioned, Backpack doesn't currently have an built in solution for this. That said, this could maybe work for you:
This would allow you to use all functionality of the nested list view including interacting with the entities without conflicting at all with the parent
Step 1, Build your normal CRUDs
Build out two normal CRUDs, one for Publishers, and one for Volumes
Step 2, Make a frameless layout
copy vendor/backpack/base/layout.blade.php
name it frameless-layout.blade.php
remove #include('backpack::inc.main_header') and #include('backpack::inc.sidebar')
Step 3, Make a custom list view
copy vendor/backpack/crud/list.blade.php
name it sub-list.blade.php
change the top line to #extends('backpack::frameless-layout')
Step 4, Make a custom field
Create a custom form field that contains an iFrame
Inside your custom field template, have it set the url of the iFrame to the "list" url of the related resource
You'd also need to utilize List Filters and a method for setting them dynamically so that the sub-list shows only the records related to the parent
Step 5, Configure and use the field
In your crud controllers, use the addField to add the the configuration for the new field and its related model
Indeed, there's no standard functionality to do that in Backpack. It's a pretty unusual way to do things. But it's not too difficult to achieve it.
If there aren't too many Vendors for one Publisher (as I expect it's the case here), I would keep it simple and NOT try to include the entire Backpack list view (with ajax, buttons, filters, etc) on top of the form. I would add a standard HTML table with the entries (and optionally buttons to Edit Vendor with target=_blank).
Here's how I would go about it:
In the Publisher CRUD, I would use a custom view for the Edit operation; you can do that using $this->crud->setEditView('edit_publisher_with_vendors') in your setup() method;
In that custom edit view (edit_publisher_with_vendors.blade.php in my example), I would copy-paste everything inside the edit.blade.php view that Backpack/CRUD is using, and add a table with the Vendors on top of the Edit form; notice you have the current entry as $entry in this view; since there's a relationship on the model, you would be able to check if it has vendors using $entry->vendors()->count(), and get the vendors using $entry->vendors.
Hope it helps.

How to use the 'didSelectRowAtIndexPath' for displaying photos from a particular album

I have setup a table view that displays users albums from the device. I'm using ALAssets to populate the table view.
Now how do I display photos from the particular album in another view?...
I have seen tutorials regarding NSDictionaries... however it needs the 'keys' and 'values' to be fixed... then it loads the corresponding data.
But is there any other way to do this..., a more dynamic one sort of... since the album names might not be same in each user's device...
The simplest way to go is to use a navigation controller and push a new instance of a view controller (a new one dedicated to showing albums or a new instance of the same one, depending on preference). That view controller you give info about which group to show, and potentially also hand it the AL stuff.

Create new contact view

I have been told to do the following:
Implement contact add view like below and let him store in SQL table,
contacts will have Name, phone no of mobile, work , fax, email . view
should look like below:
My question:
Can you clarify me, should I use Addressbook or simply a custom view and a sql database to save data from that custom view? I mean both the options are open here?
You can not use address book to create custom content in your application.
So you should implement your custom view to collect information to store in your database (sqlite?)
If you are creating contact / modifying existing contact information, you can use address book framework.
Answer for the question in comment (how to go about for this kinda UI)
Yes, Have the grouped table view to get the desired background
Among the many possible solutions, here is the simplest one perhaps:
Have 2 sections in your table.
First section has a special kinda cell. Only one row in this section.
You can use Interface Builder to create the cell contents or you could build from code.
Second section contains similar cells. It can contain as many as the fields you need.
Just specify UITableViewCell's style to be UITableViewCellStyleValue2 and specify the values accordingly

Creating detail view content programmatically?

I am making an app which uses a splitviewcontroller and will have over 100 different pieces of content. I want to make it so when I select a row, the content changes dynamically. Before, I was creating 100 nib files and separate view controllers before realizing the inefficiency.
I want different labels shown in the detail view when I select a row.
As a guide, I am using the MultipleDetailViews sample code provided by apple.
Also, if anyone can help me out with how to have a button for back and forward (changing table view content) that would be great!
If they are the same just different labelled views, then you could create a single nib file with a view that has all the common elements and then perhaps, create a small template view in the nib which is not contained in the main view and is hidden by default, every time you switch to a new page you can the use you can then use you template view to build the fields for you page. You could also have a few different template views for the different kinds of fields you want to display. To store all this information to drive all of this, you can create simple property list files for each page which contain information like the field title, order, my type or width. Getting the path to a property list file from you app package is easy with methods like [[NSBundle mainBundle] patterForResourceOfName:extension:];, Using properties list can make it easy to change you app, it is even possible to add features like uploading of new nibs without having to resubmit you app to apple, just do a periodic search for new property list files from some server, parsing PropertyList files is really easer too, NSDictionary and NSArray all serialise them selves as property list.

how to save/retrieve data image/text into android xml file

I am building one feature of a fishing app.I will need to store picture and description of species of fish found in various lakes of my state. I will display a list view of those species and allow the user to choose which one to display. What is the best option to store and retrieve the data (species picture and description) I understand I can use a xml strings. How can I setup my xml string to do this?
Thanks
If I understood your question correctly, you need:
-a ListView showing species,
onClick: show new View with details of the selected species with photo.
And all this, from an XML?
If you're using a local XML file inserted in the assets you can use a Parser to Parse the data from the XML to Objects.
Then in the activity, you create a listview using the species objects.
Add an OnItemClickListener to the listview to determine who is clicked.
show a new view with the details of the selected species.
If you want extra information, ask ahead :) I hope this was helpful