Preserve position when moving UIView in hierarchy (paste-in-place) - xcode4

in Xcode 4 IB is there a way to move a bunch of subviews from one superview to another without destroying their current layout?
This should be super easy, but when I try to copy/paste or move them in the view tree they all move to one position. I'd prefer not to reposition each of them manually after adding one extra view to hold part of a form for example.
In Flash there is Cmd-Shift-C for 'paste in place'. I'm looking for something similar in IB.

I had the same problem as OP, but I found a great solution on another thread. Answer by Jay:
https://stackoverflow.com/a/16952902/2070758
Basically, you can't copy/paste directly, but you can with some extra steps:
Select all views, labels etc, you want to move to the new super view
Editor -> embed in view
Move the newly created "container" view to the view you wanted to paste to originally
Select the "container" view. Editor -> unembed. All the elements will be dumped into the super view, maintaining the layout.

Was looking for the solution to the same annoying limitation in xCode... found a trick:
Create a new UIViewController in IB
Paste all your stuff in its root view, the positions should be preserved
Copy and paste this root view where ever you need it,
worked for me but geeesh what a pain.

Related

xamarin forms UWP app - how to create a "open file" dialogue that looks / feels similar in concept to MS Word?

I need to create a GUI that works similar to this:
So specifically:
I'd like to have a split screen where first on the left, i show a static list of locations... like local workspace and a sharepoint site.
and then depending on what they select on the left ... the right side of the page updates.
Can I use a grid for this? Or what's the best way? I just need some key words to google or youtube search. thank you!
Use a StackLayout (I think it will fit well to this case) and a Grid.
Inside this Grid, you can set 2 columns.
For columns (the static that you mentioned) you can put OR labels OR a ListView.
As you said: "depending on what they select on the left ... the right side of the page updates." It reminds me a Search Page, or... SearchBar!
This link will help you to create this SearchBar. The only thing that will change is the layout (put SearchBar on the left and the resultList on the right).
With this steps, you can customize and create something like in the photo.
If has any doubt, please, update your question with what you did and we will help you. Have fun.

plist editing in XCode 4: Can you not move rows anymore?

This one is stupid, and there's probably a ridiculously simple answer I'm just not aware of:
I'm trying to edit the plist for my Settings.bundle to implement preferences in my app. I want to tweak the order of a few groups, but I can't figure out how to move rows around. In XCode 3 you could just drag rows around to rearrange them, but it seems this no longer works in XCode 4. Short of deleting everything and re-recreating them in the correct order, how can I re-arrange the rows?
Thanks.
You can move an entry by grabbing the right side and moving it up, you just can't move it down.
I think it's an annoying gotcha that quite a few have run in to.
Check out:
How do you change a plist's root object type to NSArray in Xcode 4
and:
Change the editor Xcode 4 uses for property lists?
Basically, you can't. Changing the plist editor to textedit was the best solution for me. Also you can right click on the plist file and select "Open As > Source Code" to edit the plist raw.
It looks like the same problem is back in XCode 5. By grabbing it on the right you can drag it around, but you can't drop it anywhere. The only way I found was to open the list as source code like #Ralphleon said, which is simple enough to do if you have basic XML skills.
Update: With the new XCode that comes with Lion and iOS 5, moving rows works again.
Yes the order matters if you care about the order the preferences appear in your app settings.
I just create a new item (+) in the settings list where I would like an existing item placed. Then copy (right mouse click) that existing item and paste it on top of the new item. And then delete any duplicates.
In XCode 5.1, you can drag rows and drop them to a parent item. You can't rearrange siblings directly, but by dropping them on the parent item, the child jumps to the top among the siblings.
Check out the app PlistEdit Pro. It handles everything properly. Not free. But if you're doing lots of plist work it's essential.
Here

QT4, paginated showing elements

I am going to write an application that uses QT4 (with C++ or python it isnt important in that moment).
One of functionality is "Showing all items in database".
One item has a Title, author, description and photo (constant size)
And there could be very many items. Let's say 400. There won't be enough space to show'em all at once time.
One row will have 200px, so i need at most 4 for once time.
How to paginate them? I have no idea.
I can use limit and offset in SQL queries, but how to tell window: "that's 5th page"?
Any solutions?
First off, you normally do not want to use any manually set pixel widths in any GUI application, if you do, your toolkit sucks (or you must work in game development).
Second off: be more specific.
You'll need to define "page" for your application, namely what a page should be in its context. I assume it is breaking a list of items into separate pages. Normally this is done by using one of the view classes (e.g. QListView or QTableView) to take care of much of the legwork: it's called a scrollbar (not to mention the collapsing folders concept from file managers). Another method is splitting the information across several tab pages (QTabWidget), where each page displays a view of some sort (Perhaps QTextView or one of the M/V or Item view classes).
Same thing can also be done using your own widget stack and some other widget to manipulate the currently displayed page. This is basically how the option dialogs in the TeamSpeak 3 client and most KDE apps work; it's also how wizards with back/next buttons work in concept. I suggest you take a look at this config dialog example
Normally what you want is a view with a scrollbar and or some form of collapsing related entries into categorised information. If you just want to display a list of pages where each page is X entries: use a tab widget or stacked widget.

Qt switching between views

How do I switch between the two screens on the Qt?
For example, I have a button - static text plus a toolbar. Now I will add it to a frame and set it as a central widget. It works well for one window. What if I move it to the next window? Then I need to show some other stuff like another button, some images etc... and what if I come back to the first view again?
How do I show my old widgets back?
I'm not sure I got your problem right but, you could have different scenarios :
You could simply use groupboxes... Some widgets in groupbox1, otherWidget in groupbox2, and you display the groupbox you want to use, hiding the others...
You could use stackedWidget, which simulates "pages" of widgets stacked on top of eachothers... more informations here : http://qt.nokia.com/doc/4.6/qstackedwidget.html.
You could use other way like using tabs : http://doc.trolltech.com/4.6/qtabwidget.html
Maybe this example would be useful to you : http://qt.nokia.com/doc/4.6/dialogs-configdialog.html
Hope it helps a bit !
I'd recommend checking out Animation/States example (should be in /qt/examples/animation/states/ subdirectory of your Qt installation). It shows how to combine state machine representing application logic with presentation layer and get cool animation effects for free (of course if you don't need eye candy, you can set widgets properties without any animation).

Drag&Drop problem in a TreeView Qt

I'm facing a pretty strange problem and I need some help from your brains :)
1) I'm using Qt 4.6.0
2) I want to enable drag&drop (Qt::MoveAction with QAbstractItemView::InternalMove only) on items in a treeview.
3) I have my own model and a proxy model used to perform some sorting...
4) Drag&Drop works well except for one single thing, here it is :
When I perform some "real quick" drag&drops in the tree (basically throwing items from a parent to another) or when I'm trying to throw an item out of the three (above the first parent, between the top parent and the treeview's viewport's limit), the moving item disappears...
Even worse, sometimes, a corrupted item is created above my first folder (See the following pictures).
Image Before
Image After
Let's try and summarize a bit :
When I perform quick and random moves with the items in the tree(changing their parents or re-placing the items in their current parent), sometimes I have items that go everywhere but where they should... I also remind you guys that when used "normally" my drag&drop works...
I hope I've been clear enough, don't hesitate to ask for further details !
Thanks in advance for your help !!
I've been having the same problem, and it seems to be because you can drop an item onto another item, and then replace that item. I haven't figured out how to solve this problem though.

Resources