Toshiro Sugii

3pods

TXDragAndDrop

TXDragAndDrop

Usage

Call setDraggingEnabled: to make a UIView draggable.

You can restrict the dragging area throught setDraggingEdgeInsets:.

As Apple API docs said:

Positive values cause the frame to be inset (or shrunk) by the specified amount. Negative values cause the frame to be outset (or expanded) by the specified amount.

So, if you want to make UIView draggable to the left, restricting top and bottom, you can set your UIEdgeInsets as:

``` [self.myview setDraggingEdgeInsets:UIEdgeInsetsMake(0.f, -self.myview.frame.size.width, 0.f, 0.f)];

```

API

``` - (void)setDraggingEnabled:(BOOL)draggingEnabled; - (BOOL)isDraggingEnabled;

  • (void)setDraggingEdgeInsets:(UIEdgeInsets)edgeInsets;
  • (UIEdgeInsets)draggingEdgeInsets; ```

Installation

TXDragAndDrop is available through CocoaPods. To install it, simply add the following line to your Podfile:

ruby pod "TXDragAndDrop"

License

Copyright (c) 2015 Toshiro Sugii

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

License: MIT

  • Objective C

TXSwizzling

TXSwizzling

Usage

+ (void)swizzleSelector:(SEL)originalSelector to:(SEL)newSelector;

Example

We can exchange [NSString uppercaseString] with [NSString lowercaseString] calling:

[NSString swizzleSelector:@selector(uppercaseString) to:@selector(lowercaseString)];

Installation

TXSwizzling is available through CocoaPods. To install it, simply add the following line to your Podfile:

ruby pod "TXSwizzling"

License

Copyright (c) 2015 Toshiro Sugii

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

License: MIT

  • Objective C

TXViewKeyboardResizer

TXViewKeyboardResizer

It automatically resizes you UIView when keyboard appears.

It can be used with any kind of UIViews.

If your view extends a UIScrollView, you need to adjust your UIScrollView.contentSize.

Usage

First, choose the UIView that is going to be resized when keyboards appears.

Controller

Then, you need to check your Autolayout configuration or Autoresize values.

Here, i am going to use Autoresize as it is a little bit easier in that case.

Autoresize

With autoresize configured, when UIView resizes, our UITextField is positioned automaticaly.

Now we can call startKeyboardResizerObserver(WithDelegate:) inside our UIViewController:

``` - (void)viewDidLoad { [super viewDidLoad];

[self.scrollView startKeyboardResizerObserverWithDelegate:self]; } ``` We must remember stop observing when we are done with keyboard:

``` - (void)viewWillDisappear:(BOOL)animated { [super viewWillDisappear:animated];

[self.scrollView stopKeyboardResizerObserver]; } ```

Delegate

And then, you can adjust your view per need:

- (void)viewWillResize:(UIView *)view; - (void)viewDidResize:(UIView *)view; - (void)viewDidTap:(UIView *)view;

We can close the keyboard, for example:

- (void)viewDidTap:(UIView *)view { for (UIView *subview in self.scrollView.subviews) { if ([subview isMemberOfClass:[UITextField class]]) [((UITextField *)subview) resignFirstResponder]; } }

Resize

Requirements

iOS 6.+

Installation

TXViewKeyboardResizer is available through CocoaPods. To install it, simply add the following line to your Podfile:

ruby pod "TXViewKeyboardResizer"

License

TXViewKeyboardResizer is available under the MIT license. See the LICENSE file for more info.

License: MIT

  • Objective C