Git Product home page Git Product logo

byhelper's Introduction

BYHelper

swift类库的扩展和继承,方便开发调用

持续更新

###BYDelay

一个延迟执行的方法类

delay(2, { () -> () in
	println("2秒后执行")
})
let task = delay(1,{ () -> () in)
	println("已经取消了,永远进不来")
}
cancel(task)

###BYUIAlertViewBlock

提供UIAlertView的闭包扩展

var alert : UIAlertView = UIAlertView(title: "", message: text,delegate:nil, cancelButtonTitle:"取消",otherButtonTitles: "确定")
alert.show({ (index) -> Void in
	if index == 0{
		println("按了取消")
    }else{
    	println("按了确定")
    }
})

###BYUIActionSheetBlock

提供UIActionSheet的闭包扩展

var t = UIActionSheet(title: "", delegate: nil, cancelButtonTitle: "取消", destructiveButtonTitle: "删除", otherButtonTitles: "按钮1", "按钮2")
t.showInView(self.view, finish: { (index) -> Void in
	println(index)
})

###BYAlertController

方便在ios8适配中使用弹出视图,ios7中调用UIAlertView、UIActionSheet创建,iOS8使用UIAlertController创建

var sheet = BYAlertController(title: "选择图片", message: nil, preferredStyle: .ActionSheet, cancelButtonTitle: "取消", otherButtonTitles: "拍照","相册")
sheet.showAlertViewInViewController(self, clickedCancelButton: {
	println("按了取消"")
})
{ (index) -> () in
	println(index)	 
}

###BYUIImagePickerControllerBlock

提供获取相册图片的闭包扩展

var imagePickerController = UIImagePickerController()   imagePickerController.showInViewController(someVC, finish: { (image) -> Void in
    someImageView.image = image
    return
})

###BYUIViewExt

对UIView的扩展,提供了以下属性,方法

  • vleft
  • vright
  • vtop
  • vbottom
  • vcenterX
  • vcenterY
  • vwidth
  • vheight
  • vsize
  • removeAllSubviews()

###BYUIImageExt

对UIImage的扩展,使图片模糊化

  • applyLightEffect()->UIImage?
  • applyExtraLightEffect()->UIImage?
  • applyDarkEffect()->UIImage?
  • applyTintEffectWithColor(UIColor)->UIImage?

byhelper's People

Contributors

sgxiang avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar

Forkers

wangpeng1

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.