A draggable button that appears in your view.
RCDraggableButton is not ready for production use until version 1.0.
- Xcode 5.0 or higher
- iOS 5.0 or higher
- ARC
In your terminal,
cd [projdir]/RCDraggableButtonDemo
pod install
After a cup of tea, you should be able to build and run the RCDraggableButtonDemo
project by open RCDraggableButtonDemo.xcworkspace
in Xcode5.
open RCDraggableButtonDemo.xcworkspace
The recommended approach for installating RCDraggableButton
is via the CocoaPods package manager.
In your Podfile
, add a line shows below:
pod 'RCDraggableButton', '~> 0.1'
Then,
pod update
If you haven't used CocoaPods
before, you should visit CocoaPods for more info.
All you need to do is drop Src
files into your project, and add #include "RCDraggableButton.h"
to the top of classes that will use it.
In your AppViewController's - (void)viewDidLoad
create draggableButton and add it to keyWindow or customView.
// Set view as nil, means add button to keyWindow
RCDraggableButton *draggableButton = [[RCDraggableButton alloc] initInView:nil WithFrame:CGRectMake(120, 120, 60, 60)];
// Or add button to customView that you set in -init method
UIView *customView = ...;
[self.view addSubview:customView];
RCDraggableButton *avatar = [[RCDraggableButton alloc] initInView:customView WithFrame:CGRectMake(120, 120, 60, 60)];
You can also use it manually:
RCDraggableButton *draggableButton = [[RCDraggableButton alloc] initWithFrame:CGRectMake(0, 100, 60, 60)];
[self.view addSubview:draggableButton];
For more usage example, please look up the demo project in RCDraggableButtonDemo
, or the source files in Src
.
RCDraggableButton is available under the MIT license. See the LICENSE file for more info.