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
#---------------------------------------------------------------------------- | |
# Git Setup | |
#---------------------------------------------------------------------------- | |
file '.gitignore', <<-FILE | |
.DS_Store | |
log/*.log | |
tmp/**/* | |
config/database.yml | |
db/*.sqlite3 | |
public/uploads/* |
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
Original Source: https://github.com/chneukirchen/styleguide | |
= Christian Neukirchen's Ruby Style Guide | |
You may not like all rules presented here, but they work very well for | |
me and have helped producing high quality code. Everyone is free to | |
code however they want, write and follow their own style guides, but | |
when you contribute to my code, please follow these rules: | |
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 UIScrollViewDelegate | |
@optional | |
- (void)scrollViewWillBeginDragging:(UIScrollView *)scrollView | |
- (void)scrollViewDidEndDragging:(UIScrollView *)scrollView willDecelerate:(BOOL)decelerate | |
@end | |
@interface UIScrollView : UIView | |
@property (assign) id <UIScrollViewDelegate> delegate; |
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
- (void) clickButton | |
{ | |
NSOperationQueue *queue = [NSOperationQueue new]; | |
NSInvocationOperation *operation = [[NSInvocationOperation alloc] initWithTarget:self | |
selector:@selector(loadDataWithOperation) | |
object:nil]; | |
[queue addOperation:operation]; // will start the operation | |
[operation release]; | |
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
- (IBAction)clickButton | |
{ | |
[NSThread detachNewThreadSelector:@selector(startBackgroundJob) | |
toTarget:self | |
withObject:nil]; | |
} | |
- (void)startBackgroundJob | |
{ | |
[self performSelectorOnMainThread:@selector(makeProgressBarMoving) |
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
1.倒序输出一个数组 | |
NSMutableArray *array = [NSMutableArray arrayWithObjects:@"1",@"2",@"3",nil]; | |
NSArray* reversedArray = [[array reverseObjectEnumerator] allObjects]; |
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
1.Quartz 2D Programming Guide | |
http://developer.apple.com/library/mac/#documentation/GraphicsImaging/Conceptual/drawingwithquartz2d/Introduction/Introduction.html | |
2.Mail Composer in App | |
http://developer.apple.com/library/ios/#samplecode/MailComposer/index.html | |
3.NSNotification Center | |
https://developer.apple.com/library/ios/#documentation/Cocoa/Conceptual/Notifications/Introduction/introNotifications.html |
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
ios中UITaleView实现删除移动样式,当手指在每一行上滑动时,会出现删除按钮,并且点击可以实现相应的逻辑。 | |
实现的代码: | |
#pragma mark – View lifecycle | |
- (void)viewDidLoad | |
{ | |
[super viewDidLoad]; | |
[mtableView setEditing:NO animated:YES]; |
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
myLable=[[UILabel alloc] initWithFrame:CGRectMake(0, 23, 175, 33)]; | |
[myLable setFont:[UIFont fontWithName:@"Helvetica" size:10.0]]; | |
[myLable setNumberOfLines:0]; | |
[myLable setBackgroundColor:[UIColor clearColor]]; | |
[myAdView addSubview:myLable]; | |
UIFont *font = [UIFont fontWithName:@"Helvetica" size:10.0]; | |
CGSize size = [text sizeWithFont:font constrainedToSize:CGSizeMake(175.0f, 2000.0f) lineBreakMode:UILineBreakModeWordWrap]; | |
CGRect rect=myLable.frame; | |
rect.size=size; |