`
wang_peng1
  • 浏览: 3944267 次
  • 性别: Icon_minigender_1
  • 来自: 北京
社区版块
存档分类
最新评论
文章列表
static void ChangeEdgeEffect(Context cxt, View list, int color){ if (android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { EdgeEffect edgeEffectTop = new EdgeEffect(cxt); edgeEffectTop.setColor(color); EdgeEffect edgeEffectBottom = new EdgeEffect ...

发射打开wifi

WifiManager wifiManager = (WifiManager) getBaseContext() .getSystemService(Context.WIFI_SERVICE); wifiManager.setWifiEnabled(false); try { wifiManager.getClass() .getMethod("setWifiApEnabled", WifiConfiguration.clas ...

UIKeyboard 边框大小

let frame = (info[UIKeyboardFrameEndUserInfoKey] as NSValue).CGRectValue()  

隐藏状态栏

extension UIViewController { func prefersStatusBarHidden() -> Bool { return true } }  
extension Array { mutating func AppendObj(obj: T) { //... self.append(obj); } }  

Bad_Instruction

func tableView(tableView: UITableView!, cellForRowAtIndexPath indexPath: NSIndexPath!) -> UITableViewCell! { var cell : UITableViewCell = tableView.dequeueReusableCellWithIdentifier("Component") as UITableViewCell if (cell == nil) { cell = UITableViewCe ...
import Foundation extension Array { func contains(object:AnyObject!) -> Bool { if(self.isEmpty) { return false } let array: NSArray = self.bridgeToObjectiveC(); return array.containsObject(object) } func indexOf(object:AnyObje ...

RecyclerView

http://www.grokkingandroid.com/first-glance-androids-recyclerview/  
+ (id)buttonWithType:(UIButtonType)buttonType class func buttonWithType(buttonType: UIButtonType) -> AnyObject! 调用var button = UIButton.buttonWithType(UIButtonType.System) as UIButton + (instancetype)stringWithCString:(const char *)cString encoding:(NSStringEncoding)enc class func str ...

loadNibNamed的使用

原来-(id)init{ self = [[[NSBundle mainBundle] loadNibNamed:@"ViewBtnWishList" owner:0 options:nil] objectAtIndex:0]; return self; } swift extension UIView { class func loadFromNibNamed(nibNamed: String, bundle : NSBundle = NSBundle.mainBundle()) -> UIView! { r ...
var myActionSheet:UIActionSheet = UIActionSheet() var title : String? = "Select Source" myActionSheet.title = title myActionSheet.delegate = self myActionSheet.addButtonWithTitle("camera") myActionSheet.addButtonWithTitle(" ...
由于swift没有了指针类型  let myContext = UnsafePointer<()>() observee.addObserver(observer, forKeyPath: …, options: nil, context: myContext) override func observeValueForKeyPath(keyPath: String!, ofObject object: AnyObject!, change: [NSObject : AnyObject]!, context: UnsafePointer<()>) { ...

colorWithRed

backgroundColor=UIColor .colorWithRed(125/255.0, green: 125/255.0, blue: 125/255.0, alpha: 1.0) 改为 backgroundColor = UIColor(red: 0.5, green: 0.5, blue: 0.5, alpha: 1.0) 或者 import Foundation import UIKit extension UIColor { convenience init(rgb: UInt) { self.init( ...

isKindOfClass

override func touchesBegan(touches: NSSet, withEvent event: UIEvent) { super.touchesBegan(touches, withEvent: event) let touch : UITouch = touches.anyObject() as UITouch if touch.view.isKindOfClass(UIPickerView) { } } if let picker = touch.view as? UIPicker { ...

多参数函数

func sumOf(numbers: Int...) -> Int { var sum = 0 for number in numbers { sum += number } return sum } sumOf() // returns 0 sumOf(1,2) // returns 3 sumOf(42, 597, 12) // returns 651  
Global site tag (gtag.js) - Google Analytics