My UITableView quit showing its delete button - ios

I have a UITableView that came with the masterViewController in an Xcode split view template.
When I started working with it, it came all wired up with an edit button in the top left that showed the typical deletion business--the spinny lock button and the delete button on the all left, and it supported a swipe-to-reveal of a delete button on the right side. That all worked, including my delegate call to handle the underlying data function when a cell was deleted.
Somewhere along the way, that has broken, and now when the edit button is pressed, nothing happens. When I slide the cell to the left, it slides, and it stays where it's supposed to, hitched off to the left, but there's no delete button, and nothing happens when I tapped that area.
I have literally no idea what might have changed to have that quit working. Can anyone guide me to what I should be looking for?
My delegate's "shouldDelete" method always returns YES. My commitEdit method never gets called, as far as I can tell.

Related

iOS Left menu by button using MMDrawerController

I got some troubles making button for open/close leftside menu.
I made a button, but I can not configure it correctly, because I can't recognize whether the left view is open. It can be opened by swipe(special MMDrawer method), so I can't use a regular BOOL variable lika 'isOpen'. Also, I find it difficult to find a property for left view status (open/close).
I was surprised, that noone had trouble like this.
You could use the openSide property of MMDrawerController.
The current open side of the drawer.
Note this value will change as soon as a pan gesture opens a drawer, or when a open/close animation is finished.
As soon as the left view is opened, the value should change to MMDrawerSideLeft.

UIBarButtonItem triggers action only when pressed for long enough

I have a few simple UIBarButtonsItems(no customization other than changing style, color and alpha). Everything was working perfectly fine for some time. But now I need to press BarButton for a long time(4-5 seconds) before the action is triggered. I just moved toolbar around and changed color and alpha after which this started happening. I don't exactly understand what caused this change of behavior.
I used interface builder to build the view and assigned action to UIBarButtonItems by Ctrl+Dragging.
I tried looking up a lot both on google and so. Most of the questions are about UIBarButtons not responding at all. Still I tried the solution of cleaning build of project and Xcode cache. But nothing changed.
Could someone help me with this?
I realized my mistake. I had two events getting triggered in same space in view. First was to reveal toolbar(i.e. increase its alpha) when tapped in particular area of the view and second one was of course button tap event for UIBarButtonItem. When tapped in that area the first event got triggered and eventually when pressed for long it also fired the second event once the toolbar was visible(if toolbar was invisible before).
Sorry to bother you all.

UIWebView freezes when text is selected

My app, on very rare occasions, freezes when I select text in a UIWebView. Here's how it happens:
Tap and hold to select text
Text gets selected
Whole app freezes, unresponsive to touch, but I can still see operatings running
May freeze for around 10s. After that the UIMenuController appears. If I try to scroll while it is freezing, the scrolling happens after the app is responsive again
If the text is still selected, it freezes again if I scroll. Happens again and again
If I managed to scroll the selected text out of the view, scrolling the rest of the webview is fine, until I scroll the selected text back
If I get out of the UIViewController containing the UIWebView, I can confirm that they are both deallocated. Go back into a new UIViewController with UIWebView and it happens again.
This continues to happen with new instances of UIWebView, and even when I close and resume the app. Only stops if I force a restart of the app.
Does anyone have any clue how I can debug this? I've never seen this in simulator. Only happens very rarely on device.
I suspect you either have set up your view hierarchy improperly, or have modified it on a thread not the main thread. So tell us exactly where the UIWebView resides (super views), and take a good look at code that modifies sub view arrays.
For instance, you don't add the web view to a UINavigationController's sub views directly, but to its view controllers array etc.
All else fails create a demo project that also displays the problem and upload it to DropBox where we can run it ourselves.

iOS keyboard flickers when switching view controllers

I have a registration form and I want to have the keyboard always on top.
The way I'm doing it now, is that when the user moves between view controllers, in viewDidLoad, the first UITextField becomes the first responder.
The problem is that the keyboard flickers (disappears and then appears again) when the user moves between view controllers.
Also, related to this: I have a form with a few uitextfields. When the user presses next it goes to the next uitextfield using becomefirstresponder. When the user is in the last textfield, the keyboard button becomes "Done". Then, when the user presses it, if there's an error with the last field, it should get the focus (calls becomeFirstResponder) but that doesn't happen (nothing get's the focus and the keyboard goes down). All the other fields get the focus fine, just this last field doesn't. I've tried about everything: switching to other textfields and back. The problem is that done automatically removes the keyboard.
You should have made two separate questions for this.
First, your flickering:
I'm guessing you're using a UINavigationController. You can add an invisible UITextField somewhere in the UINavigationController, which you give focus before you switch to a new ViewController. Then, when the new ViewController has appeared (viewDidAppear), set the focus to the first textField as you want.
However, the entire approach is kind of hackey and I don't recommend you use it. Instead, try using several views in a scrollView, of which you change the offset when you move to the new view. This will also solve the flickering.
Second, losing firstResponder status on Done:
The done button is specifically there to indicate exactly that which it says; Done. Pressing this assumes the user is finished and that no text is left to type, thus dismissing the keyboard.
If you really want to keep the Done button, then try the following;
Allow the user to dismiss the keyboard.
Upon dismissal, check for the error in the last field.
If there is an error, instead of calling [lastField becomeFirstResponder], try [self performSelector:#selector(thisSelectorWillCallFirstResponder) withObject:nil afterDelay:1.0].
In the method thisSelectorWillCallFirstResponder call [lastField becomeFirstResponder].
This will give time for the keyboard to disappear, before making it pop up again, so it doesn't interfere with the becomeFirstResponder call.
Another method would be to not use a Done button, but instead use the return key. You can intercept return anytime with the delegate method textFieldShouldReturn:. There you can handle any error checking, without causing the textField to lose its focus.

clearButton not working in UITextEditField

This is one of those "it was working a while ago" troubleshooting efforts.
I'm working on the document preview view controller, in which is a scroll view, which itself contains subclasses of UIView that represent each document. I'm modeling this pretty closely to how Keynote handles its document preview, except I build my scroll view horizontally and with paging. But the standard user experience is present: Long press on a document icon causes all document icons to start jiggling, nab bar has + button and Edit button, etc.
The issue at hand is that when you tap on the name of a document, I hide all the others, move the one being edited front and center, build a new text edit field, add it as a subview atop the real name label, and set it as first responder; but the
[editNameTextField setClearButtonMode:UITextFieldViewModeWhileEditing];
while correctly showing in the edit field is not taking any action when the user taps on the clear button.
I can't figure out what I may have done to cause this to not work -- it had been!
My first thought was that somehow my instance of this subclass is no longer the delegate for this text edit field. To try and confirm/deny that, I usurped a tap on the image view of the document preview to compare the delegate property to self, and it passes.
if (editNameTextField) {
NSLog(#"editNameTextField is still active");
if ([editNameTextField.delegate isEqual:self]) {
NSLog(#"we're still the delegate for the editNameTextField");
}
}
Editing the text within the edit field works fine. Pressing the Return/Done key correctly sends the delegate message textFieldShouldReturn:
While investigating this I implemented the delegate method textFieldShouldClear: just to write a log message if the method gets called (and return YES of course). It never gets called.
My next thought was that perhaps a subview had covered up the area where the clear button sits. So I implemented textFieldShouldBeginEditing: and used the opportunity to bring my the text field to the front. That didn't change anything either. I set a debugger breakpoint there to play a sound when it was called, and it got called, so I know my text edit field is frontmost.
I have only one troubleshooting strategy remaining: Go backwards through snap shots until it starts working again. Before doing that I thought I'd see if any of the more experienced folks out here have any suggestions of what to try next.
Where are you adding the textfield? As a subview of the scrollView? If you added the textfield and it is out of bounds of its parent view it won't receive any touches.
You can try and not call becomeFirstResponder and see if clicking it will show keyboard. Another possible error might be that the parent view of the UITextField has userInteractionEnabled = NO.
Without seeing more code I'm afraid I can not offer more solutions.

Resources