Adding a full width row to a CollectionView two-column structure - swift

I created such a structure with CollectionView, there are two items in one line. The whole structure should go on like this, everything is fine until here, but I must add (only 1) slide at the top. So I want to place one more full width image in 1 line. What path should I follow?
An image of my app

If the full-width image that you need to display is just a first item of the data set you're displaying, make the collection view return a custom size for it based on its index path. In order to do it, assign a delegate to your collection view and implement the UICollectionViewDelegateFlowLayout protocol, specifically the collectionView(_:layout:sizeForItemAt:) method. Alternatively, if you're targeting iOS 13+, you can do the same with the UICollectionViewCompositionalLayout, but the implementation will be different, in that case I encourage you to read its documentation.
If the item doesn't really belong to the data set, better create a section header with just that item inside.

Related

Highlight an entire UICollectionView section in Swift

This collection has many items within many sections. I am trying to place a border around each section and further highlight it.
Trail 1:
Using headers and footers I can draw lines (header has top,left,right; footer has left,right,bottom) which look like frame ends. But I can't get them to highlight on item select.
(I don't want to make this too complex by listing my code. I think there are tutorials to create collection headers and footers. But in summary: I created a UICollectionReuseableView class for each, registered them and applied a referenceSize for each of them.)
Trial2:
I can highlight each item, in that section (using a color with alpha overlay), when any item is selected.
(Again in summary: I used a for loop within the didSelectItemAt method.)
If each section was always one row of items, then I could use the item height, but thats not always the case - especially if rotated.
How can I place a border around each section then highlight on item selection?

How can I style a cell or row/column of cells in NatTable programatically?

I'm having a hard time figuring out how to individually style a cell or group of cells when a certain thing happens. For instance I would like to be able to right-click on a cell and hit something like "tag" and it would change the background color of the cell to something different. I would like to do the same thing with rows, columns, or any random group of selected cells. I also need this change in style to persist even if the cell(s) are moved beyond the viewport layer's view.
If you have a hard time with NatTable, maybe it is worth reading some of our tutorials and documents.
https://www.eclipse.org/nattable/documentation.php?page=styling
http://www.vogella.com/tutorials/NatTable/article.html
In short related to your question. Individual styling is done via config labels on a cell and styles that are registered in the ConfigRegistry for that label. So what you need to do is to implement some sort of label registry based on cell indeces. That label registry then needs to be used by a custom ConfigLabelAccumulator so the labels are attached to the cells with the corresponding indeces.
We have a basic implementation on a column base via the ColumnStyleEditorDialog. This can be seen in the _000_Styled_grid example by clicking on the column header and call "Format cells". Personally I think that feature is not complete, but it should help you in seeing how it works in principle.

UITableViewController- showing only rows with content and an image where there is none

When creating a UITableViewController there are two situations that create an "ugly" UX
calling/open it without any data in it --> shows an empty table (i.e. empty rows,UITableViewCell, as many as fit in the window)
calling/open it with fewer rows of content that fit the window --> show the full rows followed by empty rows
I wish to receive the following result:
if there is no data show a picture or view with text - there isn't any data yet or something like that
show only the full lines and no more rows (blank or background image)
Is there a way to achieve that?
To add these effects, you will probably have to make your own UITableViewController from a regular UIViewController, and even subclass UITableView. If you have a regular UIViewController with your filler image/text as the background, you can place a UITableView on top and hook up the delegate/datasource. Now, in your code, detect when there is no data available and set the hidden property of the UITableView accordingly.
As for the following empty rows, you will either have to turn off the row separators (in IB), or subclass a UITableView (can't help you there). Good luck!

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.

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.