UITextView as InputAccessoryView doesn't render text until after animation - ios

When showing the detail viewcontroller for the first time, the inputAccessoryView will render the text immediately, but when you go back and try it again, the text doesn't get rendered untill the animation completes.
See demo project here:
https://github.com/SabatinoMasala/accessoryview-demo/
If anyone has a resolution, explanation or workaround, I'd be glad to hear it!

I've been experiencing the same issue and I found a simpler workaround. It seems that this bug is related to the fact that inputAccessoryView animation is using a snapshot of the view. Forcing the snapshot appears to resolve the issue:
let _ = accessoryView.snapshotViewAfterScreenUpdates(true)

I tried messing with your project and, unfortunately, I saw the same behavior that you did. This may be a bug in UIKit.

I found a workaround for this issue, take a look at the HackFix branch of the project here: https://github.com/SabatinoMasala/accessoryview-demo/tree/HackFix
We achieve this workaround by adding a dummy textfield to the view hierarchy, which we then remove on ViewDidAppear. On ViewDidAppear we also show the InputAccessoryView, which was hidden beforehand.

Related

UITableView: Can't find a way to move/align the tableIndex element up

I have a UITableView and I am using a tableIndex, my problem is that when the keyboard comes up, it partially hides the tableIndex.
An acceptable solution would be to move the tableIndex up (like what the Contacts App does) when the keyboard appears, and show the most of it, but can figure out a way to do this. Any ideas of code snippet I can try?
The way to do this is to register to Keyboard Will Show notification and then update the height of your controller's view. You could also embed everything in a scroll View so that once the keyboard rises, your view becomes smaller and scrollable.
It is honestly a bit annoying to set up, so, if you are open to using CocoaPods then IQKeyboardManager is probably your best bet which can be found here: https://github.com/hackiftekhar/IQKeyboardManager

UIDatePicker not displaying correctly

Basically this issue started when I updated my app to run with iOS 9. Without making any change in the code now a white square appears over the picker view, but it works normally.
Note that the user can hide and show the picker views and the cells they're in. If you need more info leave a comment.
UPDATE: Here is the full screenshot of the Table View:
UPDATE 2: The following shows when I preview (press bar space button) the _pickerView property in the variables debugger. This makes me think the strange view is inside the UIDatePickerView and that it's a bug.
UPDATE 3: Extensive Research
So I finally did more research using the view inspector and the debugger and I got to some conclusion, although I still don't know how to solve it.
Using the view hierarchy debugger I found out the the white strange view it's a UIPickerTableView inside the UIDatePicker.
Here we can see the subject selected in blue and it's name at the top of the screen. I also wrote the whole hierarchy from the picker view to the subject so you can see it.
Next step was inspecting my datePicker var with the debugger to see if I could get to that UIPickerTableView causing problems. Inside it I could find 3 views, each one corresponding to each component (day, month, year). Let me show you the quick look of each one of these:
Click the pics to enlarge
In the first and the third one (day and year) we can see what look like some misplaced views next to the actual labels with the numbers. These properties, as you can see in the screenshot, are UIPickerColumnViews. I didn't go any further but you can imagine that if we inspect that property we would find the subject as a UIPickerTableView.
After all that I got to the conclusion that the misplacement of those views is what might be causing the issue. And that's all for today.
FINAL UPDATE
So some days after filing the bug report Apple answered and marked it as a duplicate. So I guess we just have to wait they fix it. You can check the radar at rdar://22566989
Apple Developer Relations marked my bug report as a duplicate, so I guess it is an SDK bug that they'll have to solve. It is still open by the time of this post (12 Oct).
Workaround
In the viewDidLoad() method change a property of the date picker, for example the mode. You don't have to leave it changed, you can set it to anything and then change it back to what you actually want.
Here's the hack that worked for me: If you change the UITableView separator style to None the problem goes away. Seems like a bug on Apple's end, like the numerous problems we are finding in iOS 9.9
I had the same issue, i discover that happened because my UIDatePicker was separate from view of my view controller. I added this view as a sub view in code. To solve this problem, i add the UIDatePicker in viewDidLoad method, this is helped me

Text Field doesn't active for Static Cell in Table View Controller?

I have Single View App for IOS Xcode 6.4. Example Add Player screen, I tried it by myself, but Text Field doesn't active to click and typing at my application simulator (UITableViewController Static Cell) I have compared my project with example final project, everything looks good similar. How to fix this problem?
First you try with cmd+k that will open the simulator's keyboard. If that is not working then try with cmd+shit+k that may hide your keyboard but you can able to type on the text filed. If that also not work then you may accidentally off the user interaction for text field. Or may be some other view covering your text field which is transparent, so you are not able to see it. I hope that will save your problem, otherwise please provide your code sample.
There is a bug in the segue transition. Set the transition to None and it should work. I had the problem with a Curl transition.

SWTableViewCell - No animation, but delegate methods are being called

I have spent countless hours trying to get SWTableViewCell working, and I've run out of ideas. I'm trying to integrate it into a UITableViewController that contains a custom UITableViewCell (subclassed). For some reason, I can't get any of the animation working. I thought at first that MMDrawerController might have been causing the problem, but after completely removing it's usage, the swipe still doesn't produce animation. So that's not the culprit.
I've gone so far as to try a different cell swipe implementation (TLSwipeForOptionsCell), but I get the same results of no action. I've also tried MCSwipeTableViewCell, which does work in showing the swipe action, but unfortunately presents it's own problems since it doesn't support auto-layout.
For the SWTableViewCell, I can confirm by stepping through the code that
The class receives the gesture and steps through the logic of the code appropriately.
The delegate methods are getting fired appropriately, so the control should have done what it was supposed to do.
However, nothing happens in my table view cell. No animation, no glitch/flicker, no sign that anything has changed.
I've also followed the guidance for using table view editing, which did remove the default "delete" option (desired to remove that anyway), but it still doesn't work.
As you can see in the documentation on GitHub, integrating this should be super simple, but it just doesn't work for me.
Target is iOS 7.1 SDK.
For SWTableViewCell (the swipe implementation I'd prefer to use), I've just noticed that the selection of the cell is lost almost immediately when starting to drag. If I touch and hold on the cell, it is selected. I move just slightly, and selection is lost. However, with MCSwipeTableViewCell the selection is not lost.
Any ideas?
At the expense of looking like an idiot, I'm going to log what the problem was just in case someone else makes the same mistake.
In addition to the symptoms above, I was also having a problem where touching on the cell so that the selection state was triggered would result in a highlight that covered all of my controls--the cell looked empty/blank. That was also resolved with the solution below.
In Interface Builder, I had set the backgroundView Outlet to contentView. Don't do that. Bad stuff happens.
Hope someone else ends up benefiting from this.

UIPageViewController bug with UITextField and keyboard showing

So I'm trying to find a workaround for this bizarre bug:
http://www.screencast.com/t/UqvVn8ccodEV
Basically I have a UIPageViewController with sub view controllers (obviously). Once I add a text field, it does this weird thing where if you scroll it and then click a text field, it randomly moves to another page. None of the delegates get called, and the keyboard moves up and down again.
Seems like the same thing as here: clicking/typing on UITextField increments UIPageViewController instead of displaying keyboard
Also seems to be recorded here: http://openradar.appspot.com/13315308
Can't figure out what the hell this would be, or a way around it.
Edit
Here is a skeleton version (pulled from the linked question):
https://www.dropbox.com/s/6l5efem3wque7li/pageScroll.zip?v=1mci
Scroll one page, then hit the textfield. Only happens the first time around.
Check this voodoo out: Embed your UITextField within a UIScrollView. I tried it on the project you referred to and it worked.
I guess it has something to do with changing the responder chain that messes things up.

Resources