i am new to this iphone development, in an uiview i have a tableview, in each cell of tableview, i have an image. is it possible to drag or move an images which are in cells, to pos 1 from pos 2 as shown below.
|--------------------------|
| | |
| ui |table(image) |
| |view |
| 1 | 2 |
----------------------------
Are you asking about reordering the rows by dragging them up or down?
Apple has a guide on how to do this.
Related
I am working on a flutter web application and need to place multiple list views in a column.
I am trying to use responsive-framework. But it doesn't seem to work with my project. I tried Wrap widget. I doesn't work either.
What I want to do is moving around the list views based on the screen size.
Just one Column two Columns for wider screen
| 1 | | 1 | | 5 |
| 2 | | 2 | | 6 |
| 3 | => | 3 |
| 4 | | 4 |
| 5 |
| 6 |
This order of the list views should be exactly what I illustrated above.
Below is not what I need.
| 1 | | 2 |
| 3 | | 4 |
| 5 | | 6 |
| 7 |
Any tips??
Try GridView. There's a lot to it depending on your requirements for the Container Size. But GridView.builder with SliverGridDelegateWithMaxCrossAxisExtent (there are other variants).
You'll need to change the axis direction to horizontal in your case.
UIWindow has the private method _autolayoutTrace that helps you to find ambigous layouts. It's very nice and convenient and outputs something like this:
*<UIWindow:0x13436fd0> - AMBIGUOUS LAYOUT
| *<UIView:0xd5e0b30>
| | *<PbJellyContentContainerView:0xd5e0ff0>
| | | *<UIView:0x20710ee0>
| | | | *<PbMapContainerView:0x20710c90>
| | | | | <MKMapView:0x2070df70>
| | | | | | <UIView:0xd1cca20>
| | | | | | | <MKBasicMapView:0xd1cd020>
....
My question is not about any ambiguity. It is about the asterisk in front of some views. What is its meaning?
My guess would be that it marks all views that are using auto layout. But how does the system determine this?
Update:
It seems that the asterisk marks all views that either have at least one constraint set or that have a subview that has at least one constraint set.
Setting translatesAutoresizingMaskIntoConstraints to false without setting a constraint doesn't give the asterisk.
This is the legend for -[UIView _autolayoutTrace] from WWDC 2015 session #219 video at 31:00
* - is laid out with auto layout
+ - is laid out manually, but is represented in the layout engine because translatesAutoresizingMaskIntoConstraints = YES
• - layout engine host
I got your point,i think so, * is for the the components on which you can apply Autolayout.
I means if there is button then it will show it as
*<UIRoundedRectButton:0x1f053a50>
| | | <UIGroupTableViewCellBackground:0x1f053b20>
| | | <UIImageView:0x1f0542f0>
| | | <UIButtonLabel:0x1f053db0>
that means that rectButton is put up by you and you can apply autolayout on that, whereas other 3 under are automatically will be layed out itself.
* will be only shown if atleast 1 component in your UI has UIAutolayout ON, if all of your components is without Autolayout, then it understand whole UIView as single component and will not show * for that
I have a UITableView that has a header view that I want to use to display content. When no content exists, I want to hide the header view (which is a UIView class) and have the TableView Cells slide to the top of the view.
It's like
____________
| ---------- |
| | | |
| | header | |
| | | |
| ---------- |
| ---------- |
| | cell | |
| ---------- |
| |
When I call
[theHeaderView setHidden:YES]
The content in the header view disappears but the cells of my TableView remain halfway down the screen to where the header had pushed them. so i wind up with:
____________
| |
| EMPTY |
| SPACE |
| |
| |
| ---------- |
| | cell | |
| ---------- |
| |
What is the proper way to hide the header view and have the table view cells move to the top of the screen?
and then i want to reopen my header later on with new content and push the cells down again.
thanks!
You need to change the tableView:heightForHeaderInSection: rather than just making the header view hidden. I don't recall if this will animate when you reload the table (reloadSections:withRowAnimation:).
I've been teaching myself Auto Layout using code (i.e. avoiding Interface Builder).
I have a view that I'd like to set up with Auto Layout.
It has 3 UILabels that are horizontal and one that is vertical.
Sort of like this.
---------------------------------------------
| --- ----------------------------------- |
| | | | | |
| | | ----------------------------------- |
| | | ----------------------------------- |
| | | | | |
| | | ----------------------------------- |
| | | ----------------------------------- |
| | | | | |
| --- ----------------------------------- |
---------------------------------------------
The label on the left is rotated 90 degrees to the left.
I'm just not sure how to apply auto layout between the rotated label and the non-rotated labels?
Can this be done?
Does the height become the width, does the top become the left, etc...
There is probably a “right” answer, but an easy workaround would be to add the rotated labels as subviews of non-rotated views, and do your layout with those views.
Update: I just remembered that when a view has a transform applied, the frame becomes the smallest possible bounding frame*. Unless I'm mistaken, that means the frame would be exactly what you want it to be, and assuming the layout calculations are based on the frame, it should work as expected.
* when I last worked with transformed views, the frame of a rotated view was undefined, but experimentation showed that it was the bounding rect of the rotated view. Not sure if it is now defined or expressly allowed/forbidden.
Update 2: I checked the docs, and they still have a strongly worded warning against doing this:
Warning: If the transform property is not the identity transform, the value of this property is undefined and therefore should be ignored.
I'd like to be able to show the detail view of a table, but not push a new screen, but only show the detail view where the table is.
What's the best way of setting this up.. if it is actually possible?
------------------------------------
| |
| nav bar or tool bar |
------------------------------------
| |
| this area stays static |
| |
------------------------------------ ---------------------------------
| | | |
| | | |
| | | |
| table… | | new uitableview pushed. |
| | cell clicked-> | only the table area changes |
| | | |
| | | |
| | | |
------------------------------------ ---------------------------------
| | | | | |
| | | | | | < tab bar
| | | | | |
------------------------------------
If you want an effect similar to pushing a UIViewController I guess you could animate the tableview out and animate the new view into position at the same time. I don't think there's a way to do it using the actual UINavigationController mechanism, as it replaces the current view on the UINavigationController's stack with the new viewcontroller's view.
I would suggest two methods:
Insert the uitableView into a UIView, this way you will always have reference to a container which holds the uitable view. Also you need to just manage the frame sizes of the child subviews of this table view. In your case it would be the first uitableview and on button click the next subview can be added using the reference of the parent container.
Alternatively you can have a macro which has the positions of the uitableview's frame with respect to the parent UIView. On inserting another subview you can set the frame therby giving an impression of overlaying above the base uitableview.
Just have another view on top of the table view and make it hidden. Set the contents and unhide it when needed.
The best way, in my opinion of resolving this is to use a UINavigationController that doesn't have its nav bar showing and doesnt fill the screen. So, your static areas are just plain UIViews, but your table view is actually inside a UINavigationController, but seems like it is a normal table - as the navigation bar is hidden.
This means you would push the "dynamic" content to the UINavigationController and that would animate that section of the screen, but the rest of the screen would remain static.