Code Monkey home page Code Monkey logo

dpwidgetsum's Introduction

Features

  • An UIButton custom class

Requirements

  • iOS 7.0 or later
  • tvOS 9.0 or later
  • watchOS 2.0 or later
  • OS X 10.8 or later
  • Xcode 8.0 or later

Getting Started

Who Uses It

Communication

  • If you need help, use Stack Overflow. (Tag 'DPWidgetSum')
  • If you'd like to ask a general question, use Stack Overflow.
  • If you found a bug, open an issue.
  • If you have a feature request, open an issue.
  • If you want to contribute, submit a pull request.

How To Use

Objective-C:

#import "ReactiveObjC.h"
#import "DPWidgetSum.h"
#import "DPDefaultView.h"
#import "DPMessageAlertView.h"
#import "DPTimeAlertPickerView.h"
...
- (void)viewDidLoad {
    [super viewDidLoad];

    UIButton *msgBtn = [UIButton buttonWithType:UIButtonTypeCustom];
    msgBtn.frame = CGRectMake(0, DP_StatusbarHeight+DP_FrameHeight(10), self.view.dp_width, 40);
    msgBtn.backgroundColor = [UIColor orangeColor];
    [msgBtn setTitle:@"消息弹框-DPMessageAlert" forState:UIControlStateNormal];
    dp_arc_block(self);
    [[msgBtn rac_signalForControlEvents:UIControlEventTouchUpInside] subscribeNext:^(__kindof UIControl * _Nullable x) {
        [ZCWAlertView showDPMessageAlertViewForTitle:@"警告" content:@"网络请求失败!" buttonTitles:@[@"取消", @"重新请求"] buttonBlock:nil];
    }];
    [self.view addSubview:msgBtn];
    
    UIButton *defaultBtn = [UIButton buttonWithType:UIButtonTypeCustom];
    defaultBtn.frame = CGRectMake(0, msgBtn.dp_yMax+DP_FrameHeight(10), self.view.dp_width, 40);
    defaultBtn.backgroundColor = [UIColor purpleColor];
    [defaultBtn setTitle:@"默认显示框-DPDefaultView" forState:UIControlStateNormal];
    [[defaultBtn rac_signalForControlEvents:UIControlEventTouchUpInside] subscribeNext:^(__kindof UIControl * _Nullable x) {
        [DPDefaultView showDefaulTSuperView:weak_self.view topImage:nil title:nil btnTitle:nil btnBlock:^(DPDefaultView *aObject, UIButton *aButton) {
            [aObject hiddenDefaulTSuperView];
        }];
    }];
    [self.view addSubview:defaultBtn];
    
    dateLab = [[UILabel alloc] init];
    dateLab.userInteractionEnabled = YES;
    dateLab.frame = CGRectMake(0, defaultBtn.dp_yMax+DP_FrameHeight(10), self.view.dp_width, DP_FrameHeight(40));
    dateLab.backgroundColor = [UIColor greenColor];
    dateLab.text = @"选择时间:";
    [self.view addSubview:dateLab];
    
    UITapGestureRecognizer *dateLabelTap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(dateLabelTapAction:)];
    [dateLab addGestureRecognizer:dateLabelTap];
}

- (void)dateLabelTapAction:(UITapGestureRecognizer *)tap {
    DPTimeAlertPickerView *datePickerView = [DPTimeAlertPickerView alertViewForParent:self.view uuid:0 alertViewStyle:DPTimeViewStyleOne level:1 AlertBlock:^(DPTimeAlertPickerView *aObject) {
        NSString *dateStr = [NSDate dp_getStrForDateOrStr:aObject.selectDate formatter:@"yyyy-MM-dd" isIntercept:NO];
        if (dateStr.length) {
            self->dateLab.text = [@"选择时间: " stringByAppendingString:dp_notEmptyStr(dateStr)];
        }
    }];
    NSDate *maxDate = [NSDate date];
    NSDate *minDate = [NSDate dp_getPriousorLaterDateFromDate:maxDate withMonth:-3];
    datePickerView.minDate = minDate;
    datePickerView.maxDate = maxDate;
    [datePickerView showTypeAlertViewForIsShow:YES];
}
...

Installation

There are three ways to use DPWidgetSum in your project:

  • using CocoaPods
  • using Carthage
  • by cloning the project into your repository

Installation with CocoaPods

CocoaPods is a dependency manager for Objective-C, which automates and simplifies the process of using 3rd-party libraries in your projects. See the Get Started section for more details.

Podfile

platform :ios, '7.0'
pod 'DPWidgetSum', '~> 1.0.5'

If you are using Swift, be sure to add use_frameworks! and set your target to iOS 8+:

platform :ios, '8.0'
use_frameworks!

Build Project

At this point your workspace should build without error. If you are having problem, post to the Issue and the community can help you solve it.

Collaborators

Licenses

All source code is licensed under the MIT License.

Pictures show

dpwidgetsum's People

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.