This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
原帖地址: http://topic.csdn.net/u/20110113/19/b0d5d506-4307-428b-a61d-7974aa66a2da.html | |
首先要说明的是:这里介绍的方法都是大部分是本人“悟”出来的,所以网上难有流传! | |
好方法不能自己私藏,否则就白忙乎这几天了,分享给有需要的朋友们。如果有转载,敬请注明来自*CSDN老邓*作品。 | |
呵呵,给自己打广告,实在是无耻之极,权当无聊之时打字之用。 | |
欢迎流传,为最优秀的分布式版本管理系统Git做宣传!! | |
步骤: | |
1. 下载:http://loaden.googlecode.com/files/gitconfig.7z | |
2. 解压到:<MsysGit安装目录>/cmd/,例如:D:\Program Files\Git\cmd |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
changeAlert = [UIAlertController alertControllerWithTitle:@"title" message:@"message" preferredStyle:UIAlertControllerStyleAlert]; | |
UIAlertController* __weak weakAlert = changeAlert; | |
UIAlertAction *alertActionOk = [UIAlertAction actionWithTitle:@"Ok" style:UIAlertActionStyleDestructive handler:^(UIAlertAction *action) { | |
UITextField *t = [[weakAlert textFields] firstObject]; | |
DLog(@"%@",t.text); | |
[weakAlert dismissViewControllerAnimated:YES completion:nil]; | |
}]; | |
UIAlertAction *alertActionCancel = [UIAlertAction actionWithTitle:@"Cancel" style:UIAlertActionStyleCancel handler:^(UIAlertAction *action) { | |
DLog(@"%@",action); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Label2.h | |
// (c) 2009 Ivan Misuno, www.cuberoom.biz | |
#import <UIKit/UIKit.h> | |
typedef enum | |
{ | |
VerticalAlignmentTop = 0, // default | |
VerticalAlignmentMiddle, | |
VerticalAlignmentBottom, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Label2.mm | |
// (c) 2009 Ivan Misuno, www.cuberoom.biz | |
#import "Label2.h" | |
@implementation Label2 | |
-(id)initWithFrame:(CGRect)frame | |
{ | |
self = [super initWithFrame:frame]; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// VerticallyAlignedLabel.h | |
// | |
#import <Foundation/Foundation.h> | |
typedef enum VerticalAlignment { | |
VerticalAlignmentTop, | |
VerticalAlignmentMiddle, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// VerticallyAlignedLabel.m | |
// | |
#import "VerticallyAlignedLabel.h" | |
@implementation VerticallyAlignedLabel | |
@synthesize verticalAlignment = verticalAlignment_; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//source : http://blog.csdn.net/yiya1989/article/details/7849588 | |
#define myprintf(...) printk("[lch]:File:%s, Line:%d, Function:%s," \ | |
__VA_ARGS__, __FILE__, __LINE__ ,__FUNCTION__); | |
//source : http://stackoverflow.com/questions/969130/how-to-print-out-the-method-name-and-line-number-and-conditionally-disable-nslog | |
#ifdef DEBUG | |
# define DLog(fmt, ...) NSLog((@"%s [Line %d] " fmt), __PRETTY_FUNCTION__, __LINE__, ##__VA_ARGS__) | |
#else | |
# define DLog(...) | |
#endif |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@interface XARC : NSObject | |
@property(nonatomic,strong) NSString* text; | |
@end | |
@implementation XARC | |
//-(NSString *)text{ | |
// return _text; | |
//} | |
@end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
protocol Constructible { | |
init() | |
} | |
struct devicePacketHeader{ | |
var head:Byte = 1; | |
var checksum:Byte = 2; | |
var deviceID:Byte = 3; | |
var command:Byte = 4; | |
var len:Int16 = 5; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class packetFactory{ | |
class func sender<T where T:Constructible, T:Packable>(command:devicePacketHeader.commandType,content:T) -> devicePacketSender<T>?{ | |
var header:devicePacketHeader | |
switch (command,content){ | |
case (.ASK_DEVICE,let TAsk) where TAsk is devicePacketNil: | |
header = devicePacketHeader(deviceID: .UNKNOWN, command: command, len:Int16(sizeof(T))) | |
// case (_,let TNil) where TNil is devicePacketNil: | |
// fallthrough |
OlderNewer