UIPickerView - changing component width - iphone

In my iPhone app I want to have a UIPickerView with 2 components. Initially the left column will be wide and the right column narrow to enable the text on the left to be read easily to allow selection from it.
Once this column has been selected the user will click on the right column to select an item from it : when this happens I want to resize the columns so that the left column is narrow and the right one is wide so that all the text can be read.
I have been experimenting with "pickerView widthForComponent" but this seems to only get called when the view is initially loaded.
Is there any way I can dynamically resize the columns ?
Thanks

You may use [pickerView reloadAllComponents].
Update:
That's weird. You may also try to check the following solution.

Just a reload won't work. You also need to call setNeedsLayout
[pickerView reloadAllComponents];
[pickerView setNeedsLayout];

Related

How to insert UIButton through code with AutoLayout feature enabled - iOS

I have been trying to insert a UIButton programatically, as I am using Autolayout I have done something like that...
[self.add_scroll_view addConstraints : [NSLayoutConstraint constraintsWithVisualFormat : #"V:[date_picker_btn]-[button(==date_picker_btn)]"
options:0
metrics:nil
views:NSDictionaryOfVariableBindings(date_picker_btn, button)]];
I have two questions here...
i) Button inserted is not the same width as date_picker_btn even though I mentioned button(==date_picker_btn).
ii) I have inserted properely, however below views should align accordingly down to accommodate new button... How to do that...
Thanx
When using the visual format language, the superview of the view for which the constraint is being described is represented by the | character.
Example:
V:|-20-[mybutton1(>=70#500)]-[mybutton2(==mybutton1)]-30-[mybutton3]-|
Refer this link
For first question I have mentioned V: so it means (==) will assign height not width. To set width it should start with H:.
Next question, To insert a button between two existing button need to handle already existing constraints, here above I have added new constraints only not handle old existing, so I have to delete the existing constraints, so that it avoid conflicts. Works fine.. Happy coding :)

Creating Form Control at Cell Location with VBA in Excel

Reference
I am using ActiveSheet.Buttons.Add() to add format control buttons to a worksheet. This method suffers when I have to add several buttons with a certain horizontal distance between them and column widths change, causing a slight drift between buttons.
I would like to instead use a cell reference which would prevent this drifting caused by column width changes.
The syntax is
ActiveSheet.Buttons.Add BUTTON_LEFT, BUTTON_TOP, _
BUTTON_WIDTH, BUTTON_HEIGHT
This will create a button at the active cell. Change as possible.
ActiveSheet.Buttons.Add ActiveCell.Left, ActiveCell.Top, _
ActiveCell.Width, ActiveCell.Height
EDIT: Beaten by Tim!

Hoe put searchbar in each component of UIPickerview? and how perform searching in each related SearchBar?

Actually i used the pickerView for display My database value containing Name, SSN, Research Area etc. Now I need to search in each component of pickerview, like Name,SSN using SearchBar is it Possible?
If I understand you right, you want to filter the rows of the components when the searchtext changed.
You can have a NSArray for each component to populate it with: In – searchBar:textDidChange: you can check which entries in your arrays fit to the search text and add it to a array, that you will use to fill the picker. Don't forget to either call [aPickerView reloadAllComponents] or [aPickerView reloadComponent:i], this will tell the picker to draw itself again.

Deletion button appearing below section index in UITableView

I have my UITableView set up (in the standard way) to allow deletion on swipes. Whenever I have a sectionindex showing, however, the "Delete" button appears /below/ the section index:
Perhaps I'm missing something obvious?
I've tried setting the selected cell to be less wide in willBeginEditingRowAtIndexPath, but this removes the seperator line below the cell too (i.e. the line is part of the cell, so doesn't draw in the area outside the cell's new bounds).
The solution we used is to remove the index when the table is in editing mode (the other option is, obviously, don't use both table features in the same table).

UITableView: moving a row into an empty section

I have a UITableView with some empty sections. I'd like the user to be able to move a row into them using the standard edit mode controls. The only way I can do it so far is to have a dummy row in my "empty" sections and try to hide it by using tableView:heightForRowAtIndexPath: to give the dummy row a height of zero. This seems to leave it as a 1-pixel row. I can probably hide this by making a special type of cell that's just filled with [UIColor groupTableViewBackgroundColor], but is there a better way?
This is all in the grouped mode of UITableView.
UPDATE: Looks like moving rows into empty sections is possible without any tricks, but the "sensitivity" is bad enough that you DO need tricks in order to make it usable for general users (who won't be patient enough to slowly hover the row around the empty section until things click).
I found that in iOS 4.3, the dummy row needs to have a height of at least 1 pixel in order to give the desired effect of allowing a row to be moved into that section.
I also found that the dummy row is only needed in the first and last section; any sections in between don't have this problem.
And it looks like in iOS 5.0, no dummy rows or special tricks are needed at all.
While managing the edit, you can monitor if the table view is in Edit Mode. Use that flag inside of cellForRowAtIndexPath to decide weather or not to display the 'blank' row. While in 'regular' mode, the row will not display, but when the user taps 'edit' cellForRowAtIndexPath should get called again and this time decide to display the row. The details of how to do that depend on your data source and how you are gluing it to the display. If you aren't getting the call again, you can manually inject rows with insertRowsAtIndexPaths / deleteRowsAtIndexPaths and/or call reloadData to force a refresh.
I found that if you return -1.0 from the heightForRowAtIndexPath method it will remove the 1 pixel line.