Not sure why it's doing this, but I can't figure how to get it to stop. The view controller moves left when you attempt to resize the input field. The example video is a new project after rebooting, and everything. Totally confused and driving me nuts. Any ideas?
https://www.youtube.com/watch?v=4dX-s-RvDCk
Try holding down the command key as you resize to get the expected behavior. Also, try dragging the right end of the input field to resize. There seems to be a new "feature" where the left side resize moves the view controller as you resize by default.
Related
My goal is to create an alert that has three text fields, one taller than the others, and an image that, when tapped, allows the user to choose a picture to replace a set default one.
After unsuccessfully searching for a library for this, I decided to create my own alert by placing a UIView off the screen and, when prompted by a button, would zoom onto the screen; it consists of all the elements I require.
When I run the application, the view pops up correctly, but none of the elements on the view are responding to touch. I've checked that isUserInteractionEnabled for everything is turned on.
What's also odd is that when I keep the view on the screen (instead of placing it some distance away on Storyboard), all the elements work fine.
I'm assuming it had something to do with the animation. I tested it with a fade in instead of a displacement, and the result was the same - the elements were unresponsive.
In order for your elements to be responsive you have to link the action of you clicking them to your view's code. You can do this in a non-programmatic manner by ctrl-clicking your element on story-views and then dragging to the view controller. Then choose action instead of outlet, and choose when the action you want will be triggered (bottom part). Then insert your code in the viewController.
So I figured it out. I used the debug view hierarchy and saw that the alert was behind the elements behind it, even though it was still being shown (for some reason). I changed the zIndex of the UIView and it worked!
From what I can tell there are some challenges people are having in XCode6 in terms of wiring up outlet collections. I just wanted to see if i'm doing this right or what I need to do correctly! I reviewed here Can't hook up an outlet collection in Xcode 6 using storyboard as well as other areas, but I wanted to be more basic about this first.
I have 7 images on a screen. I'd like to iterate through all of them in a loop or something. I read an outlet collection would be a sensible way to do this. To create an outlet collection, I am doing this:
While splitting the screen (storyboard on left, assistant editor on right) I control+click on one of my 7 images, and drag it into the view controller code on the right. This will prompt me to create an outlet, or outlet collection (I select outlet collection).
Now that this is done, a circle appears in the left margin next to this variable indicating that the image is associated with that variable. If I hover over the circle, the first image lights up.
What you're supposed to do (can someone confirm this please??) is you just hover your mouse over the circle, and a + symbol appears, and all you do is hold down the left mouse button, and drag over to another image (for example image#2), and it should automatically add that to the collection. The idea is to simply drag to each image so they are all added.
Is that right in step #3 above? Is this the normal way you would add items to a collection? Drag from the + to the image within your controller? For me, when I do this, the line appears, but it doesn't seem to respond to connecting the line to anything. I just hover it over the images, and it doesn't highlight the image or select it or anything, and when I let go, nothing happens.
I'm still somewhat new to this - what am I doing wrong?
Thanks so much for your patience/help!
OK I had the same issue and I think I have just found a workaround
1) Do steps one and 2 with the first image
2) Now repeat exactly what you did using the second image - drag and drop just below the first outlet collection (this would simply create a second outlet collection use exactly the same name )
3) Now Xcode won't like it as you have two outletCollections with the same name. Now comment out the first one
4) Now you only have one outlet collection. And it would be wired up to both your images. confirm it by hovering your mouse pointer over the little 'circle' next to the IBOutlet to see your images being highlighted.
This seems to work for me. So hope this helps :-)
There is an error with Xcode and Interface Builder that causes problems with outlet collections. You are doing it right, Xcode is problematic.
A workaround is to:
Go to your DerivedData folder (Xcode preferences -> locations)
Clean build folder from the Product menu while holding option (alt) button
Quit Xcode
Delete the folder starting with your app's name in the derived data folder
Go to your xcodeproj file, right click it, show package contents.
Delete the xcuserdata folder (warning: don't touch the others!)
Open Xcode again.
When you delete user data, window positions etc. will be reset to defaults and breakpoints will be deleted. Your project should work smoother (after a few seconds of re-indexing) and outlet collections should work properly.
I have had some success by just changing my workflow as follows (no need to restart Xcode).
First, create the outlets in code in the controller class file.
Second, drag from the objects (in the outline view of IB) to the controller, or back (for actions).
This has always worked without fail. It is slightly more effort, but actually negligible. Definitely an Xcode bug.
I have a UIView that can be translated along the X-axis. Everything works great but I noticed that if I navigate to another page and back, the new view position is lost and reset to how it's configured in the xib.
In iOS8, it actually works exactly as I would want; the view persists its last position. However in iOS7, this doesn't appear to be true so I'm guessing Apple fixed it in their latest os? Is there a workaround anyone knows of that can get this to work in iOS 7?
Try storing the last location and when you pop up your controller set the view's x-axis to this stored location
I have a relatively simple dialog/popup style UIViewController that isn't behaving correctly. I have many others just like it (though each with a unique button layout) that work just fine. For some reason that I cannot figure out, this controller is only accepting touches within (approximately) the green shaded area.
Note that none of these colors are the actual colors, just placeholders. Same goes for the text.
Tapping in the "Search..." text field does nothing. Tapping on the "Cancel" button does nothing. No UI reaction whatsoever.
The tableview will scroll just fine (there are over 100 rows) if it's touched inside (approximately) the green region. Touching the tableview below the green results in no response. Same thing for the "Cats" button. It reacts when touched in approximately the top half, but nothing in the bottom half.
I've banged my head against the wall for the requisite "several hours" and am getting nowhere.
It seems that part of your view controller's view is overlapped with some "harmful" view/views. Maybe this view is created programmatically and is not visible in IB. You should start with checking your views hierarchy. Put breakpoint in your view controller's code. Somewhere, where you are sure all views (normal and harmful) are already created and type in debug area
po [self.view recursiveDescription]
you should receive something like
Now try to find harmful views. Temporarily delete some "normal" views could be a good idea.
I found my solution. I have a method that launches a dialog controller given the dialog to launch and the parent (up until this point, always a full-screen view controller). The parent gets darkened and the dialog gets launched on the center of the screen.
This one wasn't working because I was launching it from an existing dialog; I was telling the dialog launcher that the new dialog's parent was the current dialog, not the whole screen. This means that the new dialog (which is bigger than the first one) launches at the correct size, but only accepts input inside the area of the "parent" dialog, which is the smaller one underneath it.
Fix: Launch the new dialog using the current dialog's parent (which is full screen) and it works fine. The green zone on my image is the approximate size of the dialog that was being used as the parent, which is why input was only being accepted in that area.
I have a series of three UIWebViews, arranged side-by-side, each one sized to be full screen.
One of them is 'current', one is 'next', and the last is 'previous'. I have each one populated with test data currently (aptly named 'test one' 'test two' 'test three'). Long term I'll have more than three items to deal with.
Swipes cause the entire shebang to 'rotate' left or right, displaying the next / previous item in the cycle. The code for the rotation works, as far as I can tell, correctly. Current takes on the frame of previous, previous takes on next's frame, and next takes on the frame of current. I then adjust the pointers so that current is pointed to next (which is now placed as current) and so on. Sounds more complicated than it really is:
//code to animate this process properly ommited
previous.hidden=1
CGrect tempFrame=current.frame;
current.frame=previous.frame;
previous.frame=next.frame;
next.frame=tempFrame;
previous.hidden=0
//Adjust the actual pointers so they accurately describe their current positions
UIWebView *temp=current;
current=previous;
previous=next;
next=current;
My only issue is that the web views if you go 2 or more in a given direct slide in 'blank'. E. G. swipe right and you go from test 1 to test 2. Swipe right again, and you get a blank screen. THe frames are all correct, the webview is placed correctly, but it's contents are blank.
Confusing thing is, if you swipe once in the opposite direction, and then back, it displays properly. (E. g. swipe three right, you have a blank; swipe left then back right, and it displays the 'correct' screen.)
Does anyone have any ideas what could possibly be causing this? I suspect that once I go to my next step ('real data' where next / previous is loaded with the appropriate item when it's slid in) it'll cause the current issue to vanish, but I want to understand THIS issue.
Edit:
I've managed to trace the issue, partially, to my 'hiding' the panel that should NOT be visible. Past that, I'm still not sure what is going on.
Turns out that it's related to hiding the 'unused' view in the shuffle. Why it works when I move backwards to it I don't know. By moving the 'unused' view to the very back of the order, everything works right.