Dynamic editable form with UITableView and storyboard - ios

I'm trying to create a edit user information page for the user that is using my app, which their editable info would include something like: name, surname, phone numbers, emails, etc.
So I want to create a form using a UITableView with prototype cell in storyboard for each type of data, but here's the catch: There can be a variable amount of each type e.g. user can add or delete emails. Each cell might have a text field for the user to modify their data.
My question is, how do I retrieve the information entered into each cell? Because their can be a variable amount of each cell, I cannot statically tie each field to a property in my class.

You can make custom cells according to the type of cell. So whenever user want to add any field then they can select from your predefined type of cells. It will be easy for you to retrieve data according to their type and they also can multiple field of same category or other category..
You can give option to add a custom cell in which label and textfield will be.. then label text can be retrieved as category and textfield can be retrieved as value for that category. To recognize the type of category you can mention the category in a picker. And write the code for the validation of that type of cell. And if their id other category jus put its type as string. Likewise you can retrieve both value and type.

Related

Is there a way to get a cell value from the selected row in DBGrid? (Delphi)

First of all, I'm pretty new to Delphi.
I have a DBGrid connected to a DataSource and filled up with data from an SQL server. What I want to achieve is that when I press a button, it brings up a new window with comboboxes/editboxes, all filled up with the previously selected (in DBGrid) row's data and modify them and execute an UPDATE query.
In order to do that, I need the primary key value of the selected record, so my little program would know which row should it display and update.
My question is, how can I get a specific cell value (in this case, an id) of a selected record from a DBGrid?
If you know the column for the ID field you can inspect its Field property. The Fields Value will contain the current ID.

Settings view with user text input

I'm new to iOS development and trying to figure out how these in-app settings views are done where you can change your contact details and a few other settings.
My first attempt was a static table but I couldn't figure out how to override the cell content with a text input field. Is this the way to go? If yes, what's the easiest way to add a text input field to the cell that I can preset with the user data (coming from our server)?
For a static TVC, set the cell type to custom and you can drag out labels and fields as you need.

Click inside UILabel

I'm working with an iOS application. What I'm trying to accomplish,
Let's say the text for the UILabel is "Rikard bla bla bla Rikard".
So in this text I have tagged two people. And when I click on one of them I display a detailed view about that person. So this is working great if I just have one user named Rikard, and it works with multiple too and I can present the detailed view. But my problem is that I don't know which user I clicked on if I have tagged multiple people with the same name. I know I have to go for the ID. Right now I display by name, so it's not that strange that it's not working.
Should I save information in the database in which order the user entered the two tags or how can I ever know who is who?
Please point me in the right direction. The functionality is working great, it's just the logic for who to display when I click. I want to recreate the tagging system that Facebook have when people comment a photo and tag people in it. You can write multiple names there and Facebook will of course know who is who.
ADDED
So what I do when I'm creating my tags. I choose from a list of available tags or I can write them. I will always know which tag to save the current comment with. But the problem occurs when I display them in to different parts,
The first part is just a UILabel with all the tags in a row, separated by blank space. Here I know where the user tapped and I can display the detailed view for the with the name.
The second part is all of the text, I can find where the tags are located, on which line and between what pixels on that line. And I know when I click on them.
But what I need is the logic for clicking two tags with the same name in the same UILabel. Should I somehow save the order of how I saved the tags?
One option that comes to mind is using an NSAttributedString in the label. You may add arbitrary attributes to ranges of text using that class, and its mutable subclass. Thus, you could add a custom attribute to the range of each user's name, and assign for the corresponding value some unique identifier for the user – possibly an NSNumber or NSString that can be used to retrieve the proper information.

How to create pass with custom design?

Have a pass with Store Card style. How can I add 2nd row with data and change the label position (label should be below the value)? When I add second item in secondaryFields array it inserts the item in the 2nd column, the same row. Thanks.
Image as example:
If you have a look here "Pass Style Sets the Overall Visual Appearance":
https://developer.apple.com/library/ios/documentation/UserExperience/Conceptual/PassKit_PG/Chapters/Creating.html#//apple_ref/doc/uid/TP40012195-CH4-SW45
It gives an overview of what fields are allowed on the different pass types.
To achieve what you describe you want to make the pass a generic pass and specify both secondary and auxiliary fields.
To switch the label to be below the data, you need to flip the values when specifying them, so set label ="Gold" and the value="Level". However it will still have the same formatting (the top one will still be smaller text)

Blackberry hide fields

I have a dropdown list in which I select how many people are going to a party. When the user changes the value of the dropdown list, I want as many fields as the number selected to appear and hide the rest.
But I don't know how can I hide or delete fields because I don't know their index.
Yes you will need to have the fields you want to hide as a global variables.
You will also need to get the value the user has selected and use that to work out what fields should be removed or added.
One way would be to add all the fields in order to a vector or an array when the screen is initialised. Once the user has selected a value you could iterate through the fields and use the current index of the list and the user selected value to work out if the field should be removed or added.
If you have the field objects, then use Field.getIndex() to find the index of each field within its manager.

Resources