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
Related
I have an NSTextView that users can type into. What's different is that I often make changes to the TextStorage while the user is typing in it (i.e. some information comes in over the network, and I need to represent that into the NSTextView by merging in these changes).
I can do that successfully - I've created a MovableCursor which keeps track of SelectedRange even when changes are happening behind the scenes.
I have this code working on iOS (UITextView) and the Mac (NSTextView). The problem is, on the Mac, the NSTextView usually jumps in the Scroller (i.e. the visible position in the View changes). It does not move at all on the UITextView - everything works perfectly, the cursor doesn't move in the window even though changes have happened to the TextStorage.
Simply using ScrollRangeToVisible doesn't work - it may make the Selection visible, but it necessarily make it visible in the same place.
I've tried grabbing the Scroller's VerticalScroller position, and then reapply it after making changes.
var scroll_pos = contentViewScroller.VerticalScroller.FloatValue;
...make changes...
contentViewScroller.VerticalScroller.FloatValue = scroll_pos;
Well, I can see the scrollbar doesn't move (expected), but the text still does. Somehow the scroller gets out of alignment with its position through the NSTextView. When I start moving the scrollbar, it seems to "flick" a little and get back in alignment.
So... Any thoughts on how I can make changes to an NSTextView's TextStorage, while keeping the Cursor (or SelectedRange) fixed in the same position on the screen.
[Note: of course there are times when this immobility is not possible - for example if everything before the cursor was erased, then the cursor must move to the top. That's ok.]
Many thanks.
I'm trying to make my app accessible (use voice-over properly).
It works just fine in the first screen (login), but after the login no element gets the accessibility focus. It seems to be stuck.
Accessibility inspector's audit gives me this issue for all of the "should-be-accessible" elements in the screen:
This element appears to display text that should be represented using the accessibility API
When pressing the question mark I get:
Determine if any part of the content should be exposed as separate accessibility children
Does anybody have an idea? Did you get this warning?
P.S.
Apologize in advance, but I can't share my code because of security reasons.
Solved my problem.
Apparently, i've added another view after the login and then animated it off screen, but did not remove from superview.
It caused the app to lose accessibility focus (the focus was on the status bar only).
After removing the view, my app got the accessibility focus again.
My lesson from this problem - remove unnecessary views!
P.S
It's legacy code - wasn't written by me :)
You can follow three things :
You can all the view hierarchy and check whether accessibilityElements are properly set or not.
Unnecessary views isAccessibilityElement property should be set as false.
remove Unnecessary views.
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.
I'm very new to objective c (three weeks) and also in my 70s so not as quick as I used to be! Anyway, I'm doing okay with an app for IOS except for a problem with maintaining slider position and value when switching away from a view and back again. To clarify: I have 3 views, each with 4 sliders and I want to be able to return to any view with the sliders positions and values the same as they were left. I'm sure there's a way of doing this but I've searched all over to no avail so I hope someone here can help!
Do you allocate an instance of a viewController every time you push it onto your navigation stack ? if so , create a property and allocate it only once and use the same object to push in onto your navigation stack. it should retain the position.
Another possible solution is to persist the current value of the slider in your viewController and set the slider value to the persisted value in viewWillAppear , which gets called every time the view comes on screen
You could save the sliders values using something like NSUserDefaults. Look it up for more info.
I have a UIWebView that loads a new request when the user scrolls a set distance past the end, or before the beginning of the content (ie. into the area that "bounces" back), via the scrollView delegate
Unfortunately, I have found that once the bounce animation starts, it has to complete, and completely bounce back to the edge of the content area, before the UIWebView will display the new content that it has loaded.
Is there any way to interrupt this, and have it not need to bounce back before displaying the new content? I would prefer for the old content just to disappear without needing to bounce all the way back to its edge . Either that, or speed up the animation.
Things to note:
I do NOT want to turn off bouncing.
I have tried importing quartzcore and using -removeAllAnimations on every view I can think of, including the superview, and it doesn't help.
I have tested it, and it is not because of latency in the loading of the request that is causing the delay in displaying the new content.
There are a few UIViewAnimationOptions that look like they could be helpful, but I can't see where I would use them, and I don't really want to subclass UIWebview if I can help it.
Any ideas?
thanks in advance