I just discovered that there is no checkbox control in ios. I have found several resources that explain how a custom checkbox could be made. My question is how can I place a custom checkbox control on to a content view . Should I just put a view control in that specific position and then programmatically add the custom control to the view. I wanted to know what is the most common way to accomplish this ?
Checkboxes are mostly for OSX.
On iOS equivalents you can use UISwitch, or use a UIButton and set its state (highlighted, selected, ..) depending on the user selection.
If you absolutely want a checkbox, here is a guide showing how to do it. Seems nice, but I haven't tried it.
http://x-code-tutorials.com/2013/04/09/ios-xcode-checkbox-uibutton/
Related
I got an application with an internal Role system. Based on the current role the user is able to see more settings. For each setting i got a ViewCell. So in my case i want to hide the special settings in the beginning and show them if the user has the right to do so.
Unfortunately ViewCell doesn't have a Opacity attribute, so i set my TableView to HasUnevenRows="true" and changed the size of the specific cells to Height="0". Now in code behind, if the User has the right to see the Cell, this is what i call:
PumpCell.Height = 42;
PumpCell.ForceUpdateSize();
This "unhides" the cell which is exactly what i want to do, but in the first place the Layout inside (I got an StackLayout nested inside an AbsoluteLayout) is hidden until the Cell is Tapped (see below)
Anyone has an idea to fix this? I even would be fine with manually invoking a Tap on the cell, but i haven't found a way yet to do so.
Thanks in advance
#Elias Johannes, I think you are using the listview, List view is having the issues while dealing with increase the cell size at runtime. Instead of Listview use the Repeater view.
Here is the link for sample,
https://forums.xamarin.com/discussion/87128/repeaterview
Prepare your datatemplate with the additional settings will be IsVisible=false at initial time and when the user clicks on it, take the current item instance and make it ISVisible=true through binding.
Is there a possible way to hide some views in Interface Builder? I don't mean to hide it when the app launches, but to hide it just in Interface Builder to be easy for me to see other views.
Actually I want to do that because my xib file has a lot of views and it is hard to see !
Admdrew,
Unfortunately there is no way you can do that in storyboard. The only thing you can do to view the Views which is overlapped by others, is drag it to the top.
For example, I drag PickerView to the red line to make it to the top, then edit PickerView, and drag it back to the previous position when finish: https://www.dropbox.com/s/e18nmr9mya9y0s8/DizSfOW_3F3a_wV4YVXgFk__h0PoFWbd3rs1HbcTN-4.png
I prefer to use many View Controllers, it's better for your performance. But I must say that in some cases, you still have to use many UIView place on top of others, and I think this is the best way to edit each View.
Cheers,
UPDATE AUGUST 17, 2015
Since XCODE 6.x already added in the feature called "Installed" in the right panel, so now you can easily disable the upper view for temporary by uncheck "Installed", then do-whatever-you-are-planning-to-do with the lower view. Just remember to return it to be checked after you finish.
Step by step following this:
1. Click to select the upper view.
2. On the right panel, look for "Installed".
3. Click to uncheck it.
That's it!
Cheers!
You'd use the Hidden property in the Attributes Inspector. But I'm not sure is this is what you'd like to achieve.
By doing that you'd need to set the attribute to Hidden = NO before running your app.
I think that using groups of views could be also a better way to handle lot of views in the same xib files. You could do that Editor -> Embed In -> View. Selecting all related views and making groups could help you to work with them easily by hiding or moving some groups.
I need to be able to disable the keypad in a textfield, and instead when the user taps on it to start editing, a new table view will appear presenting a list of possible strings with which the textfield should be filled.
Anyone has any suggestions on how to achieve this?
Thanks in advance
p.s. I tried already but this functionality cannot be nicely implemented with a picker in my case, as there are too many options to choose from and (more importantly) each one of them is a rather long string and cannot appear entirely in a picker.
I believe you just need a regular cell that, when tapped, pushes a new detail UITableViewController with all the options to choose from. Once an option is chosen, set the cell's textLabel to whatever option have been selected.
If you'd like to go for an easier path, then you should also probably check the free Sensible TableView framework, as it has these kinds of cells out of the box (called selection cells). You just pass on your strings array to the selection cell and it will automatically display the detail view, and even assign the selected option to one of your object's properties if you wish. Should save you some good amount of manual work. Good luck!
I'm writing a app that contains quite a bit of input fields for collecting data.
and im wondering what are some good methods to display these kind of input fields, if there are too many to fit on a screen? so something like the add contact screen... where u can scroll down and there are fields there
my initial idea is to put them in a scroll view and then i can scroll through them, is there a tutorial to do this? it seems like the scroll view is more for dynamically displaying data like a text view, and not for static forms like i was describing.
if anyone has any different methods for doing this please post.
UITableview will match perfectly for what you need.
My friend wrote this which is a container view that automatically helps with moving fields out of the way of the keyboard - It will certainly save you some time if you don't want to use a UITableView:
https://github.com/mackross/GTKeyboardHelper
The other way as H2CO3 suggested is to use a UITableView. If it is a UITableViewController, then you get the moving out of the keyboards way automatically. You could build custom table view cells that are styled to have a prompt and a UITextField for input. You can also set the selectionStyle to UITableViewCellSelectionStyleNone to prevent these cells from highlighting when selected.
I think the third way is to do this with a UINavigationController (or a UIPageControl) and build a kind of wizard, where you go through various pages of related data. This might be the neatest way depending on how many fields you have and if you can group data into common sets (e.g. personal information, work information etc)
I had the same problem and found GTKeyboardHelper to be an easy way out.
After drag and drop the framework in your project, include the header file.
Download and open the example project, then drag the "Keyboard Helper" object from the objects section in the xib to the objects section in your project's interface builder.
Drag and drop all your views to be children of the "Keyboard Helper".
Using MonoTouch.Dialog I create a table of values.
When the user clicks a row, the row should flash blue as per normal.
How do I enable this in MonoTouch.Dialog?
MonoTouch.Dialog supports the flashing behavior for Elements that can actually respond to events (like the StringElement when it has a tap-handler attached) or other elements that need to respond to the user's interaction.
This is done by setting the SelectionStyle property on the cell to UITableViewCellSelectionStyle.Blue
Most of the cells that do not respond to user's input have the value in MonoTouch.Dialog set to None. You can either change the source code to make it use Blue everywhere, or make sure that you are using the right Element for the right use case.
I blogged about some design patterns for building Elements recently, if you want to roll your own:
http://tirania.org/monomac/archive/2011/Jan-18.html