- 浏览: 3944267 次
- 性别:
- 来自: 北京
最新评论
-
hinuliba:
...
字体背景颜色的高度修改 -
KANGOD:
最后的 -createDialog() 私有方法是怎么回事,没 ...
简单的实现listView中item多个控件以及点击事件 -
sswangqiao:
呵呵,呵呵
onActivityResult传值的使用 -
yumeiqiao:
感觉你所的不清楚 lstView.setOnTouchLi ...
listview中viewflipper的问题 -
lizhou828:
果然是大神啊!!!
Animation动画效果的实现
文章列表
自定义listview 边缘效果
- 博客分类:
- android
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 ...
WifiManager wifiManager = (WifiManager) getBaseContext()
.getSystemService(Context.WIFI_SERVICE);
wifiManager.setWifiEnabled(false);
try {
wifiManager.getClass()
.getMethod("setWifiApEnabled",
WifiConfiguration.clas ...
UIKeyboard 边框大小
- 博客分类:
- swift
let frame = (info[UIKeyboardFrameEndUserInfoKey] as NSValue).CGRectValue()
extension UIViewController {
func prefersStatusBarHidden() -> Bool {
return true
}
}
array 添加任意对象
- 博客分类:
- swift
extension Array {
mutating func AppendObj(obj: T) {
//...
self.append(obj);
}
}
Bad_Instruction
- 博客分类:
- swift
func tableView(tableView: UITableView!, cellForRowAtIndexPath indexPath: NSIndexPath!) -> UITableViewCell! {
var cell : UITableViewCell = tableView.dequeueReusableCellWithIdentifier("Component") as UITableViewCell
if (cell == nil) {
cell = UITableViewCe ...
扩展Array 判断包含对象以及其索引
- 博客分类:
- swift
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
- 博客分类:
- android
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的使用
- 博客分类:
- swift
原来-(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 ...
UIActionSheet的使用
- 博客分类:
- swift
var myActionSheet:UIActionSheet = UIActionSheet()
var title : String? = "Select Source"
myActionSheet.title = title
myActionSheet.delegate = self
myActionSheet.addButtonWithTitle("camera")
myActionSheet.addButtonWithTitle(" ...
关于KVO context argument:
- 博客分类:
- swift
由于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
- 博客分类:
- swift
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
- 博客分类:
- swift
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