iOS Left menu by button using MMDrawerController - ios

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.

Related

How to make a floating/3D Touch style tableview?

So i'm making an application for tracking livestock. I have made a table view for the animals to go in. I have a navigation controller at the top with a button in side of it.Here is what i have so far.
I would like to have a floating table view come up when the button is pressed similar to the 3D touch menu.
Like these.
My question is how would i go about doing this. Sorry if this is a commonly done thing im pretty new to swift and xcode
If you just wanna to implement,you could search the key words as 'pop over', 'kxmenu' or 'menu' on GitHub/CocoaControls. such like this: https://github.com/zpz1237/NirKxMenu https://github.com/liufengting/FTPopOverMenu
Also, you should make it yourself. When the button is pressed, first you should create a custom window and make it key window. Secondly, add a tableView or a view contains tableView to the custom window. then, use block or delegate to deal with data communication and respond user interaction. After that, design animation you need. At last, remove subviews from custom window and make the original window key window.

Disable Swipe gesture for SideNavigationController Material Kit Swift

I am using SideNavigationController in my app for side menu and its working fine. In my case I want to open Left View and Right View on button click.
And I am able to do that using methods
openLeftView()
openRightView()
Now, the problem is Left and Right view also open when user swipe left or right. I want to avoid the opening of left and right view on swipe/gesture. I am using Embedded framework of Material Kit and currently not able to find any property that can be set to avoid swipe/ gesture detection.
please update to the latest, and set
SideNavigationController.enabledRightPanGesture = false
That will disable the right pan gesture, which will disable the ability to open the rightView using the panning gesture.

ECSlidingViewController : Keep underLeftViewController open

I am working on an app which uses ECSlidingViewController to implement a drawer menu.
I need to keep the menu always open on the home screen but keep it hidden and only open it on swipe when I am on the other views.
Does the lib allow that kind of behaviour ?
Any advice is welcome.
Thank you in advance
I've found the solution (which was quite easy actually)
Opening the sliding menu at startup
self.slidingViewController().anchorTopViewToRightAnimated(true);
Disabling gestures on the menu
self.slidingViewController().panGesture.enabled = false;
(you should set this to true again when you change view and need the menu to respond to gestures)
There is just one problem, I can't make anchorTopViewToRightAnimated work after I change topView.
Any ideas why ?
EDIT:
I'm calling anchorTopViewToRightAnimated in viewDidAppear -> not working (after viewChange)
If I try to call that method on button click it works fine, so it must be that ECSlidingView isn't ready or smthg like that but as there are no notifications or whatsoever I can't know when to call the method.
I could subclass ECSlidingViewController but would rather avoid it if possible

Editing toolbar in Xcode 4.6 - unable to add Bar Button Items

I am attempting to add a toolbar as an input accessory, and as such have added it via xcode storyboard editor to the view controller (and not within the view). This was as specified in this tutorial(which seems to be written for an earlier version of xcode): reference
My issue: "8.) Now we need to open the toolbar item itself. Double click Toolbar in the document window."
This is no longer valid behavior in Xcode 4.6 it appears, so I ask you: how do I add button items to a toolbar? I would prefer to avoid doing it programmatically (Still reasonably new to xcode development and normally make my GUIs with storyboards) but if I have to, I have to.
Many thanks!
If you're doing what I think you are doing, adding UIBarButtonItems to a UIToolbar, then you simply drag a Bar Button Item out to the toolbar.
However, I would assume that what they mean when they say 'double-click' is not what people normally think of when they think double click. Try double clicking slowly this often does the trick.
Found the issue - it was appearing behind the UIView. However you dont ever need to graphically interact witha toolbar, you can just drag-and-drop controls onto it in the sidebar. If there is a need for more info on this message me or vote up.

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